-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Closed as not planned
Closed as not planned
Copy link
Description
Bug summary
get_ticklocs() is returning ticks outside the axis limits, when the scale is set to log.
I discovered this when writing some tests for LogLocator in #24436.
Code for reproduction
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.set_xscale('log')
ax.set_xlim(1, 99)
fig.canvas.draw()
print(ax.xaxis.get_ticklocs())
# [1.e-01 1.e+00 1.e+01 1.e+02 1.e+03]
plt.show()Actual outcome
Prints [1.e-01 1.e+00 1.e+01 1.e+02 1.e+03], but plots this:
Note that the only ticks shown on this graph are 1 and 10.
Expected outcome
ax.xaxis.get_ticklocs() returns only tick locations present on the axis.
Additional information
No response
Operating system
No response
Matplotlib Version
3.7.0.dev656+g79807c34ad.d20221130
Matplotlib Backend
No response
Python version
No response
Jupyter version
No response
Installation
No response
