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.
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:
#1 Best Overall
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.
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).
Rank #3
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.
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.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →




