To remove tick labels in Matplotlib but keep the tick marks, use ax.tick_params(labelbottom=False, labelleft=False). To remove the ticks and their labels together, use ax.set_xticks([]) and ax.set_yticks([]) (or plt.xticks([]) with pyplot), and to hide everything including the frame, use ax.axis("off"). This guide compares all of these on real plots, then shows how to remove tick labels from subplots, from a single axis, and how to remove only minor ticks.
Tested with Python 3.12.5 and Matplotlib 3.11.2; the plots are real Matplotlib windows. Full parameter list: Axes.tick_params and Axes.set_xticks.
Quick comparison
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 10, 100)
fig, axes = plt.subplots(2, 2, figsize=(8, 5.5))
for ax in axes.flat:
ax.plot(x, np.sin(x))
axes[0, 0].set_title("Default")
axes[0, 1].set_xticks([]) # no x ticks and no x tick labels
axes[0, 1].set_yticks([])
axes[0, 1].set_title("set_xticks([]) + set_yticks([])")
axes[1, 0].tick_params(labelbottom=False, labelleft=False) # keep the tick marks
axes[1, 0].set_title("Labels removed, ticks kept")
axes[1, 1].tick_params(length=0) # keep the labels, hide the tick marks
axes[1, 1].set_title("Tick marks removed, labels kept")
plt.tight_layout()
plt.show()
![matplotlib remove ticks and tick labels comparison Four Matplotlib subplots comparing default ticks, ticks removed with set_xticks([]), tick labels removed with tick_params and tick marks removed with length=0](https://pythonguides.com/wp-content/uploads/2026/09/matplotlib-remove-ticks-and-tick-labels-comparison.png)
| Goal | Code |
|---|---|
| Remove x tick marks and labels | ax.set_xticks([]) or plt.xticks([]) |
| Remove y tick marks and labels | ax.set_yticks([]) or plt.yticks([]) |
| Remove tick labels, keep tick marks | ax.tick_params(labelbottom=False, labelleft=False) |
| Remove tick marks, keep labels | ax.tick_params(length=0) |
| Remove ticks, labels and frame | ax.axis("off") |
| Remove a whole axis (ticks + label) | ax.yaxis.set_visible(False) |
| Remove only minor ticks | ax.minorticks_off() |
Remove ticks with plt.xticks([]) and plt.yticks([])
With the pyplot interface, pass an empty list to plt.xticks() or plt.yticks():
import matplotlib.pyplot as plt
plt.bar(["North", "South", "East", "West"], [42, 35, 51, 28], color="tab:purple")
plt.yticks([]) # pyplot: remove the y ticks and labels
plt.title("Orders by region (y-axis ticks removed)")
plt.show()
![matplotlib plt yticks empty remove y ticks Matplotlib bar chart of orders by region with the y-axis ticks and tick labels removed using plt.yticks([])](https://pythonguides.com/wp-content/uploads/2026/09/matplotlib-plt-yticks-empty-remove-y-ticks.png)
plt.yticks([]) removes the y ticks and their labels.Remove tick labels but keep the ticks
tick_params() switches labels on each side on or off: labelbottom, labeltop, labelleft, labelright. The ticks stay, so gridlines and zooming still work. Emptying the labels with set_xticklabels([]) also works, but giving new labels that way without setting the tick positions first triggers a warning:
import warnings
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
warnings.simplefilter("always")
fig, ax = plt.subplots()
ax.plot([1, 2, 3], [4, 6, 5])
fig.canvas.draw()
ax.tick_params(labelbottom=False)
first = ax.xaxis.get_major_ticks()[0]
print("tick_params -> label visible:", first.label1.get_visible(), "| tick mark visible:", first.tick1line.get_visible())
ax.tick_params(labelbottom=True)
ax.set_xticklabels([]) # empty labels: works without a warning
print("set_xticklabels([]) -> label texts:", [t.get_text() for t in ax.get_xticklabels()][:3])
ax.set_xticklabels(["a", "b", "c"]) # new labels without set_xticks(): warning
Output:
tick_params -> label visible: False | tick mark visible: True
set_xticklabels([]) -> label texts: ['', '', '']
C:\pyguides\remove_tick_labels_check.py:20: UserWarning: set_ticklabels() should only be used with a fixed number of ticks, i.e. after set_ticks() or using a FixedLocator. Otherwise, ticks may be mislabeled.
ax.set_xticklabels(["a", "b", "c"]) # new labels without set_xticks(): warning
![matplotlib tick params set xticklabels warning command prompt Command Prompt output showing tick_params hiding labels, set_xticklabels([]) emptying labels and the set_ticklabels FixedLocator UserWarning](https://pythonguides.com/wp-content/uploads/2026/09/matplotlib-tick-params-set-xticklabels-warning-command-prompt.png)
set_xticks().In Matplotlib 3.x, use labelbottom=False (a boolean). The old labelbottom="off" string form from Matplotlib 1.x no longer works.
Remove ticks, labels and the frame with axis(‘off’)
For images and diagrams you usually want nothing around the data. ax.axis("off") (or ax.set_axis_off()) hides the ticks, tick labels, axis labels and the spines:
import matplotlib.pyplot as plt
import numpy as np
img = np.random.default_rng(1).random((12, 12))
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(8, 4))
ax1.imshow(img, cmap="viridis")
ax1.set_title("Default: ticks on the image")
ax2.imshow(img, cmap="viridis")
ax2.axis("off") # remove ticks, labels AND the frame
ax2.set_title("ax.axis('off')")
plt.tight_layout()
plt.show()

ax.axis("off") on the right.If you want to keep the frame but drop the ticks, use set_xticks([]) and set_yticks([]) instead.
Remove tick labels from subplots
Only keep labels on the outer subplots
In a grid of subplots, repeated tick labels waste space. ax.label_outer() keeps x labels only on the bottom row and y labels only on the left column. plt.subplots(..., sharex=True, sharey=True) does the same automatically.
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 10, 100)
fig, axes = plt.subplots(2, 3, figsize=(9, 5))
for i, ax in enumerate(axes.flat, start=1):
ax.plot(x, np.sin(x * i / 3))
ax.set_title(f"Plot {i}")
ax.label_outer() # keep tick labels only on the outer edges
plt.tight_layout()
plt.show()

label_outer() removes the inner tick labels.Remove the y-axis from one subplot
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 10, 100)
fig, (ax1, ax2, ax3) = plt.subplots(1, 3, figsize=(9, 3.4))
ax1.plot(x, np.sin(x))
ax2.plot(x, np.cos(x))
ax3.plot(x, np.sin(x) * np.cos(x))
ax2.tick_params(labelleft=False) # hide y labels on the middle subplot only
ax3.yaxis.set_visible(False) # remove the whole y-axis on the right subplot
ax1.set_title("unchanged")
ax2.set_title("labelleft=False")
ax3.set_title("yaxis.set_visible(False)")
plt.tight_layout()
plt.show()

Remove minor ticks
Log-scale axes add many small minor ticks. ax.minorticks_off() removes them and keeps the major ticks:
import matplotlib.pyplot as plt
import numpy as np
x = np.logspace(0, 3, 50)
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(9, 3.6))
for ax in (ax1, ax2):
ax.loglog(x, x ** 1.5)
ax1.set_title("Log axes: major + minor ticks")
ax2.minorticks_off() # remove only the small minor ticks
ax2.set_title("minorticks_off()")
plt.tight_layout()
plt.show()

Remove axis labels
Axis labels are separate from tick labels. Remove them with an empty string, or hide them:
ax.set_xlabel("") # remove the x-axis label
ax.yaxis.label.set_visible(False) # hide the y-axis label
To style or move them instead, see the Matplotlib x-axis label guide.
Related Matplotlib tick tutorials:
- Customize ticks with tick_params()
- Rotate tick labels in Matplotlib
- Set the x-axis label in Matplotlib
- Fix overlapping labels with tight_layout()