Fix figure.colorbar() with axes keywords#10000
Merged
dstansby merged 2 commits intomatplotlib:masterfrom Dec 18, 2017
Merged
Conversation
Contributor
|
Congratulations on getting issue #10000 :-) |
Member
Author
|
Thanks! |
Member
|
Can we have a test that checks these kwargs are stripped so no one monkeys w/ this down the road? |
880fe2c to
9ef39d6
Compare
Member
Author
|
@jklymak I've added a test. It just checks that the arguments are accepted and do not raise an exception. |
jklymak
approved these changes
Dec 17, 2017
dstansby
reviewed
Dec 18, 2017
|
|
||
| # need to remove kws that cannot be passed to Colorbar | ||
| NON_COLORBAR_KEYS = ['fraction', 'pad', 'shrink', 'aspect', 'anchor', | ||
| 'panchor'] |
Member
There was a problem hiding this comment.
Does the remove of these kwargs mean the docstring was wrong/needs changing now?
Member
Author
There was a problem hiding this comment.
I don't think so. The notes section in the docs says says:
Additional keyword arguments are of two kinds:
- axes properties
- colorbar properties
We receive a mixture, which AFAICS is intended. But we have to remove the kwargs, that Colorbar does not understand.
dstansby
approved these changes
Dec 18, 2017
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8493.
The problem was that
Figure.colorbar()acceptsAxesas well asColorbarkeywords. However they are all passed on to theColorbarconstructor. This has an explicit signature of supported keywords and complains on theAxeskeywords 'anchor' and 'panchor'.The fix is to filter out
Axeskeywords that are not allowed inColorbar. Note: 'orientation' has to be passed to both.