简体   繁体   中英

Matplotlib ImageGrid colorbar not showing tick marks

This image shows the result of using ImageGrid to create an image with a colorbar:

The code is as follows.

grid = ImageGrid(fig, 211,
            nrows_ncols = (1, 1),
            axes_pad = 0.3,
            label_mode = "L",
            share_all = False,
            cbar_location="right",
            cbar_mode="single",
            cbar_size="7%",
            cbar_pad="7%",
            aspect = True
            )

and the colorbar is added by doing this:

cb = grid.cbar_axes.colorbar(im)
grid.cax.set_yticks([-14, -13, -12])
cb.set_label_text('$\log_{10}$(Intensity)')

However, the colorbar is missing the tick marks overlaid on the color scale.

So, my question is: how can I force the colorbar with the tick marks on top of the color scale?

EDIT 2: The blue arrows in this new image indicate the result I would like to achieve. However, even in this new image, the tick marks seem to be 'behind' the color scale. I tried and played with zorder but couldn't bring the tick marks forward.

searching i've found this

https://wcsaxes.readthedocs.org/en/latest/ticks_labels_grid.html#coordinate-objects

I think that what you want is it:

https://wcsaxes.readthedocs.org/en/latest/overlays.html

good luck dude :3, I'm sorry for not help but i dont understant about this content

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM