Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Odd tick setting and labeling in axes_grid1.ImageGrid #7948

Closed
@jslavin

Description

@jslavin

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.

Bug report

Bug summary

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[0].colorbar(im)
plt.show()

Actual outcome

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.

Expected outcome

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

Matplotlib version 2.0.0, CentOS Linux 6 or Mac OSX 10.12.2

prob_demo2
installed Matplotlib via conda

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions