rsvsim.plotting module¶
Core plotting functions for simulations, multisims, and scenarios.
Also includes Plotly-based plotting functions to supplement the Matplotlib based ones that are of the Sim and Scenarios objects. Intended mostly for use with the webapp.
-
rsvsim.plotting.
date_formatter
(start_day=None, dateformat=None, interval=None, start=None, end=None, ax=None, sim=None)[source]¶ Create an automatic date formatter based on a number of days and a start day.
Wrapper for Matplotlib’s date formatter. Note, start_day is not required if the axis uses dates already. To be used in conjunction with setting the x-axis tick label formatter.
- Parameters
start_day (str/date) – the start day, either as a string or date object
dateformat (str) – the date format (default ‘%b-%d’)
interval (int) – if supplied, the interval between ticks (must supply an axis also to take effect)
start (str/int) – if supplied, the lower limit of the axis
end (str/int) – if supplied, the upper limit of the axis
ax (axes) – if supplied, automatically set the x-axis formatter for this axis
sim (Sim) – if supplied, get the start day from this
Examples:
# Automatically configure the axis with default option cv.date_formatter(sim=sim, ax=ax) # Manually configure ax = pl.subplot(111) ax.plot(np.arange(60), np.random.random(60)) formatter = cv.date_formatter(start_day='2020-04-04', interval=7, start='2020-05-01', end=50, dateformat='%Y-%m-%d', ax=ax) ax.xaxis.set_major_formatter(formatter)
-
rsvsim.plotting.
plot_sim
(to_plot=None, sim=None, do_save=None, fig_path=None, fig_args=None, plot_args=None, scatter_args=None, axis_args=None, fill_args=None, legend_args=None, date_args=None, show_args=None, mpl_args=None, n_cols=None, grid=False, commaticks=True, setylim=True, log_scale=False, colors=None, labels=None, do_show=None, sep_figs=False, fig=None, ax=None, **kwargs)[source]¶ Plot the results of a single simulation – see Sim.plot() for documentation
-
rsvsim.plotting.
plot_scens
(to_plot=None, scens=None, do_save=None, fig_path=None, fig_args=None, plot_args=None, scatter_args=None, axis_args=None, fill_args=None, legend_args=None, date_args=None, show_args=None, mpl_args=None, n_cols=None, grid=False, commaticks=True, setylim=True, log_scale=False, colors=None, labels=None, do_show=None, sep_figs=False, fig=None, ax=None, **kwargs)[source]¶ Plot the results of a scenario – see Scenarios.plot() for documentation
-
rsvsim.plotting.
plot_result
(key, sim=None, fig_args=None, plot_args=None, axis_args=None, scatter_args=None, date_args=None, mpl_args=None, grid=False, commaticks=True, setylim=True, color=None, label=None, do_show=None, do_save=False, fig_path=None, fig=None, ax=None, **kwargs)[source]¶ Plot a single result – see Sim.plot_result() for documentation
-
rsvsim.plotting.
plot_compare
(df, log_scale=True, fig_args=None, axis_args=None, mpl_args=None, grid=False, commaticks=True, setylim=True, color=None, label=None, fig=None, **kwargs)[source]¶ Plot a MultiSim comparison – see MultiSim.plot_compare() for documentation
-
rsvsim.plotting.
plot_people
(people, bins=None, width=1.0, alpha=0.6, fig_args=None, axis_args=None, plot_args=None, do_show=None, fig=None)[source]¶ Plot statistics of a population – see People.plot() for documentation
-
rsvsim.plotting.
plotly_sim
(sim, do_show=False)[source]¶ Main simulation results – parallel of sim.plot()