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

Skip to content

FIX colorbars for Norms that do not have a scale. #16392

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

Merged
merged 1 commit into from
Feb 10, 2020

Conversation

jklymak
Copy link
Member

@jklymak jklymak commented Feb 3, 2020

PR Summary

If a norm that did not have a corresponding scale is used, then the colorbar was not working. This PR (thanks @dstansby) now keeps track of the scale associated with the colorbar and if it is "manual" then falls back to the manual method of creating the colorbar.

Replaces #16286

Closes #16280

Note there are still issues with SymLogNorm, but this fix is regardless of that.

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

@jklymak jklymak added this to the v3.2.0 milestone Feb 3, 2020
@jklymak jklymak added Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. topic: color/colorbar labels Feb 3, 2020
@codecov
Copy link

codecov bot commented Feb 3, 2020

Codecov Report

Merging #16392 into master will decrease coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #16392      +/-   ##
==========================================
- Coverage   80.85%   80.85%   -0.01%     
==========================================
  Files         307      307              
  Lines       75745    75754       +9     
  Branches     9690     9693       +3     
==========================================
+ Hits        61245    61250       +5     
- Misses      11961    11964       +3     
- Partials     2539     2540       +1     
Impacted Files Coverage Δ
lib/matplotlib/backends/backend_macosx.py 40.65% <0.00%> (ø) ⬆️
lib/matplotlib/backends/qt_compat.py 51.57% <0.00%> (ø) ⬆️
lib/matplotlib/backends/backend_qt5.py 57.37% <0.00%> (ø) ⬆️
lib/matplotlib/backends/backend_wx.py 49.94% <0.00%> (ø) ⬆️
lib/matplotlib/font_manager.py 75.27% <0.00%> (ø) ⬆️
lib/matplotlib/colors.py 88.09% <0.00%> (-0.26%) ⬇️
lib/matplotlib/cbook/__init__.py 76.87% <0.00%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7a2971b...e175ffc. Read the comment docs.

@jklymak jklymak force-pushed the fix-properly-fallback-noscale branch from e175ffc to 6331db8 Compare February 3, 2020 04:32
@greglucas
Copy link
Contributor

There are multiple PRs out fixing various portions of the SymLog routines right now. I don't think that this one makes sense because you're going to add this new image test that will just fail and need to be updated immediately when you change the base scaling as proposed in the other ones.

I think it would be helpful to take a step back and rework the entire machinery at once rather than piecemealing it together.

@jklymak
Copy link
Member Author

jklymak commented Feb 3, 2020

This is orthogonal to whether the norm is correct or not, and this basically will be the system in place once the norm is sorted out. So I agree that the image test will need to change again, but I think this small change has more chance of getting in and affects other norms rather urgently. So I'd argue thats worth the extra image in the repo.

@anntzer
Copy link
Contributor

anntzer commented Feb 3, 2020

We could also just take it on faith (aka local manual testing) that the new approach is better (after all we've been doing "fine" (or not so fine...) without a proper test for years now), push this first fix without the baseline image test, and put a proper test once everything is settled.

@jklymak jklymak force-pushed the fix-properly-fallback-noscale branch from 6331db8 to e23338f Compare February 3, 2020 17:45
@jklymak
Copy link
Member Author

jklymak commented Feb 3, 2020

OK, I opened #16398 to remind us to re-add @dstansby's test when the norms are settle down, and took the image test and image out of this PR.

I think this PR should still go in to fix the problem with the bad colorbars.

Copy link
Member

@tacaswell tacaswell left a comment

Choose a reason for hiding this comment

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

modulo making _scale -> __scale to make it more private (to make sure it does to leak)

@anntzer
Copy link
Contributor

anntzer commented Feb 3, 2020

I don't think we have double-underscore prefixed things anywhere in mpl, why would this one need to be more private?

@tacaswell
Copy link
Member

paranoia

@jklymak jklymak force-pushed the fix-properly-fallback-noscale branch from e23338f to 0e24001 Compare February 3, 2020 20:46
@jklymak
Copy link
Member Author

jklymak commented Feb 3, 2020

I am ambivalent towards whether its __scale or _scale. Right now I have tow underscores, but if you'd like it changed, I can easily do that.

@anntzer
Copy link
Contributor

anntzer commented Feb 4, 2020

I actually prefer single underscore quite strongly here; I don't want to start creating "two levels" of private attributes and give the impression that some (single-underscore) private attributes are "more ok" to use as semi-public API than others (double-underscore), nor do I want to have mass-PRs replacing single underscores by doubles...

@jklymak
Copy link
Member Author

jklymak commented Feb 4, 2020

I didn't really understand the argument for two underscores, but just did as @tacaswell suggested. Suggest he engages with you on this ;-)

@efiring efiring merged commit ee2691c into matplotlib:master Feb 10, 2020
@jklymak jklymak deleted the fix-properly-fallback-noscale branch February 10, 2020 20:35
@lumberbot-app
Copy link

lumberbot-app bot commented Feb 10, 2020

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
$ git checkout v3.2.x
$ git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
$ git cherry-pick -m1 ee2691c3f8578b48e1b796df31672a91b88f6d97
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
$ git commit -am 'Backport PR #16392: FIX colorbars for Norms that do not have a scale.'
  1. Push to a named branch :
git push YOURFORK v3.2.x:auto-backport-of-pr-16392-on-v3.2.x
  1. Create a PR against branch v3.2.x, I would have named this PR:

"Backport PR #16392 on branch v3.2.x"

And apply the correct labels and milestones.

Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon!

If these instruction are inaccurate, feel free to suggest an improvement.

jklymak pushed a commit to jklymak/matplotlib that referenced this pull request Feb 10, 2020
jklymak added a commit that referenced this pull request Feb 10, 2020
…3.2.x

Backport PR #16392: FIX colorbars for Norms that do not have a scale.
@QuLogic
Copy link
Member

QuLogic commented Feb 12, 2020

Note that __ is not just "extra" private; in a class, it means it's not available to subclasses as well (because it's renamed to _ClassName_attribute).

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. topic: color/colorbar
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SymLogNorm colorbar incorrect on master
7 participants