When I started working with Python’s Matplotlib library, customizing plots was always a key part of making my data visualizations clear and professional. One common task I often encounter is the need to hide or make invisible the y-axis tick labels without removing the ticks themselves. This helps in creating cleaner plots where the numerical labels on the y-axis are distracting or unnecessary, especially in presentations or dashboards.
In this tutorial, I will walk you through several easy methods to make y-axis tick labels invisible in Matplotlib using Python. Each method comes with full code examples so you can quickly apply them to your projects.
Make Y-Axis Tick Labels Invisible
Sometimes, the y-axis ticks (the small lines marking values) are helpful to show scale, but the numeric labels next to them clutter the plot. For example, when plotting simple trends or when you want to emphasize other plot elements, hiding tick labels can improve readability.
In US-centric data projects, such as visualizing sales trends by state or comparing metrics across counties, having a clean plot without redundant y-axis labels can make your charts more impactful.
Method 1: Use set_yticklabels with Empty Strings
The most direct way I use to hide y-axis tick labels is by setting them to empty strings. This keeps the ticks visible but makes the labels invisible.
Here’s how you do it:
import matplotlib.pyplot as plt
import numpy as np
# Sample data: Monthly sales figures in thousands for a US company
months = np.arange(1, 13)
sales = [50, 55, 53, 60, 65, 70, 75, 80, 78, 85, 90, 95]
fig, ax = plt.subplots()
ax.plot(months, sales, marker='o')
# Make y-axis tick labels invisible by setting them to empty strings
ax.set_yticklabels([''] * len(ax.get_yticks()))
ax.set_xlabel('Month')
ax.set_ylabel('Sales (in thousands)')
ax.set_title('Monthly Sales Trend')
plt.show()You can refer to the screenshot below to see the output.

In this example, I set all y-axis tick labels to empty strings using set_yticklabels(). The ticks remain, but the numbers disappear. This method is quick and effective for most simple plots.
Note: When using set_yticklabels, make sure the number of labels matches the number of ticks, or you might get warnings.
Method 2: Use tick_params to Hide Tick Labels
Another method I prefer for its simplicity and control is using tick_params() to disable the labels while keeping the ticks.
import matplotlib.pyplot as plt
import numpy as np
months = np.arange(1, 13)
sales = [50, 55, 53, 60, 65, 70, 75, 80, 78, 85, 90, 95]
fig, ax = plt.subplots()
ax.plot(months, sales, marker='o')
# Hide y-axis tick labels but keep ticks visible
ax.tick_params(axis='y', labelleft=False)
ax.set_xlabel('Month')
ax.set_ylabel('Sales (in thousands)')
ax.set_title('Monthly Sales Trend')
plt.show()You can refer to the screenshot below to see the output.

Here, labelleft=False hides the labels on the left side (the y-axis), but the ticks remain. This is my go-to method when I want to quickly toggle label visibility without changing the labels themselves.
Method 3: Set Tick Label Color to Transparent
If you want to keep the tick labels present in the code but invisible visually, setting their color to fully transparent works well.
import matplotlib.pyplot as plt
import numpy as np
months = np.arange(1, 13)
sales = [50, 55, 53, 60, 65, 70, 75, 80, 78, 85, 90, 95]
fig, ax = plt.subplots()
ax.plot(months, sales, marker='o')
# Set y-axis tick labels color to transparent
for label in ax.get_yticklabels():
label.set_color('none')
ax.set_xlabel('Month')
ax.set_ylabel('Sales (in thousands)')
ax.set_title('Monthly Sales Trend')
plt.show()You can refer to the screenshot below to see the output.

This method is useful if you want to keep the labels in the plot for accessibility or programmatic reasons but hide them from view.
Method 4: Use NullFormatter from matplotlib.ticker
For more advanced control, especially when working with multiple subplots, I use NullFormatter from matplotlib.ticker to completely suppress y-axis labels.
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.ticker import NullFormatter
months = np.arange(1, 13)
sales = [50, 55, 53, 60, 65, 70, 75, 80, 78, 85, 90, 95]
fig, ax = plt.subplots()
ax.plot(months, sales, marker='o')
# Apply NullFormatter to y-axis to hide tick labels
ax.yaxis.set_major_formatter(NullFormatter())
ax.set_xlabel('Month')
ax.set_ylabel('Sales (in thousands)')
ax.set_title('Monthly Sales Trend')
plt.show()This method disables all major tick labels on the y-axis without affecting the ticks themselves. I find it especially clean and reliable when dealing with complex plot layouts.
When to Use Each Method?
- Use Method 1 (set_yticklabels) if you want a quick fix and don’t mind manually matching label counts.
- Use Method 2 (tick_params) for a simple toggle of label visibility.
- Use Method 3 (setting label color to transparent) if you want to keep labels in the code but hide them visually.
- Use Method 4 (NullFormatter) for a robust, programmatic way to hide labels, especially in multi-axes figures.
Additional Tips for Python Matplotlib Users
- Remember that hiding tick labels does not remove the ticks themselves. If you want to remove ticks, you can use ax.yaxis.set_ticks([]) or tick_params with length=0.
- Always label your axes appropriately elsewhere (e.g., axis titles) to keep your plots understandable.
- When preparing visuals for US-based audiences, consider labeling axes with units common in the US (e.g., dollars, thousands, percentages) for better clarity.
I hope you found these methods for making y-axis tick labels invisible in Matplotlib useful. Each approach has its own advantages depending on your specific needs and plot complexity. Over the years, I’ve used these techniques extensively to create clean, professional Python plots that communicate data effectively without unnecessary distractions.
Other Python Matplotlib tutorials you may also like:
- Matplotlib tight_layout wspace and hspace in Python
- Matplotlib Tight_Layout for Python Subplots
- How to Use tight_layout and bbox_inches in Matplotlib
- Matplotlib Scatter Plots with Tight_Layout in Python

I am Bijay Kumar, a Microsoft MVP in SharePoint. Apart from SharePoint, I started working on Python, Machine learning, and artificial intelligence for the last 5 years. During this time I got expertise in various Python libraries also like Tkinter, Pandas, NumPy, Turtle, Django, Matplotlib, Tensorflow, Scipy, Scikit-Learn, etc… for various clients in the United States, Canada, the United Kingdom, Australia, New Zealand, etc. Check out my profile.