Commit ca1ebc0f authored by Clément Haëck's avatar Clément Haëck
Browse files

Add function to get masks colors

parent 4130e0b3
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment