working on plotting strings
@@ -92,7 +92,12 @@ def handle_to_plot(kind, to_plot, n_cols, sim, check_ready=True):
errormsg = 'Cannot plot since results are not ready yet -- did you run the sim?'
raise RuntimeError(errormsg)
- # If not specified or specified as a string, load defaults
+ # If it matches a result key, convert to a list
+ reskeys = sim.result_keys()
+ if to_plot in reskeys:
+ to_plot = sc.tolist(to_plot)
+
+ # If not specified or specified as another string, load defaults
if to_plot is None or isinstance(to_plot, str):
to_plot = cvd.get_default_plots(to_plot, kind=kind, sim=sim)
@@ -100,7 +105,7 @@ def handle_to_plot(kind, to_plot, n_cols, sim, check_ready=True):
if isinstance(to_plot, list):
to_plot_list = to_plot # Store separately
to_plot = sc.odict() # Create the dict
- reskeys = sim.result_keys()
+
for reskey in to_plot_list:
name = sim.results[reskey].name if reskey in reskeys else sim.results['variant'][reskey].name
to_plot[name] = [reskey] # Use the result name as the key and the reskey as the value
