Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Closed
Labels
Milestone
Description
Bug summary
Logarithmic tick markers do not appear if the y-axis scales a sufficient range, with thesubs
keyword argument ofticker.LogLocator
set to non-trivial values.
Code for reproduction
importmatplotlib.pyplotaspltimportmatplotlib.tickerimportnumpyasnpll=matplotlib.ticker.LogLocator(subs=(1,2,5))### The following code produces a plot with y-axis ticks at the expected locations.fig,ax=plt.subplots()x=np.arange(8)plt.semilogy(x,10**x)ax.yaxis.set_major_locator(ll)ax.yaxis.set_minor_locator(ll)plt.title("Good Plot")plt.show()### The following code produces a plot with no y-axis ticks, which is unexpected and undesired.fig,ax=plt.subplots()x=np.arange(9)# The only change is this lineplt.semilogy(x,10**x)ax.yaxis.set_major_locator(ll)ax.yaxis.set_minor_locator(ll)plt.title("Bad Plot")plt.show()### The problem is isolated to here, which returns correct values in the first case, but np.array([]) in the second case:print(ll.tick_values(1,1e7))print(ll.tick_values(1,1e8))
Actual outcome
Expected outcome
I expect to see ticks in both cases, as appears in the "Good Plot".
Additional information
The problem is isolated toticker.LogLocator.tick_values()
. This returns correct values in the first case (e.g.,np.array([1.e-01 2.e-01 5.e-01 1.e+00 2.e+00 5.e+00 1.e+01 2.e+01 5.e+01 1.e+02 2.e+02 5.e+02])
), butnp.array([])
in the second case.
Operating system
Windows
Matplotlib Version
3.5.2
Matplotlib Backend
module://backend_interagg
Python version
3.9.13
Jupyter version
No response
Installation
conda