# Matplotlib Series 3: Pie chart

This blog specifies how to create pie chart with value labels, donut chart and nested pie chart, and how to adjust labels' size and position with matplotlib in Python.

This blog is part of Matplotlib Series:

## 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.