diff --git a/covasim/model.py b/covasim/model.py index 94ca50999..6c660bfeb 100644 --- a/covasim/model.py +++ b/covasim/model.py @@ -676,10 +676,11 @@ def plot(self, to_plot=None, do_save=None, fig_path=None, fig_args=None, plot_ar to_plot = default_sim_plots to_plot = sc.odict(to_plot) # In case it's supplied as a dict - if fig_args is None: fig_args = {'figsize':(16,12)} - if plot_args is None: plot_args = {'lw':3, 'alpha':0.7} - if scatter_args is None: scatter_args = {'s':150, 'marker':'s'} - if axis_args is None: axis_args = {'left':0.1, 'bottom':0.05, 'right':0.9, 'top':0.97, 'wspace':0.2, 'hspace':0.25} + # Handle input arguments -- merge user input with defaults + fig_args = sc.mergedicts({'figsize':(16,12)}, fig_args) + plot_args = sc.mergedicts({'lw':3, 'alpha':0.7}, plot_args) + scatter_args = sc.mergedicts({'s':150, 'marker':'s'}, scatter_args) + axis_args = sc.mergedicts({'left':0.1, 'bottom':0.05, 'right':0.9, 'top':0.97, 'wspace':0.2, 'hspace':0.25}, axis_args) fig = pl.figure(**fig_args) pl.subplots_adjust(**axis_args) diff --git a/covasim/run.py b/covasim/run.py index 40bc2e225..c5e4d877e 100644 --- a/covasim/run.py +++ b/covasim/run.py @@ -247,11 +247,11 @@ def plot(self, to_plot=None, do_save=None, fig_path=None, fig_args=None, plot_ar to_plot = default_scen_plots to_plot = sc.odict(sc.dcp(to_plot)) # In case it's supplied as a dict - fig_args = {'figsize': (16, 12)} - plot_args = {'lw': 3, 'alpha': 0.7} - axis_args = {'left': 0.10, 'bottom': 0.05, 'right': 0.95, 'top': 0.90, 'wspace': 0.5, 'hspace': 0.25} - fill_args = {'alpha': 0.2} - font_size = 18 + # Handle input arguments -- merge user input with defaults + fig_args = sc.mergedicts({'figsize': (16, 12)}, fig_args) + plot_args = sc.mergedicts({'lw': 3, 'alpha': 0.7}, plot_args) + axis_args = sc.mergedicts({'left': 0.10, 'bottom': 0.05, 'right': 0.95, 'top': 0.90, 'wspace': 0.5, 'hspace': 0.25}, axis_args) + fill_args = sc.mergedicts({'alpha': 0.2}, fill_args) if separate_figs: figs = [] @@ -259,7 +259,8 @@ def plot(self, to_plot=None, do_save=None, fig_path=None, fig_args=None, plot_ar fig = pl.figure(**fig_args) pl.subplots_adjust(**axis_args) pl.rcParams['font.size'] = font_size - pl.rcParams['font.family'] = 'Proxima Nova' # NB, may not be available on all systems + if font_family: + pl.rcParams['font.family'] = font_family # %% Plotting for rk,reskey,title in to_plot.enumitems(): diff --git a/requirements.txt b/requirements.txt index a4e1ad95d..86197e057 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -sciris>=0.16.4 +sciris>=0.16.5 scirisweb>=0.16.0 matplotlib>=2.2.2 numpy>=1.10.1