FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Log Colorbar minorticks_off reverted if ticks set... · Issue #13339 · matplotlib/matplotlib · GitHub

Repository navigation

Log Colorbar minorticks_off reverted if ticks set... #13339

Closed

Description

Posted by @LevN0

Apologies if not the right place. This PR has the following side effect:

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.minorticks_off()
cbar.set_ticks([5, 10, 100])

plt.show()

Prior to this PR, minor ticks would remain off after set_ticks when they had been turned off. After this PR, they come back on.

Originally posted by @LevN0 in #12909 (comment)

Activity

  1. LevN0 commented on Feb 1, 2019

    Contributor

    Actually do not think connected to that PR, not sure why I thought it was.

    The cause is straight forward when looking at the code (set_ticks calls update_ticks, which sets minor ticks on for LogNorm). Post #13234, if it were accepted in current form, the turning on of minor ticks for LogNorm could be moved to new _reset_locator_formatter_scale, though not sure if that introduces any new issues.

  2. changed the title [-]Apologies if not the right place. This PR has the following side effect:[/-] [+]Log Colorbar minorticks_off reverted if ticks set...[/+] on Feb 1, 2019
  3. jklymak commented on Feb 1, 2019

    MemberAuthor

    Can you give it a try and run the tests, and submit a PR if that is a reasonable solution? Seems you found something that works, so feel free to give it a try...

    OTOH, did you test if the same thing happens for log-axes on a normal axes instead of a colorbar? The point of the colorbar changes recently were to make the colorbar behave more like a normal axis, so, anything we can do to further that end is welcome.

  4. added this to the v3.1 milestone on Feb 1, 2019
  5. LevN0 commented on Feb 1, 2019

    Contributor

    If the following is sufficient to test normal axes, then the same issue does not appear for them:

    t = np.arange(0.01, 20.0, 0.01)
    
    ax = plt.subplot(111)
    plt.loglog(t, 20*np.exp(-t/10.0), basex=2)
    
    ax.minorticks_off()
    ax.set_yticks([3, 4, 6, 10, 20])
    
    plt.show()

    I am actually not sure how to submit a PR when the per-requisite PR has not been merged.

  6. jklymak commented on Feb 1, 2019

    MemberAuthor

    I think the problem is in master w/o #13234 right? Or would your proposed change stomp on #13234?

  7. LevN0 commented on Feb 1, 2019

    Contributor

    Problem is in master w/o #13234. However the proposed fix needs behavior/function introduced by #13234.

  8. jklymak commented on Feb 1, 2019

    MemberAuthor

    Right - may as well wait for #13234 to go in, though you can make a PR against that branch and then rebas when its merged, its a bit fragile to do that.

  9. jklymak commented on Feb 2, 2019

    MemberAuthor

    @LevN0 #13234 is merged, so if you want to talk a crack at fixing this, that'd be great. If you can't get to it, ping me and I can probably do it. Thanks!

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


      Back | FazBrowse Home | New Git URL