Odd tick setting and labeling in axes_grid1.ImageGrid #7948
To help us understand and resolve your issue, please fill out the form to the best of your ability. You can feel free to delete the sections that do not apply.
The colorbar in an axes_grid1.ImageGrid gets a labeled xtick (for a vertically oriented colorbar). The ylabels are also oddly labeled. Also for a 2 x 2 grid, the xaxis ticks and yaxis ticks are not the same despite the extent being set to the same values.
Code for reproduction
import matplotlib.pyplot as plt import numpy as np from matplotlib.colors import LogNorm,Normalize from mpl_toolkits.axes_grid1 import ImageGrid fig = plt.figure() grid = ImageGrid(fig, 111, nrows_ncols = (2,2), share_all = True, label_mode = 'L', cbar_mode = 'single') for g in grid: image = (10.**(3.*np.random.rand(100))).reshape((10,10)) im = g.imshow(image, origin='lower', norm=LogNorm(), interpolation='none', extent=(0., 29.9, 0., 29.9), cmap='viridis', vmin=1.,vmax=1.E3) grid.cbar_axes.colorbar(im) plt.show()
See the image. colorbar labeling is messed up. In other cases the xtick labeling is different (different number of ticks) than the ytick labeling despite having the same extent.
The labeling of the colorbar should something like (10^-1 10^0, ...etc.). This used to work with matplotlib 1.5.X (last one)
Matplotlib version 2.0.0, CentOS Linux 6 or Mac OSX 10.12.2
Part of the problem is that axes_grid1 has its own colorbar, which seems to be a modified version of an old version of the normal colorbar. I am not aware of any documentation as to why and how it differs. As a result, improvements in the normal colorbar (of which some were made in 2.0, and more are needed) do not appear in the axes_grid1 colorbar. I think we need to figure out how to completely replace the present axes_grid1 colorbar with the normal one, via subclassing and minimal modification if necessary.
I was just going to report almost the same issue. So just want to bring this up again... My matplotlib is 2.1.2.
In particular, the colorbar should clearly have a tick at the value 1, and the strange 2×10⁰ tick on the X axis is annoying.