8000 BUG: keep the ticks when the colorbar axis is inverted by efiring · Pull Request #13530 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

BUG: keep the ticks when the colorbar axis is inverted #13530

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

Closed

Conversation

efiring
Copy link
Member
@efiring efiring commented Feb 27, 2019

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@efiring efiring requested a review from jklymak February 27, 2019 04:08
@@ -238,6 +238,8 @@ def __init__(self, colorbar):
super().__init__(nbins=nbins, steps=steps)

def tick_values(self, vmin, vmax):
if vmin > vmax:
vmin, vmax = vmax, vmin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems good. MaxNLocator uses mtransforms.nonsingular to do the same thing. Not sure its needed here...

@efiring
Copy link
Member Author
efiring commented Feb 27, 2019

I haven't checked whether the other _Colorbar*Locators need similar treatment. And, it's not obvious why the _ColorbarMinorLocator modifies __call__ but _ColorbarAutoLocator modifies tick_values.

@jklymak
Copy link
Member
jklymak commented Feb 27, 2019

All I did was copy what was in the parent locators I think.

cbar = fig.colorbar(pc, ax=ax)
ticks = cbar.get_ticks()
cbar.ax.invert_yaxis()
assert cbar.get_ticks() == ticks
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to use assert_array_equal or something like that

8000
@jklymak
Copy link
Member
jklymak commented Feb 27, 2019

I haven't checked whether the other _Colorbar*Locators need similar treatment. And, it's not obvious why the _ColorbarMinorLocator modifies __call__ but _ColorbarAutoLocator modifies tick_values.

a) I think they all need this treatment - sorry for not catching that
b) all I did was copy the relevant method for each of the locators - not sure why its different between the minor and major. However, open to cleaning this up, either here or in a further PR.

@jklymak jklymak added this to the v3.1.0 milestone Feb 28, 2019
@jklymak jklymak added the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Feb 28, 2019
@jklymak
Copy link
Member
jklymak commented Feb 28, 2019

Marking RC - this is a bug that should be fixed ASAP. @efiring, if you want me to do it, because I made the mess, I'm happy to fix it for all the different norms...

@efiring
Copy link
Member Author
efiring commented Feb 28, 2019

@jklymak I agree, this is high priority for getting fixed and released ASAP, and I would be happy to have you take it over.

@jklymak jklymak mentioned this pull request Mar 2, 2019
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0