To change tick-label font size on an existing Matplotlib plot, use ax.tick_params(axis='both', labelsize=14). Set axis='x' or axis='y' to change just one axis, or configure xtick.labelsize and ytick.labelsize for defaults on plots created afterward.
Change tick-label size on an existing plot
Axes.tick_params is the direct way to adjust tick appearance without replacing the tick labels. This example changes both axes to 14 points:
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.plot([1, 2, 3], [2, 4, 3])
ax.tick_params(axis='both', labelsize=14)
plt.show()
The labelsize argument accepts a numeric point size or a supported relative size such as 'large'. See the Matplotlib Axes API reference for the method details.
Set different sizes for the x- and y-axis labels
Call tick_params separately for each axis when the labels need different sizes:
#1 Best Overall
ax.tick_params(axis='x', labelsize=12)
ax.tick_params(axis='y', labelsize=16)
Use axis='x' or axis='y' to target one axis; axis='both' applies the setting to both.
Set default sizes for later plots
To set defaults for plots created after the assignments, configure the x- and y-axis tick labels separately:
Rank #2
import matplotlib as mpl
mpl.rcParams['xtick.labelsize'] = 12
mpl.rcParams['ytick.labelsize'] = 12
Matplotlib documents xtick.labelsize and ytick.labelsize as the corresponding tick-label font-size settings; the documented default for each is 'medium'. The general font.size setting controls default text size, but these axis-specific settings are the direct controls for tick labels. For reusable project-wide styling, put the rcParams settings in a Matplotlib style configuration. The Matplotlib configuration reference explains rcParams and style sheets.
Why not use set_xticklabels or set_yticklabels?
Avoid calling ax.set_xticklabels(...) or ax.set_yticklabels(...) just to change font size. Those methods are discouraged for setting labels in the Axes API, and they change the label-setting behavior rather than simply adjusting appearance. Use tick_params for an existing Axes. In pyplot-based code, plt.xticks(fontsize=...) is another interface for the current axes; when you already have an Axes object, ax.tick_params(...) makes the target explicit. The pyplot API summary documents pyplot’s interface.
Quick Recap
Best Value
Rank #4
Choose the setting that matches your goal
| Goal | Use |
|---|---|
| Change both axes on one existing plot | ax.tick_params(axis='both', labelsize=14) |
| Change only one axis, or give x and y different sizes | Use axis='x' or axis='y'; make separate calls for separate sizes |
| Set defaults for plots created afterward | Set mpl.rcParams['xtick.labelsize'] and mpl.rcParams['ytick.labelsize'], or use a style configuration |
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.




