To change an individual Matplotlib subplot title’s size and weight, pass fontsize and fontweight to ax.set_title():
ax.set_title("Sales by region", fontsize=16, fontweight="bold")
Use fig.suptitle() for a heading across the whole figure, or Matplotlib’s axes.titlesize and axes.titleweight settings to establish defaults for Axes titles.
Style one subplot title
Call set_title() on the Axes whose title you want to change. Its fontsize and fontweight keyword arguments accept standard text properties:
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.plot([1, 2, 3], [4, 2, 5])
ax.set_title("Sales by region", fontsize=16, fontweight="bold")
plt.show()
This styles only that Axes title. The method returns the title’s Text instance, which can be useful if you want to adjust the text object afterward. See the Matplotlib Axes.set_title API reference.
#1 Best Overall
Choose the right title scope
| What you want to title | Method | Example |
|---|---|---|
| One subplot (one Axes) | ax.set_title() |
ax.set_title("Sales", fontsize=16, fontweight="bold") |
| The whole figure | fig.suptitle() |
fig.suptitle("Quarterly results", fontsize=18, fontweight="bold") |
A figure supertitle is centered at the Figure level, above the individual Axes titles. It does not replace them. The Figure API reference documents Figure.suptitle.
Set default size and weight for Axes titles
If many plots should share the same title styling, configure Matplotlib’s rcParams instead of repeating the same keywords in every call:
Rank #2
import matplotlib as mpl
mpl.rcParams["axes.titlesize"] = 16
mpl.rcParams["axes.titleweight"] = "bold"
These values establish defaults for Axes titles. An explicit keyword in a particular set_title() call can give that title a different appearance. Defaults can also vary with the active style or user configuration. Matplotlib’s customization guide covers rcParams and style sheets.
Adjust title position and alignment
Axes.set_title() also accepts loc to align a title in the center, left, or right. Use pad to adjust the gap above the Axes in points, or y to set its vertical position. If y is omitted, Matplotlib chooses a position intended to avoid overlapping Axes decorations.
Free tools Windows power users keep installed
One-click scans. No signup required.
ax.set_title(
"Sales by region",
fontsize=16,
fontweight="bold",
loc="left",
pad=12,
)
Pass text properties as individual keywords, as above, or unpack a dictionary of properties. The current API reference does not recommend fontdict as the preferred way to set them.
Quick Recap
Best Value
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.




