-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add test to colorbar.py to see if ax is an object as returned by plt.subplots #8733
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
Conversation
Removed some debug statements and old comments; whitespace / line wrapping. In particular, debug comments which simply indicate that a function has been called can easily be replaced by tools such as https://pypi.python.org/pypi/hunter or https://pypi.python.org/pypi/smiley.
…n and turn into a list. This makes colorbar compaticble with the output of plt.subplots (for instance)
Parameterize test_fill_between and test_fill_betweenx
lib/matplotlib/colorbar.py
Outdated
@@ -1118,6 +1118,8 @@ def make_axes(parents, location=None, orientation=None, fraction=0.15, | |||
pad = kw.pop('pad', loc_settings['pad']) | |||
|
|||
# turn parents into a list if it is not already | |||
if isinstance(parents, np.ndarray): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would replace this and the lines below by
parents = np.atleast_1d(parents).ravel().tolist()
(there will never be enough axes for this to be a performance issue...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that seems to work. Very clever!
DOC: Make histogram example figures fit on web page
DOC: removing sgskip on text path demo
Clarify how a FancyArrowPatch behaves
Allow divmod to be overridden by numpy
Various cleanups to backends code.
…n and turn into a list. This makes colorbar compaticble with the output of plt.subplots (for instance)
Sorry, my git skills screwed this up. I'll fix with a new pull request once I have it sorted out. My apologies. |
In desperate cases, you should be able to do something like
(yes I know there are better ways to do this). |
…n and turn into a list. This makes colorbar compaticble with the output of plt.subplots (for instance)
PR Summary
fig.colorbar(pcm=pcm,ax=axs)
can take a list of axes objects as the argument to ax. However,axs=plt.subplots(2,1)
returns a numpyobject
. This PR simply checks ifaxs
is an object and flattens and makes the object a list. Now commands like:will take space away from all the subplots, and put a colorbar on the right of all four subplots.
PR Checklist