pie
AeroViz.plot.pie.pie
pie(data_set: DataFrame | dict, labels: list[str], unit: str, style: Literal['pie', 'donut'], ax: Axes | None = None, symbol: bool = True, **kwargs) -> tuple[Figure, Axes]
Create a pie or donut chart based on the provided data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_set
|
DataFrame | dict
|
A pandas DataFrame or dictionary mapping category names to a list of species. If a DataFrame is provided, the index represents the categories, and each column contains species data. If a dictionary is provided, it maps category names to lists of species data. It is assumed that all lists or DataFrame columns contain the same number of entries as the labels list. |
required |
labels
|
list of str
|
The labels for each category. |
required |
unit
|
str
|
The unit to display in the center of the donut chart. |
required |
style
|
Literal['pie', 'donut']
|
The style of the chart, either 'pie' for a standard pie chart or 'donut' for a donut chart. |
required |
ax
|
Axes or None
|
The Axes object to plot the chart onto. If None, a new figure and Axes will be created. |
None
|
symbol
|
bool
|
Whether to display values for each species in the chart. |
True
|
**kwargs
|
Additional keyword arguments to be passed to the plotting function. |
{}
|
Returns:
Type | Description |
---|---|
Axes
|
The Axes object containing the violin plot. |
Notes
- If data_set is a dictionary, it should contain lists of species that correspond to each category in labels.
- The length of each list in data_set or the number of columns in the DataFrame should match the length of the labels list.
Examples:
AeroViz.plot.pie.donuts
donuts(data_set: DataFrame | dict, labels: list[str], unit: str, ax: Axes | None = None, symbol=True, **kwargs) -> tuple[Figure, Axes]
Plot a donut chart based on the data set.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_set
|
DataFrame | dict
|
A pandas DataFrame or a dictionary mapping category names to a list of species. If a DataFrame is provided, the index represents the categories, and each column contains species data. If a dictionary is provided, it maps category names to lists of species data. It is assumed that all lists or DataFrame columns contain the same number of entries as the labels list. |
required |
labels
|
list of str
|
The category labels. |
required |
unit
|
str
|
The unit to be displayed in the center of the donut chart. |
required |
ax
|
Axes
|
The axes to plot on. If None, the current axes will be used (default). |
None
|
symbol
|
bool
|
Whether to display values for each species (default is True). |
True
|
**kwargs
|
dict
|
Additional keyword arguments to pass to the matplotlib pie chart function. |
{}
|
Returns:
Type | Description |
---|---|
Axes
|
The axes containing the donut chart. |