update colorbar.py make_axes_gridspec#16646
Conversation
|
Thanks a lot for the PR. After a quick look this seems feasible and reasonable. Will probably need some tests, and you have a flake8 error (follow links under Travis CI). Can you also check that this works w/ |
should fix the pep8 failure
|
I have made a another commit, should fix the format error. |
|
Sorry, I forgot about this. This is not compatible with This needs tests and a what's new entry, but I don't see any reason why adding this would be a problem. |
|
BTW< don't be shy about pinging for review at a reasonable interval. |
|
Thank you for pushing this PR forward, this is my 1st time to contribute to matplotlib, thus not very familiar with the procedure. What do I do next? I can see it fails the codecov test. |
|
If you can, it would be nice if you would add some tests, probably in |
|
Sorry for the delay. |
|
Sorry, this needs a rebase, and the docs should build as well. Please feel free to ping - I think this is a good addition. |
|
|
I rebased my commits into a branch named I will work on the docstring and example very soon. |
|
Since it was just me who has reviewed this so far, why not make things easier on ourselves and just open a new PR... Its better that you have the commits in a branch other than |
|
new PR done. Has merge conflicts |
|
Closed in lieu of #18340 |
PR Summary
I made a little change so that now the
anchorargument inmake_axes_gridspecmimic the behavior of that inmake_axes. Now the postion of colorbar is determined byanchorandshrink, 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 aAxesnot aSubplot, when I usesubplots_ajustto 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
panchorparameter thatmake_axesset. It bothers me when I have multiple plots and wanna adjust the plots border margins and wspace, hspace.gridspecoffers 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