bucky.viz.map
Bucky Mapping Tools.
Creates maps at the ADM0, ADM1, or ADM2 level.
get_dates(df, frequency='weekly')
get_dates
Given a pandas.DataFrame of simulation data, this method returns dates based on the requested frequency.
get_map_data(data_dir, adm_level)
get_map_data
Read requested simulation data.
get_state_outline(adm2_data, adm1_data)
get_state_outline
Given admin2 shape data, finds matching admin1 shape data in order to get the admin1 outline.
make_adm1_maps(adm2_shape_df, adm1_shape_df, df, lookup_df, dates, cols, adm1_list, output_dir, log_scale=True, colormap='Reds', add_outline=False)
make_adm1_maps
Create adm1 maps.
make_map(shape_df, df, dates, adm_key, cols, output_dir, title_prefix=None, log_scale=True, colormap='Reds', outline_df=None)
make_map
Create a map for each date and column.
bucky.viz.map.
args
default_cmap
default_plot_cols
parser
df (pandas.DataFrame) – Dataframe of simulation data
pandas.DataFrame
frequency ({"weekly", "daily", "monthly"}) – Frequency of selected dates
{"weekly", "daily", "monthly"}
date_list – List of dates
list of str
list
str
Maps are created using one level down from the requested map level. For example, a national map is created using state-level data.
data_dir (str) – Location of preprocessed simulation data
adm_level ({"adm0", "adm1"}) – Admin level of requested map
{"adm0", "adm1"}
df – Requested preprocessed simulation data
adm2_data (geopandas.GeoDataFrame) – Admin2-level shape data
geopandas.GeoDataFrame
adm1_data (geopandas.GeoDataFrame) – Admin1-level shape data
outline_df – Admin1-level shape data that match values in admin2
adm2_shape_df (geopandas.GeoDataFrame) – Shapefile information at the admin2 level
adm1_shape_df (geopandas.GeoDataFrame) – Shapefile information at the admin1 level
df (pandas.DataFrame) – Simulation data to plot
lookup_df (pandas.DataFrame) – Dataframe containing mapping between admin levels
dates (list of str) – List of dates to make maps for
cols (list of str) – List of columns to make maps for
adm1_list (list of str, or None) – List of explicit admin1 names to create names for. If None, a map is made for each unique admin1 in the lookup table
None
output_dir (str) – Directory to place created maps
log_scale (bool, default True) – If true, uses log scaling
bool
True
colormap (str, default "Reds") – Colormap to use; must be a valid Matplotlib colormap
"Reds"
add_outline (bool, default False) – Add a thicker outline to the map
False
shape_df (geopandas.GeoDataFrame) – Shapefile information at the required admin level
adm_key (str) – Admin level key
title_prefix (str, or None) – String to add to map prefix
log_scale (bool) – If true, uses log scaling
outline_df (geopandas.GeoDataFrame, or None) – Shapefile for outline
bucky.viz.geoid
bucky.viz.plot