-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
FIX: fix error in colorbar.get_ticks not having valid data #12656
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: fix error in colorbar.get_ticks not having valid data #12656
Conversation
lib/matplotlib/colorbar.py
Outdated
@@ -573,6 +574,13 @@ def set_ticks(self, ticks, update_ticks=True): | |||
|
|||
def get_ticks(self, minor=False): | |||
"""Return the x ticks as a list of locations""" | |||
if self._tick_data_values is None: |
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.
Not quite following the logic here. We populate self._tick_data_values
via update_ticks() -> self._ticker
but not if _use_auto_colorbar_locator
. It seems that if we use self._tick_data_values
to store the ticks of a fixed locator. However, this mechanism is quite hidden and seems intransparent.
Would it make sense, to either rename _tick_data_values
to something like _fixed_tick_data_values
or alternatively get rid of that local variable and obtain the value dynamically?
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.
@timhoffm fixed.
We cannot (trivially) get the value automatically because in the old days, all colorbars went from 0-1, and then were labeled from vmin to vmax by hand. Some types of colorbars are still made that way, so long_axis.get_majorticklocs()
returns a list of floats between 0 and 1.
I think a todo is to go back and make those old-style colorbars the same as the new style, so they are all done in data space, and then we can make this homogeneous. But for a point release, this gets things working again...
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.
Anyway, added a comment, and changed the name of the private (I hope?) variable...
a82abc5
to
15e4e79
Compare
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.
Anybody can merge after CI pass.
…t having valid data
…656-on-v3.0.x Backport PR #12656 on branch v3.0.x (FIX: fix error in colorbar.get_ticks not having valid data)
PR Summary
After the colorer tick overhaul the function
get_ticks
was broken. This now works:PR Checklist