Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Clément Haëck
submeso-color
Commits
ca1ebc0f
Commit
ca1ebc0f
authored
Mar 21, 2022
by
Clément Haëck
Browse files
Add function to get masks colors
parent
4130e0b3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
Plots/util.py
Plots/util.py
+14
-0
No files found.
Plots/util.py
View file @
ca1ebc0f
...
...
@@ -5,6 +5,7 @@ import matplotlib.pyplot as plt
import
matplotlib.dates
as
md
import
matplotlib.ticker
as
mt
import
mpl_toolkits.axes_grid1
as
axes_grid1
import
tol_colors
as
tc
from
lib
import
root_plot
...
...
@@ -21,6 +22,19 @@ def use_tex(use=True):
plt
.
rc
(
'text'
,
usetex
=
use
)
def
get_mask_colors
(
csetname
=
'vibrant'
,
low
=
'red'
,
mid
=
'blue'
,
hi
=
'teal'
):
cset
=
tc
.
tol_cset
(
csetname
)
colors
=
dict
(
low
=
low
,
mid
=
mid
,
hi
=
hi
)
colors
=
{
m
:
getattr
(
cset
,
c
)
for
m
,
c
in
colors
.
items
()}
return
colors
def
get_mask_legend
(
colors
):
handles
=
[
plt
.
Line2D
((),
(),
color
=
c
)
for
c
in
colors
.
values
()]
labels
=
[
m
.
title
()
for
m
in
colors
.
keys
()]
return
handles
,
labels
def
MonthFormatter
(
fmt
=
'%b'
,
interval
=
1
):
def
formatter
(
x
,
pos
=
None
):
x
=
md
.
num2date
(
x
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment