python - Number of bins in matplotlib axes (number of majorticks) -
i have 6 axes in 1 figure. limits on each axes different. on each axes gave command:
ax.locator_params(axis='x', nbins=9) ax.locator_params(axis='y', nbins=7)
but when plot get:
i want 9 majorticks 9 labels on x axis of each axes, , 7 on y axis of each axes. how can achieve this? lot.
from matplotlib.ticker import maxnlocator import matplotlib.pyplot plt fig, (ax1, ax2, ax3, ax4, ax5, ax6) = plt.subplots(nrows=2, ncols=3) # add plot code here ax1.xaxis.set_major_locator(maxnlocator(nbins=9)) ax1.yaxis.set_major_locator(maxnlocator(nbins=7)) #repeat other axes
Comments
Post a Comment