-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Closed
Description
Bug report
Using MaxNLocator with the prune='both' option should remove the upper and lower ticks. This does not work with decimal ticks. Probably because of rounding or something related with binary numbers.
Temporarily I fixed it for me by shifting the limits slightly instead of using prune.
axes.set(ylim=[axes.get_ylim()[0]*0.99999,axes.get_ylim()[1]*1.00001])
import matplotlib.pyplot as plt
import matplotlib.ticker as mtick
fig,axes= plt.subplots(1,2)
axes[0].plot([0,4],[0.2,0.3])
axes[0].yaxis.set_major_locator(mtick.MaxNLocator(nbins=6, prune='both'))
print(axes[0].get_ylim())
axes[1].plot([0,4],[2,3])
axes[1].yaxis.set_major_locator(mtick.MaxNLocator(nbins=6, prune='both'))
print(axes[1].get_ylim())
plt.show()Expected outcome
(see right subplot)
Matplotlib version
Matplotlib 1.5.3
Python: 3.5.2 |Anaconda custom (64-bit)| (default, Jul 5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)]
I hope I did everything right and this is helpful.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
