This blog is part of Matplotlib Series:
- Matplotlib Series 1: Bar chart
- Matplotlib Series 2: Line chart
- Matplotlib Series 3: Pie chart (this blog)
- Matplotlib Series 4: Scatter plot
- Matplotlib Series 5: Treemap
- Matplotlib Series 6: Venn diagram
- Matplotlib Series 7: Area chart
- Matplotlib Series 8: Radar chart
- Matplotlib Series 9: Word cloud
- Matplotlib Series 10: Lollipop plot
- Matplotlib Series 11: Histogram
Pie chart
A pie chart (or a circle chart) is a circular statistical graphic which is divided into slices to illustrate numerical proportion. In a pie chart, the arc length of each slice (and consequently its central angle and area), is proportional to the quantity it represents.
When to use it ?
- Show percentage or proportional data.
- Less than 7 categories.
- Display data that is classified into nominal or ordinal categories.
- Try to use positive values.
Example
This pie chart describes the turnovers’ percentage for each fruit. Sales of apple bring the most turnover among 7 fruits, who presents 32% of turnover. If the values represent volume instead of turnover, then we should prepare more apples than other fruits in the store.
Donut chart
A donut chart is a variant of the pie chart, with a blank center allowing for additional information about the data as a whole to be included. This type of circular graph can support multiple statistics at once and it provides a better data intensity ratio to standard pie charts. It does not have to contain information in the center.
Example
Extracly the same implication as the pie chart above.
Nested pie chart
A nested pie chart or multi-level pie chart allows you to incorporate multiple levels or layers into your pie. Nested pies are a module variation on our standard pie chart type.
When to use it ?
- Show symmetrical and asymmetrical tree structures in a consolidated pie-like structure.
- Multi-tiered data presentation, e.g., keyword analysis
- Inter-linked tree data, e.g., friends of friends
Example
This chart specifies a second level for consommation of vegetable and fruit, respectively. In general, vegetable is more consummed than fruit. Among three vegetables, potato is much more popular than others; among 4 fruits, apple is the most sold. Thus, for the retailers, they need to prepare more potatoes and apples than other vegetables and fruits.
You can click here to check this example in jupyter notebook.
Reference
- Steve Johnson, “painting wallpaper”, www.pexels.com. [Online]. Available: https://www.pexels.com/photo/painting-wallpaper-1070527/