Description
Bug summary
Before 3.8.0, in matplotlib.ticker.MaxNLocator._raw_ticker(), there was a for-loop going over different possibilities that breaks out of the loop if a suitable condition was found, now it returns an empty list and fails.
Code for reproduction
# set up
import matplotlib as mpl
import numpy as np
mpl.rcParams['axes.autolimit_mode'] = 'round_numbers'
mnl = mpl.ticker.MaxNLocator()
mnl._nbins = 1
mnl._extended_steps = np.array([0.1,0.2,0.5,1.,2.,5.,10. ,20.])
# function that causes the bug to appear
mnl._raw_ticks(-9.4, 18.9)
Actual outcome
IndexError: index 0 is out of bounds for axis 0 with size 0
Expected outcome
not failing, it should just break at line 2135
Additional information
Before 3.8.0, in matplotlib.ticker.MaxNLocator._raw_ticker(), there was a for-loop going over different possibilities that breaks out of the loop if a suitable condition was found, now it returns an empty list. Then, it searches for values in this list. As this list is empty, it gives an error.
This worked before 3.8.0. I'm currently preparing a new release of my own package 'pybinding', and I noticed that this error appeared in the newer versions (available on test.pypi.org).
The error originates from calling the function ax.autoscale_view() or calling other functions from Matplotlib that in turn call ax.autoscale_view().
I just discovered this, and I can probably work around this issue, but I though to inform you to know if this is wanted behavior.
Operating system
No response
Matplotlib Version
3.8.0
Matplotlib Backend
No response
Python version
No response
Jupyter version
No response
Installation
None