I just have a small problem with pyplot.
I am plotting my data in a way like:
import matplotlib.pyplot as plt
plt.subplot(i,3,j)
plt.plot(xy.data)
plt.show()
With several subplots. Now my problem is: When I have many subplots, the plots become very small and espacially flat. So the numbers that are on my y-axis become impossible to read, cause they overlap each other.
Is it somehow easily possible to change the count of the numbers to something like 3? So I just have the maximum, zero and the minimum? But not the minimum of my function, I would rather keep the minimum (and max) that is currently there. So I just would like to let every step inbetween the current min, 0 and max away.
Thank You all, have a nice day.
from matplotlib.ticker import MaxNLocator
plt.gca().yaxis.set_major_locator(MaxNLocator(3))
MaxNLocator
sets the amount of ticks, and with the plt.gca().yaxis
you make this happen on the y-axis.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.