October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk2 min

How to Change a Pie Chart Title Font Size in Matplotlib

Change an individual pie chart title with ax.set_title("My pie chart", fontsize=16). Use plt.title() for the current Axes, axes.titlesize for a default, or fig.suptitle() for a figure heading.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Set fontsize on the Axes title—not on pie(). For example, use ax.set_title("My pie chart", fontsize=16) to give that chart’s title a 16-point font size.

Set the font size for one pie chart

When you create a chart with fig, ax = plt.subplots(), set the title directly on its Axes. Matplotlib describes Axes.set_title as setting a title for the Axes.

As an Amazon Associate I earn from qualifying purchases.

import matplotlib.pyplot as plt

fig, ax = plt.subplots()
ax.pie([40, 35, 25], labels=["A", "B", "C"])
ax.set_title("My pie chart", fontsize=16)
plt.show()

The numeric value gives the title size in points. You can also use a relative size such as "large" instead of a number.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use pyplot for the current Axes

If your code uses pyplot’s stateful interface, pass fontsize to plt.title():

plt.pie([40, 35, 25], labels=["A", "B", "C"])
plt.title("My pie chart", fontsize=16)
plt.show()

Matplotlib documents plt.title() as a wrapper for Axes.set_title(). It sets the title on the current Axes. If a figure has multiple Axes, use ax.set_title() to specify which chart receives the title.

Set a default size for Axes titles

To change the default inherited by Axes titles, set axes.titlesize before creating those titles:

plt.rcParams["axes.titlesize"] = 16

This changes the default for Axes titles in the active Matplotlib configuration; it is broader than setting fontsize on one title. See Matplotlib’s customization documentation.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Distinguish an Axes title from a figure title

If the heading you want to resize belongs to the entire figure rather than the pie chart’s Axes, set the figure-level title with fig.suptitle():

fig.suptitle("My figure", fontsize=16)

This controls a different title scope from ax.set_title(). If changing the Axes title size does not affect the visible heading, check whether the code created it with fig.suptitle(). Matplotlib documents this method in its Figure API.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why plt.pie() has no title font-size argument

plt.pie() draws the pie chart; the title is a separate Axes or figure element. Set its size through the relevant title method’s fontsize keyword, rather than passing a title-size argument to pie(). Passing fontsize directly is the concise option; Matplotlib’s pyplot title API discourages using fontdict.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.