- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to remove the first and last ticks label of each Y-axis subplot in Matplotlib?
To remove the first and last ticks label of each Y-axis subplot, we can take the following steps −
Set the figure size and adjust the padding between and around the subplots.
Create a figure and a set of subplots.
Iterate the axes and set the first and last ticklabel's visible=False.
To display the figure, use show() method.
import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True fig, ax = plt.subplots(2, sharex=True) for a in ax: plt.setp(a.get_yticklabels(), visible=False) plt.setp(a.get_yticklabels()[-1], visible=False) plt.show()
- Overlapping Y-axis tick label and X-axis tick label in Matplotlib
- Rotating axis text for each subplot in Matplotlib
- How to turn on minor ticks only on the y-axis Matplotlib?
- Remove the X-axis ticks while keeping the grids (Matplotlib)
- How to print the Y-axis label horizontally in a Matplotlib/Pylab chart?
- How to remove the digits after the decimal point in axis ticks in Matplotlib?
- How to change the range of the X-axis and Y-axis in Matplotlib?
- How to customize X-axis ticks in Matplotlib?
- How to move the Y-axis ticks from the left side of the plot to the right side in matplotlib?
- Adding extra axis ticks using Matplotlib
- How to access axis label object in Matplotlib?
- How to reduce the space between Y-axis value and ticks using ggplot2 in R?
- How to change the color of the axis, ticks and labels for a plot in matplotlib?
- How to put gap between Y-axis and the first bar in a vertical barchart in Matplotlib?
- How to set axis ticks in multiples of pi in Python Matplotlib?