Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minuteSet fontsize on an axis-label method to change an x- or y-label without changing tick labels: ax.set_xlabel("Time", fontsize=14). The value is in points; 14 is an example, not a universal recommendation.
Change the font size for one plot
Use the Axes methods to set either label independently:
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.set_xlabel("Time", fontsize=14)
ax.set_ylabel("Value", fontsize=14)
fontsize is a text property accepted by both label-setting methods. You can also use the pyplot convenience function for the current Axes:
plt.xlabel("Time", fontsize=14)
For subplots or code that works with a particular Axes, ax.set_xlabel and ax.set_ylabel make the target explicit. Pyplot calls such as plt.xlabel apply to the current Axes. See the Axes set_xlabel API, Axes set_ylabel API, and pyplot xlabel API.
#1 Best Overall
Set a reusable default for axis labels
To apply a default size to x- and y-axis labels across plots, set axes.labelsize:
import matplotlib.pyplot as plt
plt.rcParams["axes.labelsize"] = 14
You can also put axes.labelsize in a matplotlibrc file or a style configuration. Matplotlib reads configuration at startup; see the customization guide. The stable rcParams reference lists the default as medium. It lists axes.labelpad separately for label spacing, with a default of 4.0 points.
Rank #2
Choose the setting for the text you mean
Axis labels, tick labels, and the Axes title have separate settings. Changing axes.labelsize changes x/y axis labels, not the tick labels or title.
| Text element | Setting |
|---|---|
| X- and y-axis labels | axes.labelsize |
| X tick labels | xtick.labelsize |
| Y tick labels | ytick.labelsize |
| Axes title | axes.titlesize |
| General default text size | font.size |
The customization guide documents 10 pt as the standard font.size value and points to the more specific settings for specialized text. Numeric font sizes are point sizes; Matplotlib text settings also accept named relative sizes. For a figure-wide label, use the Figure-level supxlabel or supylabel API rather than assuming axes.labelsize controls it.
Check the version when exact defaults matter
The official stable documentation cited here identifies Matplotlib 3.11.2 for the rcParams, customization, and pyplot xlabel pages; the Axes API index identifies 3.11.1. Documentation defaults may change between releases, so check the installed Matplotlib version if exact defaults or behavior matter.
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.




