not sure why this works when it crashed previously...
@@ -362,7 +362,7 @@ class Sim(ParsObj):
- def plot(self, do_save=None, fig_args=None, plot_args=None, scatter_args=None, axis_args=None, as_days=True, font_size=16):
+ def plot(self, do_save=None, fig_args=None, plot_args=None, scatter_args=None, axis_args=None, as_days=True, font_size=16, verbose=None):
'''
Plot the results -- can supply arguments for both the figure and the plots.
@@ -383,9 +383,13 @@ class Sim(ParsObj):
Returns
-------
Figure handle
-
'''
+ if verbose is None:
+ verbose = self.pars['verbose']
+ if verbose:
+ print('Plotting...')
+
if fig_args is None: fig_args = {'figsize':(26,16)}
if plot_args is None: plot_args = {'lw':3, 'alpha':0.7, 'marker':'o'}
if scatter_args is None: scatter_args = {'s':150, 'marker':'s'}
@@ -413,14 +417,23 @@ class Sim(ParsObj):
for p,title,keylabels in to_plot.enumitems():
pl.subplot(2,1,p+1)
for i,key,label in keylabels.enumitems():
- this_color = colors[i+p] # TODO: Fix Matplotlib complaints
+ this_color1 = pl.array([colors[i+p]], dtype=float)
+ this_color2 = colors[i+p] # TODO: Fix Matplotlib complaints
+ print(this_color1)
+ print(this_color2)
y = res[key]
- pl.plot(res['t'], y, label=label, **plot_args, c=this_color)
+ # pl.plot(res['t'], y, label=label, **plot_args, c=this_color1)
if key == 'diagnoses': # TODO: fix up labeling issue
- pl.scatter(self.data['day'], self.data['new_positives'], c=this_color, **scatter_args)
- elif key == 'tests': # TODO: fix up labeling issue
- pl.scatter(self.data['day'], self.data['new_tests'], c=this_color, **scatter_args)
- pl.scatter(pl.nan, pl.nan, c=[0,0,0], label='Data', **scatter_args)
+ print('OMG')
+ print(repr(this_color1))
+ print('OMG2')
+ print(repr(pl.array([colors[i+p]], dtype=float)))
+ assert (this_color1 == pl.array([colors[i+p]], dtype=float)).all()
+ pl.scatter([self.data['day']], [self.data['new_positives']], c=this_color1, **scatter_args)
+ pl.scatter([self.data['day']], [self.data['new_positives']], c=pl.array([colors[i+p]], dtype=float), **scatter_args)
+ # elif key == 'tests': # TODO: fix up labeling issue
+ # pl.scatter(self.data['day'], self.data['new_tests'], c=this_color, **scatter_args)
+ # pl.scatter(-1, -1, c=[(0,0,0)], label='Data', **scatter_args)
fixaxis()
pl.ylabel('Count')
pl.xlabel('Day')
