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 desk1 min

How to Change a Bar Chart Title Font Size in Matplotlib

Change a Matplotlib bar chart title with fontsize in ax.set_title or plt.title, or set axes.titlesize as a default for Axes titles.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Set the title size on the chart’s Axes with ax.set_title("Sales by month", fontsize=18). For pyplot’s state-based interface, use plt.title("Sales by month", fontsize=18). The bar-chart call does not control the title font size.

Set the font size for one bar chart

If you created a bar chart using an Axes object, pass fontsize when setting its title:

As an Amazon Associate I earn from qualifying purchases.

import matplotlib.pyplot as plt

fig, ax = plt.subplots()
ax.bar(["Jan", "Feb", "Mar"], [12, 18, 15])
ax.set_title("Sales by month", fontsize=18)
plt.show()

The number is the font size in points. Matplotlib’s Axes.set_title API sets an Axes title and accepts text properties such as fontsize.

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

Use pyplot’s title function instead

If your code uses pyplot without referring to an Axes object, pass the same argument to plt.title for the current Axes:

plt.bar(["Jan", "Feb", "Mar"], [12, 18, 15])
plt.title("Sales by month", fontsize=18)

Use either approach to set a particular chart’s title; choose the one that matches how the chart is constructed.

Set a reusable default for Axes titles

To change the default title size for titles created afterward, set axes.titlesize in Matplotlib’s runtime configuration:

import matplotlib.pyplot as plt

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

Set this before creating the titles you want affected. Matplotlib’s configuration documentation identifies axes.titlesize as the setting for Axes-title text size.

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

Title size is different from axis-label size

axes.titlesize applies to the title, not the x- or y-axis labels. Matplotlib has a separate axes.labelsize setting for those labels. To adjust labels for an individual chart, set their size separately, for example with ax.set_xlabel("Month", fontsize=12) or ax.set_ylabel("Sales", fontsize=12).

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

Adjust spacing only when needed

If the title text is the right size but sits too close to the Axes, change its padding rather than its font size:

ax.set_title("Sales by month", fontsize=18, pad=12)

Matplotlib documents pad as the title’s offset from the top of the Axes, measured in points.

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
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

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.