src.plotting.plotting
¶
Module Contents¶
Functions¶
|
Create the weekly incidences from a list of simulation runs. |
|
Plot incidences. |
|
|
|
Plot a time series by group with more than one run. |
|
|
|
|
|
Shorten all incidence DataFrames. |
|
|
|
Make a scenario name nice. |
|
Attributes¶
Create the weekly incidences from a list of simulation runs.
- Parameters
results (list) – list of DataFrames with the time series data from sid simulations.
- Returns
- every column is the
weekly incidence over time for one simulation run. The index are the dates of the simulation period.
- Return type
virus_strain_shares (pandas.DataFrame)
- plot_incidences(incidences, title, name_to_label, colors, n_single_runs: Optional[int] = 0, scenario_starts=None, fig=None, ax=None, ylabel=None)[source]¶
Plot incidences.
- Parameters
incidences (dict) – keys are names of the scenarios, values are dataframes where each column is the incidence of interest of one run
title (str) – plot title.
name_to_label (dict) – keys must contain the ones in incidences. Values will be plotted as labels of the scenarios in the figure’s legend.
n_single_runs (Optional[int or None]) – Number of individual runs with different seeds visualize to show statistical uncertainty. Passing
None
will plot all runs.scenario_starts (list, optional) – the scenario start points. Each consists of a tuple of the date and a label.
ylabel (str, optional) – Label of the y axis.
- Returns
fig, ax
- plot_group_time_series(df, title, rki=None, ylabel=None)[source]¶
Plot a time series by group with more than one run.
- Parameters
df (pandas.DataFrame) – index levels are dates and group identifiers. There is one column for each simulation run.
title (str) – the title of the plot
rki (pandas.Series, optional) – Series with the RKI data. Must have the same index as df.
ylabel (str, optional) – label of the y axis.
- shorten_dfs(dfs, plot_start=None, plot_end=None)[source]¶
Shorten all incidence DataFrames.
All DataFrames are shortened to the shortest. In addition, if plot_start is given all DataFrames start at or after plot_start.
- Parameters
- Returns
- keys are the names of the scenarios, values are the shortened
DataFrames.
- Return type
shortened (dict)