Open In App

matplotlib.pyplot.minorticks_off() in Python

Last Updated : 22 Apr, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface.

matplotlib.pyplot.minorticks_off() Function:

The minorticks_off() function in pyplot module of matplotlib library is used to remove minor ticks from the axes..

Syntax: matplotlib.pyplot.minorticks_off()
Parameters: This method does not accepts any parameters.
Return value: This method does not returns any value.

Note: This function will show any change or effect if it is used after use of minorticks_on() function.

Below examples illustrate the matplotlib.pyplot.minorticks_off() function in matplotlib.pyplot:

Example #1:




# Implementation of matplotlib function
import numpy as np
import matplotlib.pyplot as plt
   
plt.minorticks_on()
   
np.random.seed(19680801)
mu, sigma = 100, 15
x = mu + sigma * np.random.randn(10000)
   
plt.hist(x, 150, density = True, facecolor ='g', alpha = 0.65)
   
plt.xlim(40, 160)
plt.ylim(0, 0.03)
plt.grid(True)
   
plt.minorticks_off()
plt.title('matplotlib.pyplot.minorticks_off() function Example'
                                             fontweight ="bold")
plt.show()


Output:

Example #2:




# Implementation of matplotlib function
import matplotlib.pyplot as plt
import numpy as np
   
x = np.arange(0.0, 2, 0.01)
y1 = np.sin(2 * np.pi * x)
y2 = 1.2 * np.sin(4 * np.pi * x)
   
plt.minorticks_on() 
plt.fill_between(x, y1, y2, color ="green", alpha = 0.6)
plt.minorticks_off()
plt.title('matplotlib.pyplot.minorticks_off() function Example',
                                             fontweight ="bold")
plt.show()


Output:



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads