Skip to content

Commit

Permalink
reconcile plotting signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
cliffckerr committed Mar 28, 2020
1 parent daa3fb4 commit eab71dc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
9 changes: 5 additions & 4 deletions covasim/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 7 additions & 6 deletions covasim/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,19 +247,20 @@ 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 = []
else:
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():
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sciris>=0.16.4
sciris>=0.16.5
scirisweb>=0.16.0
matplotlib>=2.2.2
numpy>=1.10.1
Expand Down

0 comments on commit eab71dc

Please sign in to comment.