-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Colorbar grid postion #18340
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
Colorbar grid postion #18340
Conversation
Follow these instructions for the rebase: https://matplotlib.org/3.1.3/devel/gitwash/development_workflow.html#rebasing-on-trunk (please note the instructions to create a backup branch, just in case ;-)) |
This seems like a reasonable feature to add to me 👍 In addition to being rebased, this should get a whats_new entry and maybe an example in the gallery? |
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.
Marking as needs changes, as this needs a rebase and a what's new entry. @ShawnChen1996 let us know if you need help with anything!
I had some issues as I switched to a new laptop, but finally managed to set up the environment and rebase this. The head of this branch I rebase on is very different than the previous one. I made the modification accordingly and so far the graph looks good, may need a big tuning on the May I ask is this rebasing correct? As there are 9 check failures. |
I don't think you pushed your rebase to GitHub. But.... Before you do, make sure you've backed up this version of the branch, just in case there are errors.... Thanks for persevering with this! |
sorry for the trouble I made. I opened the another pull request with rebased code. This PR is closed. The new PR is #18575 |
PR Summary
I made a little change so that now the
anchor
argument inmake_axes_gridspec
mimic the behavior of that inmake_axes
. Now the postion of colorbar is determined byanchor
andshrink
, should be very useful whenshrink
< 1.0The effect is demostrated in the plot below. Now I can place the colorbar at different place with different shrinked size.
Before the change, we can achieve that using
ax.figure.colorbar(mappable, ax=ax, anchor=(0,0.3), use_gridspec=False)
, however, this will create a colorbar as aAxes
not aSubplot
, when I usesubplots_ajust
to adjust the border margins, I got the following plot.It seems the colorbar Axes is ignored and my plot is re-placed according to its
panchor
parameter thatmake_axes
set. It bothers me when I have multiple plots and wanna adjust the plots border margins and wspace, hspace.gridspec
offers a better approach and is the default setting when creating a colorbar, however, I want the colorbar to be 0.5 size and placed at the bottom right, which is mot implemented.So this is what I did basically.
PR Checklist