Closed
Description
Bug report
Bug summary
Minor ticks don't appear in the right place in colorbars when a custom Normalize class is used.
Code for reproduction
The following example requires astropy. If needed I can try and provide an example that doesn't use this.
import numpy as np
import matplotlib.pyplot as plt
from astropy.visualization import LogStretch, ImageNormalize, PercentileInterval
data = np.arange(256).reshape((16, 16))
norm = ImageNormalize(data, interval=PercentileInterval(99), stretch=LogStretch())
plt.rcParams['xtick.minor.visible'] = True
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
im = ax.imshow(data, norm=norm)
cb = fig.colorbar(im)
fig.savefig('test.png')
Actual outcome
Expected outcome
The minor ticks should respect the spacing of the current stretch.
I noticed that using LogNorm, the ticks used to be spaced incorrectly in Matplotlib 2.2 but this was fixed in Matplotlib 3.0. However, the minor ticks are still broken for custom normalizations as shown above.
Matplotlib version
- Operating system: MacOS X 10.13.6
- Matplotlib version: 3.0.1
- Matplotlib backend: Agg
- Python version: 3.7.1