Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsChoose the Matplotlib setting that matches what you want to disappear: use tick_params to hide labels while keeping tick marks, a NullLocator to remove tick positions and their labels, or set_axis_off() to hide all axis decorations. Major and minor ticks are controlled separately.
Hide tick labels but keep the tick marks
Use tick_params when the marks should stay visible and only their labels should disappear. For x-axis labels at the bottom:
As an Amazon Associate I earn from qualifying purchases.
ax.tick_params(axis="x", labelbottom=False)
For y-axis labels on the left, use labelleft=False:
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchax.tick_params(axis="y", labelleft=False)
These options target a particular side. If your plot displays labels at the top or right, hide those sides as well with labeltop=False or labelright=False. The Matplotlib tick guide documents label visibility separately from tick-mark properties.
#1 Best Overall
Remove all tick marks and labels from an axis
A NullLocator places no ticks, so it removes both tick marks and the labels associated with them. Set the major locator on the axis you want to clear:
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
fig, ax = plt.subplots()
ax.plot([1, 2, 3], [2, 1, 4])
ax.xaxis.set_major_locator(ticker.NullLocator())
Major and minor ticks use separate locators. If minor ticks are enabled, disable them too:
Rank #2
ax.xaxis.set_minor_locator(ticker.NullLocator())
Use ax.yaxis in place of ax.xaxis to apply the same rule to the vertical axis. The ticker API reference describes NullLocator as placing no ticks. Alternatively, ax.minorticks_off() removes minor ticks only; it does not remove major ticks.
Use an empty tick list for a fixed, tick-free axis
For an axis that should have a fixed empty set of tick positions, pass an empty list:
ax.set_xticks([]) # x-axis
ax.set_yticks([]) # y-axis
The documented tick-setting API accepts an empty list. Setting ticks replaces the axis locator with a FixedLocator, so this expresses a fixed tick choice rather than a general rule to produce no ticks as the view changes.
Hide every axis decoration
Use ax.set_axis_off() only when you want the whole axis presentation removed—not just its ticks:
ax.set_axis_off()
This suppresses axis labels, spines, tick marks, tick labels, and grid lines. The Axes.set_axis_off reference notes that individual visibility settings are ignored while this mode is active.
Free tools Windows power users keep installed
One-click scans. No signup required.
Choose the narrowest change
| What should disappear | Use | What remains |
|---|---|---|
| Labels on a selected side | ax.tick_params(axis="x", labelbottom=False) or the matching y-side option |
Tick marks remain; other sides are not automatically targeted. |
| Major and minor ticks on one axis | Set both that axis’s major and minor locators to ticker.NullLocator() |
Other axis decorations, such as spines and axis labels, remain. |
| A fixed empty set of tick positions | ax.set_xticks([]) or ax.set_yticks([]) |
Other axis decorations remain; the locator becomes a FixedLocator. |
| All axis decorations | ax.set_axis_off() |
None of the axis decorations are drawn, including grid lines. |
Version scope
The cited stable tick guide and ticker API documentation are labeled Matplotlib 3.11.2; the set_yticks reference is labeled 3.11.0. These references do not establish compatibility with older releases, so check the documentation for the Matplotlib version installed in your environment if version-specific behavior matters.
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.




