- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 turn off the ticks and marks of a matlibplot axes?
To turn off the ticks and marks of a matplotlib axes, we can take the following steps −
- Set the figure size and adjust the padding between and around the subplots.
- Create x and y data points using numpy.
- Plot x and y data points using plot() method.
- Get the current axis of the plot.
- Use set_tick_params() to hide X and Y axes label marks.
- Use set_xticks() and set_yticks() to hide X and Y axes tick marks.
- To display the figure, use show() method.
Example
import numpy as np from matplotlib import pyplot as plt # Set the figure size plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True # Create x and y data points x = np.linspace(-10, 10, 100) y = np.sin(x) plt.plot(x, y) ax = plt.gca() # Hide X and Y axes label marks ax.xaxis.set_tick_params(labelbottom=False) ax.yaxis.set_tick_params(labelleft=False) # Hide X and Y axes tick marks ax.set_xticks([]) ax.set_yticks([]) plt.show()
Output
It will produce the following output
- Related Articles
- How to turn off the upper/right axis tick marks in Matplotlib?
- Turn off the left/bottom axis tick marks in Matplotlib
- Create a graph using ggplot2 without axes ticks and axes labels.
- How to programmatically turn off and turn on WiFi in Kotlin?
- How to Turn Off the Water Supply to a Toilet
- Create a ggplot2 graph without axes labels, axes titles and ticks in R.
- How to display axes ticks and labels inside the plot using ggplot2 in R?
- How to turn Android device screen on and off programmatically?
- How to turn on and off the Incognito Mode on YouTube App
- How to turn on minor ticks only on the y-axis Matplotlib?
- How to Turn Off Form Autocompletion in HTML?
- How can I change the font size of ticks of axes object in Matplotlib?
- How to turn Android device screen on and off programmatically using Kotlin?
- Golang program to turn off the k’th bit in a number.
- How to turn off TestNG's default reporters programmatically?

Advertisements