Skip to content

Instantly share code, notes, and snippets.

@janmeww
janmeww / donut-example.py
Created May 2, 2019 12:44 — forked from krishnakummar/donut-example.py
Donut chart using python matplotlib
import matplotlib.pyplot as plt
# The slices will be ordered and plotted counter-clockwise.
labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
sizes = [15, 30, 45, 10]
colors = ['yellowgreen', 'gold', 'lightskyblue', 'lightcoral']
explode = (0, 0, 0, 0) # explode a slice if required
plt.pie(sizes, explode=explode, labels=labels, colors=colors,
autopct='%1.1f%%', shadow=True)