pizza_chart
This function creates a pie chart.
pizza_chart(**kwargs)
Input variables
Name | Description | Type |
---|---|---|
plot_setup | Setup chart Dictionary with the following keys:
| Dictionary |
dataset | Dataset to plot | List or array |
Output variables
Name | Description | Type |
---|---|---|
None | The function displays the plot on the screen and saves it to the local folder of the .ipynb or .py | None |
Example 1
Use the pizza_chart
function to perform a task.
# Data
df = pd.DataFrame({'category': ['Wheat', 'Rice', 'Bean', 'Potato', 'Canola'],
'values': [100, 250, 200, 120, 80]
})
# Chart setup
chart_config = {
'name': 'figure1-5-1',
'width': 15,
'height': 15,
'text color': 'w',
'text font size': 12,
'size legend': 10,
'colors': ['r', 'g', 'b', 'black', 'y'],
'dots per inch': 600,
'extension': 'svg',
}
# Data statement
data = {'dataset': df}
# Call function
pizza_chart(dataset=data, plot_setup=chart_config)
Figure 1. Week food consumption.