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.
When to use it
- A dashboard tile with one key share and a total.
- Two to four parts.
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()
Upload a CSV, Excel, JSON or Parquet file. Your first plot is always free.