-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix: Log Colorbar minorticks_off reverted if ticks set #13351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Log Colorbar minorticks_off reverted if ticks set #13351
Conversation
Should I add a unit test? If so, would I adjust one I wrote a few days ago to test minorticks can be turned off for LogNorm to also add this condition (e.g. just add set_ticks after minorticks_off, prior to testing they are really off), or leave those tests alone and write a separate one (that would still do the above)? |
@LevN0 Yes, a unit test is in order. Either adding a new one, or adding checks to an existing one is fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks right to me, subject to a test in test_colorbar.py
(preferably one w/o a new image)
14fad1c
to
6ba23b8
Compare
Added a test. |
lib/matplotlib/colorbar.py
Outdated
@@ -579,6 +579,10 @@ def _reset_locator_formatter_scale(self): | |||
# mid point is easier. | |||
self.ax.set_xscale('log') | |||
self.ax.set_yscale('log') | |||
|
|||
if type(self.norm) == colors.LogNorm: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, actually we don't need the check here, do we?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a very good point.
16d3377
to
347f65b
Compare
Fixes issue where colorbar lognorm minorticks are turned back on anytime ticks are updated
e8a5d91
to
ffaaabd
Compare
This looks good! Thanks! |
PR Summary
Closes #13339.
Fixes issue where colorbar lognorm minorticks are turned back on anytime ticks are updated.
Before
Any time
ColorbarBase.update_ticks
is called, it forces minorticks on for LogNorm. Calling methods likeset_ticks
therefore reverts the action of minorticks_off.Produces,
(Note minorticks come back on, after being explicitly turned off.)
After
Minorticks stay off after being manually turned off.
PR Checklist