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

Skip to content

FIX: stop deprecation message colorbar #18860

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
Nov 3, 2020

Conversation

jklymak
Copy link
Member

@jklymak jklymak commented Nov 1, 2020

PR Summary

Closes #18595

This preserves the existing behaviour without a deprecation warning. The existing behaviour is highly questionable, but...

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.3.3 milestone Nov 1, 2020
@jklymak
Copy link
Member Author

jklymak commented Nov 1, 2020

I guess this needs a test....

@jklymak jklymak marked this pull request as draft November 1, 2020 17:10
@jklymak
Copy link
Member Author

jklymak commented Nov 1, 2020

OK, So I'm not sure about this. This is only triggered by

import numpy as np
import matplotlib.pyplot as plt

x = np.arange(10.0)
np.random.seed(1024)
mat = np.random.randn(10, 10)
plt.contour(x, x, mat)

# for a solid colorbar:
cbar = plt.colorbar(location='bottom')
cbar.filled = True
cbar.draw_all()
plt.show()

Note that setting filled=True above turns the colorbar solid. However, this is pretty non-standard API, and a pretty strange way to display contours. The user has to manually call draw_all to get this to even happen at all.

So I'll suggest this should be merged to cover this strange edge case, but I'm not particularly convinced we want to protect this behaviour with a test.

@jklymak jklymak marked this pull request as ready for review November 1, 2020 21:57
@QuLogic
Copy link
Member

QuLogic commented Nov 3, 2020

If you do plt.colorbar(filler=True) instead, you get:

issue18595.py:12: MatplotlibDeprecationWarning: The 'filled' parameter to Colorbar has no effect because it is overridden by the mappable; it is deprecated since 3.3 and will be removed two minor releases later.
  cbar = plt.colorbar(filled=True)

so I'm convinced that filled probably should have been deprecated as an accessible attribute.

@QuLogic QuLogic merged commit d17905c into matplotlib:master Nov 3, 2020
@lumberbot-app
Copy link

lumberbot-app bot commented Nov 3, 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.3.x
$ git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
$ git cherry-pick -m1 d17905cf70600ef3a0123bc869bd9e06b54017de
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
$ git commit -am 'Backport PR #18860: FIX: stop deprecation message colorbar'
  1. Push to a named branch :
git push YOURFORK v3.3.x:auto-backport-of-pr-18860-on-v3.3.x
  1. Create a PR against branch v3.3.x, I would have named this PR:

"Backport PR #18860 on branch v3.3.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 jklymak deleted the fix-colorbar-solid branch November 3, 2020 21:32
@jklymak jklymak mentioned this pull request Nov 3, 2020
7 tasks
QuLogic added a commit that referenced this pull request Nov 4, 2020
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.

Getting internal "MatplotlibDeprecationWarning: shading='flat' ..."
3 participants