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_on() Function:
The minorticks_on() function in pyplot module of matplotlib library is used to display minor ticks on the axes.
Syntax:
matplotlib.pyplot.minorticks_on()Parameters: This method does not accepts any parameters.
Return value: This method does not returns any value.
Below examples illustrate the matplotlib.pyplot.minorticks_on() function in matplotlib.pyplot:
Example #1:
# Implementation of matplotlib function import numpy as np import matplotlib.pyplot as plt import matplotlib.cbook as cbook import matplotlib.cm as cm from matplotlib.collections import LineCollection from matplotlib.ticker import MultipleLocator with cbook.get_sample_data( 's1045.ima.gz' ) as dfile: im = np.frombuffer(dfile.read(), np.uint16).reshape(( 256 , 256 )) im = np.ravel(im) im = im[np.nonzero(im)] im = im / ( 2 * * 20 - 1 ) plt.hist(im, bins = 40 , color = "green" ) plt.minorticks_on() plt.title( 'matplotlib.pyplot.minorticks_on() 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.fill_between(x, y1, y2, color = "green" , alpha = 0.6 ) plt.minorticks_on() plt.title( 'matplotlib.pyplot.minorticks_on() function Example' , fontweight = "bold" ) plt.show() |
Output: