Skip to content

Allow turning off minorticks for Colorbar with LogNorm? #13257

Closed

Description

@LevN0

Summary

MPL 3 introduces minorticks on Colorbar. These are enabled by default for LogNorm.

If the user sets custom tick marks for LogNorm, the minor ticks become confusing in my opinion.

Example

fig, ax = plt.subplots()

data = np.clip(randn(250, 250)*1000, 0, 1000)

cax = ax.imshow(data, norm=mpl.colors.LogNorm(vmin=1, vmax=1000))
cbar = fig.colorbar(cax, format='%d')
cbar.set_ticks([5, 50, 500])

Which produces,

mpl3_lognorm

Discussion

There is already the method Colorbar.minorticks_off, however it has a check that if the axis is log, then do nothing.

Request

The minor tickmarks add confusion here in my opinion. Can we have the option to turn them off via the existing Colorbar.minorticks_off?

Activity

  1. jklymak commented on Jan 21, 2019

    @jklymak
    Member

    I forget the history of that, and why we locked that out. I'm not sure it makes any sense for the lockout and would be fine w/ the checks being removed. Interested in doing a PR for that? I think this one is pretty trivial... (famous last words)

  2. LevN0 commented on Jan 21, 2019

    @LevN0
    ContributorAuthor

    I will have to try to figure out how to do a PR (the mechanics and such of it rather than code change), but sure, will give it a try.

  3. added this to the v3.1 milestone on Jan 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions