Thanks to visit codestin.com
Credit goes to github.com

Skip to content

FIX: Generalize Colorbar Scale Handling #18887

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
wants to merge 8 commits into from

Conversation

jklymak
Copy link
Member

@jklymak jklymak commented Nov 3, 2020

PR Summary

The goal here is that every Norm has a _scale associated with it, and the _scale tells colorbar what scale to use on its long axis. This would all be trivial except for the fact that if we have colorbar extends, the usual axes extends past where we want ticks drawn. So all our Locators need to be wrapped to not draw past vmin and vmax (within some tolerance!). Before we were special casing LogLocator and AutoLocator, so this just generalizes..

Note that users can still set their own locators manually, but if they did that before they wouldn't get the trimming either.

PR Checklist

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (run flake8 on changed files to check).
  • New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • Conforms to Matplotlib style conventions (install flake8-docstrings and run flake8 --docstring-convention=all).
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).

@jklymak jklymak added this to the v3.4.0 milestone Nov 3, 2020
@jklymak jklymak force-pushed the colorbar-nonlinear-scale branch from 394d0d2 to 2ff255a Compare November 4, 2020 15:51
@@ -577,30 +533,19 @@ def _get_ticker_locator_formatter(self):
"""
locator = self.locator
formatter = self.formatter
if locator is None:
if self.boundaries is None:
if isinstance(self.norm, colors.NoNorm):
Copy link
Member Author

Choose a reason for hiding this comment

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

I seem to have managed to drop NoNorm which I guess means this section of code had no tests. Anyone know what this is supposed to do?

linthresh=self.norm.linthresh,
base=10)
else:
if mpl.rcParams['_internal.classic_mode']:
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm biting the bullet and just removing this. This changes 10 of the image tests below and a few of the fixed values in test_colorbar, but otherwise has no ill effect. Its hard to wrap this as a special case just for linear scales/norms, and I don't see any reason to do this.

@jklymak jklymak force-pushed the colorbar-nonlinear-scale branch from 2ff255a to 49fd84f Compare November 4, 2020 16:18
@jklymak jklymak force-pushed the colorbar-nonlinear-scale branch from 49fd84f to 6180df7 Compare November 4, 2020 16:34
@jklymak
Copy link
Member Author

jklymak commented Dec 8, 2020

Closing in favour of #18900

@jklymak jklymak closed this Dec 8, 2020
@jklymak jklymak deleted the colorbar-nonlinear-scale branch December 8, 2020 16:20
@QuLogic QuLogic modified the milestones: v3.4.0, v3.5.0 Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants