While investigating #7774, I noticed one other issue. When used with images, the locator tick_values method returns limits outside of the image bounds.
>>> data = np.arange(100).reshape(10, 10)
>>> fig, ax = plt.subplots()
>>> x0, x1 = ax.dataLim.intervalx
>>> print(x0, x1)
Those are the the correct image bounds because integer indices represent the center of pixels. However, this is puzzling:
>>> xlocator = ax.xaxis.get_major_locator()
>>> xlocator.tick_values(x0, x1)
array([ -2., 0., 2., 4., 6., 8., 10.])
>>> xlocator.view_limits(x0, x1)
array([ -2., 10.])
I assume this is because it is trying to include the "values" -0.5 and 9.5, but the tick values -2 and 10 don't make much sense since they are outside of the image bounds. I would have expected array([ 0., 2., 4., 6., 8.]), which is what is actually plotted.
array([ 0., 2., 4., 6., 8.])
tick_values overshoots because it is used in autoscaling. Depending on whether "round number" limits are requested, ticks beyond the data range may be needed. When they aren't, they are discarded.