onstove.OnStove.plot_split#
- OnStove.plot_split(labels: dict[str, str] | None = None, cmap: dict[str, str] | None = None, x_variable: str = 'Calibrated_pop', fill: str = 'max_benefit_tech', ascending: bool = True, orientation: str = 'horizontal', font_args: dict | None = None, annotation_kwargs: dict | None = None, labs_kwargs: dict | None = None, legend_kwargs: dict | None = None, theme_name: str = 'minimal', height: float = 1.5, width: float = 2.5, save_as: str | None = None, dpi: int = 150) matplotlib.Figure [source]#
Displays a bar plot with the population or households share using the technologies with highest net-benefits over the study area.
- Parameters:
- labels: dictionary of str key-value pairs, optional
Dictionary with the keys-value pairs to use for the data categories.
{'Collected Traditional Biomass': 'Biomass', 'Collected Improved Biomass': 'Biomass ICS (ND)', 'Traditional Charcoal': 'Charcoal', 'Biomass Forced Draft': 'Biomass ICS (FD)', 'Pellets Forced Draft': 'Pellets ICS (FD)'}
- cmap: dictionary of str key-value pairs, optional
Dictionary with the colors to use for each technology.
{'Biomass ICS (ND)': '#6F4070', 'LPG': '#66C5CC', 'Biomass': '#FFB6C1', 'Biomass ICS (FD)': '#af04b3', 'Pellets ICS (FD)': '#ef02f5', 'Charcoal': '#364135', 'Charcoal ICS': '#d4bdc5', 'Biogas': '#73AF48'}
- x_variable: str, default ‘Calibrated_pop’
The variable to use in the x axis. Two options are available
Calibrated_pop
andHouseholds
.- fill: str, default ‘max_benefit_tech’
Categorical variable used to color and group the bars.
- ascending: boolean, default `True`
If True it will order the bars in ascending order from left to right.
- orientation: str, default ‘horizontal’
It defines the orientation of the bar plot, takes as options ‘horizontal’ or ‘vertical’.
- font_args: dict, optional
Dictionary with arguments for the general text of the plot such as text size. It defaults to
font_args=dict(size=10)
.- annotation_kwargs: dict, optional
Dictionary with arguments for the annotations text of the plot such as text size, color, vertical and horizontal alignment. It defaults to
annotation_kwargs=dict(color='black', size=10, va='center', ha='left')
.- labs_kwargs: dict, optional
Dictionary with arguments for the x, y and fill labels. It defaults to
labs_kwargs=dict(x='Stove share', y='Population (Millions)', fill='Cooking technology')
.- legend_kwargs: dict, optional
Dictionary with arguments for the legend such as the legend position. It defaults to
legend_kwargs=dict(legend_position='none')
.- theme_name: str, default ‘minimal’
Theme to use for the plot. Available options are ‘minimal’ and ‘classic’ from the plotnine:generated/plotnine.themes package.
- height: float, default 1.5
The heihg of the figure in inches.
- width: float, default 2.5
The width of the figure in inches.
- save_as: str, optional
If a string is passed, then the plot will be saved with that name and extension file in the:attr:output_directory as
name.pdf
,name.png
,name.svg
, etc.- dpi: int, default 150
The resolution of the figure in dots per inch.
- Returns:
- matplotlib.Figure
Figure object used to plot the technology split.