bucky.viz package¶
Submodules¶
bucky.viz.geoid module¶
-
bucky.viz.geoid.
read_geoid_from_graph
(graph_file=None)¶ Creates a dataframe relating geographic administration levels, e.g. admin2 values in a given admin1.
- Parameters
graph_file (string or None) – Location of graph file. If None, uses most recently created graph in data/input_graphs/
- Returns
df – Dataframe with names and values for admin0, admin1, and admin2 levels
- Return type
Pandas DataFrame
-
bucky.viz.geoid.
read_lookup
(geofile, country='US')¶ Creates a dataframe relating geographic administration levels, e.g. admin2 values in a given admin1 based on a lookup table.
- Parameters
geofile (string) – Location of lookup table
country (string (default: 'US')) – Country name
- Returns
df – Dataframe with names and values for admin0, admin1, and admin2
- Return type
Pandas DataFrame
bucky.viz.map module¶
bucky.viz.plot module¶
-
bucky.viz.plot.
interval
(mean, sem, conf, N)¶
-
bucky.viz.plot.
make_plots
(adm_levels, input_dir, output_dir, lookup, plot_hist, plot_columns, quantiles, window_size, end_date, hist_file, min_hist_points, admin1=None, hist_start=None)¶ Wrapper function around plot. Creates plots, aggregating data if necessary.
- Parameters
adm_levels (list of strings) – List of ADM levels to make plots for
input_dir (string) – Location of simulation data
output_dir (string) – Parent directory to place created plots.
lookup (Pandas DataFrame) – Lookup table for geographic mapping information
plot_hist (boolean) – If true, will plot historical data
plot_columns (list of strings) – List of columns to plot from data
quantiles (list of floats (or None)) – List of quantiles to plot. If None, will plot all available quantiles in data.
window_size (int) – Size of window (in days) to apply to historical data
end_date (string, formatted as YYYY-MM-DD) – Plot data until this date. If None, uses last date in simulation
hist_file (string) – Path to historical data file. If None, uses either CSSE or Covid Tracking data depending on columns requested.
min_hist_points (int) – Minimum number of historical data points to plot.
admin1 (list of strings, or None) – List of admin1 values to make plots for. If None, a plot will be created for every unique admin1 values. Otherwise, plots are only made for those requested.
hist_start (string, formatted as YYYY-MM-DD) – Plot historical data from this point. If None, aligns with simulation start date
-
bucky.viz.plot.
plot
(output_dir, lookup_df, key, sim_data, hist_data, plot_columns, quantiles)¶ Given a dataframe and a key, creates plots with requested columns.
For example, a DataFrame with state-level data would create a plot for each unique state. Simulation data is plotted as a line with shaded confidence intervals. Historical data is added as scatter points if requested.
- Parameters
output_dir (string) – Location to place created plots.
lookup_df (Pandas DataFrame) – Dataframe containing information relating different geographic areas
key (string) – Key to use to relate simulation data and geographic areas. Must appear in lookup and simulation data (and historical data if applicable)
sim_data (Pandas DataFrame) – Simulation data to plot
hist_data (Pandas DataFrame) – Historical data to add to plot
plot_columns (list of strings) – Columns to plot
quantiles (list of floats (or None)) – List of quantiles to plot. If None, will plot all available quantiles in data.