-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
DOC: add a couple more placement examples, crosslink axes_grid [ci doc] #26914
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
1115c7f
to
3ca96ad
Compare
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.
The new examples look good to me.
galleries/examples/axes_grid1/demo_colorbar_with_axes_divider.py
Outdated
Show resolved
Hide resolved
|
||
# %% | ||
# Manually placing colorbars | ||
# ========================== |
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 wonder if this and the previous section should be two subsections under this title, since in both we are encouraging the user to do it manually.
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.
OK, I rearranged somewhat. Need to see how it looks before I decide where to link
|
||
Inset axes placement is controlled as for legends: either by providing a *loc* | ||
option ("upper right", "best", ...), or by providing a locator with respect to | ||
the parent bbox. Parameters such as *bbox_to_anchor* and *borderpad* likewise | ||
work in the same way, and are also demonstrated here. | ||
|
||
Users should consider using `.Axes.inset_axes` instead (see | ||
:ref:`colorbar_placement`). |
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.
If the last two sections of the colorbar guide become one "Manually Placing Colorbars" section (see other comment), then this could link directly to that.
08926c5
to
c234384
Compare
c234384
to
4f75570
Compare
fig.colorbar(pcm, ax=axs[1], shrink=0.6) | ||
|
||
# %% | ||
# This is usual undesired, and can be worked around in various ways, e.g. |
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.
# This is usual undesired, and can be worked around in various ways, e.g. | |
# This is usually undesired, and can be worked around in various ways, e.g. |
Automatic placement | ||
=================== |
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.
Automatic placement | |
=================== | |
Automatic placement of colorbars | |
================================ |
For consistency with the "Manual" section below. Or make the other title short to match this, but I think the longer titles would be better if other parts of the docs link to specific sections?
# :ref:`axes_grid` has methods for creating colorbar axes as well: | ||
# | ||
# - :ref:`demo-colorbar-with-inset-locator` | ||
# - :ref:`demo-colorbar-with-axes-divider` |
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.
Think the "see also" should be at the bottom of the page?
# We solve this problem using `.Axes.inset_axes` to locate the axes in axes | ||
# coordinates. Note that if you zoom in on the axes, and thus | ||
# change the shape of the axes, the colorbar will also change position. |
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.
# We solve this problem using `.Axes.inset_axes` to locate the axes in axes | |
# coordinates. Note that if you zoom in on the axes, and thus | |
# change the shape of the axes, the colorbar will also change position. | |
# We solve this problem using `.Axes.inset_axes` to locate the colorbar relative to the | |
# parent axes. Note that if you zoom in on the parent axes, and thus | |
# change the shape of it, the colorbar will also change position. |
I appreciate this paragraph isn't new, but I feel like there are too many "axes" in there and it could be more specific about which axes each one refers to...!
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.
Went with the similar with a link out to the jargon:
# We solve this problem using `.Axes.inset_axes` to locate the axes in "axes
# coordinates" (see :ref:`transforms_tutorial`). Note that if you zoom in on
# the parent axes, and thus change the shape of it, the colorbar will also
# change position.
3ca0e25
to
fdf1f25
Compare
Co-authored-by: Ruth Comer <10599679+rcomer@users.noreply.github.com>
fdf1f25
to
ab94dd7
Compare
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.
Looks good to me.
…es, crosslink axes_grid [ci doc]
…es, crosslink axes_grid [ci doc]
…914-on-v3.8.0-doc Backport PR #26914 on branch v3.8.0-doc (DOC: add a couple more placement examples, crosslink axes_grid [ci doc])
…914-on-v3.8.x Backport PR #26914 on branch v3.8.x (DOC: add a couple more placement examples, crosslink axes_grid [ci doc])
Noted in SciTools/cartopy#2248 (comment) - placing colorbars inside axes is sometimes a good thing to do (think a map, where you know you have no data coloured over a body of water, so the colorbar fits nicely there). This adds a couple of simple examples to show how to do that. Also crosslink from
demo-colorbar-with-inset-locator
anddemo-colorbar-with-axes-divider
and added some notes that these methods can typically be accomplished by easier means.