I have some data I want to plot on a log scale, with a specific set of major y-axis ticks
I know I can use something like
plt.scatter(x, y)
ax = plt.gca()
ax.yaxis.set_major_locator(ticker.MultipleLocator(100))
To specify ticks, but I don't know how to pass an instance of matplotlib.ticker.Locator
with arbitrary values eg if I want to set the ticks to [2,4,100] instead of fixed increments. How do I turn an array of tick values to an object that set_major_locator
will accept?
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.