Donut Plot

A Donut chart is essentially a Pie Chart with an area of the center cut out. You can build one hacking the plt.pie() function of the matplotlib library as shown in the examples below.

⏱ Quick start

# library
import matplotlib.pyplot as plt

# create data

# Create a pieplot

# add a circle at the center to transform it in a donut chart
my_circle=plt.Circle( (0,0), 0.7, color='white')

Matplotlib logoDonut plot with Matplotlib

The example above is a good start but you probably need to go further. The blog posts linked below explain common tasks like adding and customizing labels, change section colors, add padding between each and more.


👋 This document is a work by Yan Holtz. You can contribute on github, send me a feedback on twitter or subscribe to the newsletter to know when new examples are published! 🔥