Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk2 min

Matplotlib Tick Cleanup: Hide Labels, Remove Tick Marks, or Turn Off the Axis

Use tick_params to hide labels, NullLocator to remove tick positions, or set_axis_off() to hide every axis decoration in Matplotlib.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose 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:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
ax.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.

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:

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

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.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.