memilio.plot.plotMap
Functions
|
Reads data from a general json or specific hdf5 file as output by the MEmilio simulation framework and extracts parts of the data if filters are applied. The input regional data can be a time series data where a particular date is extracted or single time data which is used rightaway. If the file contains multiple features per region, particular columns need to be specified. |
|
Reads data from a general json or specific hdf5 file as output by the MEmilio simulation framework and extracts the number of days used. |
|
Merges geometries for Eisenach with Wartburgkreis of Geopandas dataframe. |
|
Plots region-specific information onto a interactive html map and returning svg and png image. |
|
Prints message to ask the user to manually download a file. |
|
Plots region-specific information in an interactive html map. |
|
Scales a population-related data frame relative to the size of the local populations or subpopulations (e.g., if not all age groups are considered). |
- memilio.plot.plotMap.extract_data(
- file,
- region_spec,
- column,
- date,
- filters=None,
- output='sum',
- file_format='json',
Reads data from a general json or specific hdf5 file as output by the MEmilio simulation framework and extracts parts of the data if filters are
applied. The input regional data can be a time series data where a
particular date is extracted or single time data which is used rightaway. If the file contains multiple features per region, particular columns need to be specified.
- Parameters:
file – Path and filename of file to be read in, relative from current directory.
region_spec – Specificier for region, for json, e.g., column name of county IDs for hdf5 level of nesting X where to retrieve fileX.keys(), X could either by empty, such that file.keys() is taken or a list of nested keys [X0, X1, …] such that file[X0][X1][…].keys()
column – Column with values that will be plotted.
data – Date to be extracted from data frame if it contains a time series or if single or no date information is in the input table, provide date=None. For json, pd.date Objects need to be used, for h5, provide an integer from the beginning of the time series.
filters – Dictionary with columns and values for filtering rows. None for a column or all filters means that all values are taken. For MEmilio h5 Files only ‘Group’ (AgeGroups from ‘Group1’ to ‘Total’) and ‘InfectionState’ (from 0 to InfetionState::Count-1) can be filtered.
output – [Either ‘sum’ or ‘matrix’] If ‘sum’ is chosen all selected values for one county will be summed up and only ‘column’ is returned for each county. If ‘matrix’ is chosen, then also the filter columns will be returned with the corresponding entries for each selected criterion or value.
file_format – File format; either json or h5.
- Returns:
Extracted data set.
- memilio.plot.plotMap.extract_time_steps(
- file,
- file_format='json',
Reads data from a general json or specific hdf5 file as output by the MEmilio simulation framework and extracts the number of days used.
- Parameters:
file – Path and filename to be read in, relative from current directory.
file_format – File format; either json or h5 (Default value = ‘json’)
- Returns:
Number of time steps.
- memilio.plot.plotMap.merge_eisenach(
- map_data: geopandas.GeoDataFrame,
Merges geometries for Eisenach with Wartburgkreis of Geopandas dataframe.
- Parameters:
map_data – geopandas.GeoDataFrame:
- Returns:
Frame with Wartburgkreis and Eisenach merged.
- memilio.plot.plotMap.plot_map(
- data: pandas.DataFrame,
- scale_colors: numpy.array,
- legend: list = [],
- title: str = '',
- plot_colorbar: bool = True,
- output_path: str = '',
- fig_name: str = 'customPlot',
- dpi: int = 300,
- outercolor='white',
- log_scale=False,
Plots region-specific information onto a interactive html map and returning svg and png image. Allows the comparisons of a variable list of data sets.
- Parameters:
data – pd.DataFrame: Data to be plotted. First column must contain regional specifier, following columns will be plotted for comparison.
scale_colors – np.array([0, 1]) Array of min-max-values to scale colorbar.
legend – list: Subtitles for different columns. Can be list of empty strings. (Default value = [])
title – str: Title of the plot. (Default value = ‘’)
plot_colorbar – bool: Defines if a colorbar will be plotted. (Default value = True)
output_path – str: Output path for the figure. (Default value = ‘’)
fig_name – str: Name of the figure created. (Default value = ‘customPlot’)
dpi – int: Dots-per-inch value for the exported figure. (Default value = 300)
outercolor – Background color of the plot image. (Default value = ‘white’)
log_scale – Defines if the colorbar is plotted in log scale. (Default value = False)
- memilio.plot.plotMap.print_manual_download(filename, url)
Prints message to ask the user to manually download a file.
- Parameters:
filename –
url –
- memilio.plot.plotMap.save_interactive(
- col,
- filename,
- map_data,
- scale_colors,
Plots region-specific information in an interactive html map.
- Parameters:
col – The column that will be plotted.
filename – Filename with path that determines the output directory.
map_data – Geopandas file with plot data.
scale_colors – Array of min-max-values to scale colorbar.
- memilio.plot.plotMap.scale_dataframe_relative(
- df,
- age_groups,
- df_population,
Scales a population-related data frame relative to the size of the local populations or subpopulations (e.g., if not all age groups are considered).
The first column in the input data frame and the population data frame to be read need to be named according to the region identifiers. All regions of the data frame to be scaled need to be available in the population data set.
- Parameters:
df – Data frame with population-related information.
age_groups – Considered age groups of population data taken into summation.
df_population – Data frame with population data set.
- Returns:
Scaled data set.