Use ax.set_title() to title an individual subplot and fig.suptitle() to title the complete figure. They label different levels of a Matplotlib visualization, so a figure with several panels can have both.
Title each subplot and the whole figure
Each subplot is an Axes object. Call its set_title() method to identify that panel; call the Figure object’s suptitle() method to describe the multi-panel figure as a whole. The Matplotlib gallery demonstrates the two together in its figure-labels example.
As an Amazon Associate I earn from qualifying purchases.
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 5, 501)
fig, (ax1, ax2) = plt.subplots(1, 2, layout="constrained", sharey=True)
ax1.plot(x, np.cos(6 * x) * np.exp(-x))
ax1.set_title("damped")
ax1.set_xlabel("time (s)")
ax1.set_ylabel("amplitude")
ax2.plot(x, np.cos(6 * x))
ax2.set_title("undamped")
ax2.set_xlabel("time (s)")
fig.suptitle("Different types of oscillations", fontsize=16)
plt.show()
In this example, “damped” and “undamped” identify the separate panels, while “Different types of oscillations” describes the figure’s comparison. The code follows the Matplotlib gallery pattern; layout="constrained" asks Matplotlib to account for the titles and other decorations when arranging the figure.
Recommended Free Tools
Choose a title location for an Axes
Axes.set_title(label, loc=...) supports center, left, and right locations. The method also accepts text properties such as fontsize and fontweight. Its y argument sets the vertical position in Axes coordinates, where 1.0 is the top of the Axes. If y is left as None, Matplotlib determines the position automatically to avoid Axes decorations. The documented pad default is 6.0 points. These details are from the Matplotlib 3.11.1 Axes.set_title API.
#1 Best Overall
ax.set_title("Temperature", loc="left", fontsize=13, fontweight="bold")
ax.set_title("Station A", loc="right")
Each call sets the title at its requested location; use the location that helps readers distinguish panel context from a centered panel heading. The API discourages using fontdict; individual text-property keyword arguments are the preferred approach. set_title() returns a Matplotlib Text instance if you need to adjust the title afterward.
Position and style the figure suptitle
Figure.suptitle(t, ...) places a title in figure coordinates. The documented defaults for x and y are 0.5 and 0.98, respectively, which center the title near the top of the figure. Horizontal and vertical alignment, along with text styling, can be set in the call. Normally the size and weight follow the figure.titlesize and figure.titleweight settings. If you supply fontproperties, its defaults replace those figure rcParams defaults. See the Matplotlib 3.11.2 figure API for the documented parameters. The method returns a Text instance.
Rank #2
fig.suptitle("Quarterly results", x=0.5, y=0.99, fontsize=16, ha="center")
Handle spacing and aligned subplot titles
Start with a layout engine when combining an overall title, subplot titles, axis labels, and other decorations. Matplotlib’s gallery example uses layout="constrained", but that example is not a guarantee that every figure will fit at every size or with every font and backend. Inspect the rendered figure, especially after changing its dimensions or saving it at a different size; adjust the layout or title position if elements overlap.
When subplot-title positioning is automatic and the Axes share a GridSpec arrangement, fig.align_titles() can align titles in a row. The API says the Axes are expected to share a GridSpec relationship and that alignment persists across draw events after the method is called. Consult the Figure API for the method’s conditions.
Give a nested plot group its own title
For a larger figure organized into groups of plots, use Figure.subfigures() to create subfigures. A SubFigure can have its own suptitle(), while the parent Figure can retain an overall suptitle. This gives the title hierarchy three useful levels: panel titles on Axes, group titles on SubFigures, and a title for the complete Figure. Matplotlib demonstrates this arrangement in its Figure subfigures example.
Quick Recap
Best Value
Rank #4
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.




