Plot guides › Chart types

Donut chart

A donut chart is a pie chart with the centre removed, which leaves room for a total or headline number. It has the same strengths and limits as a pie chart.

Example donut chart made with matplotlib
Rendered from the code below, with example data.

When to use it

Ask for it in pltchat

Upload your file and type something like:

"donut chart of budget by category, total in the middle"

pltchat writes the loader and the plot for your columns, runs it in your browser and shows you the code.

The matplotlib code

Self-contained with example data; swap in pd.read_csv(...) or pd.read_excel(...) for your own file.

import matplotlib.pyplot as plt

labels = ["Salaries", "Equipment", "Travel", "Other"]
amounts = [62, 21, 10, 7]

fig, ax = plt.subplots(figsize=(5, 4))
ax.pie(amounts, labels=labels, autopct="%1.0f%%", pctdistance=0.78,
       startangle=90, counterclock=False,
       wedgeprops={"width": 0.4, "edgecolor": "w"})
ax.text(0, 0, f"${sum(amounts)}k", ha="center", va="center",
        fontsize=16, weight="bold")
plt.tight_layout()
plt.show()

Make this with your data

Upload a CSV, Excel, JSON or Parquet file. Your first plot is always free.

Related plots