Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
rcomer merged 1 commit intomatplotlib:mainfromjklymak:doc-manual-colorbars
Sep 27, 2023

Conversation

jklymak
Copy link
Member

Noted inSciTools/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 fromdemo-colorbar-with-inset-locator anddemo-colorbar-with-axes-divider and added some notes that these methods can typically be accomplished by easier means.

@jklymakjklymakforce-pushed thedoc-manual-colorbars branch 5 times, most recently from1115c7f to3ca96adCompareSeptember 25, 2023 21:45
@jklymakjklymak marked this pull request as ready for reviewSeptember 25, 2023 22:51
Copy link
Member

@rcomerrcomer left a 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.


# %%
# Manually placing colorbars
# ==========================
Copy link
Member

@rcomerrcomerSep 26, 2023
edited
Loading

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.

Copy link
MemberAuthor

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`).
Copy link
Member

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.

@jklymakjklymak marked this pull request as draftSeptember 26, 2023 16:54
@jklymakjklymak marked this pull request as ready for reviewSeptember 26, 2023 18:17
fig.colorbar(pcm, ax=axs[1], shrink=0.6)

# %%
# This is usual undesired, and can be worked around in various ways, e.g.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
# This isusual undesired, and can be worked around in various ways, e.g.
# This isusually undesired, and can be worked around in various ways, e.g.

jklymak reacted with thumbs up emoji
Comment on lines 13 to 14
Automatic placement
===================
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
Automaticplacement
===================
Automaticplacementofcolorbars
================================

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?

jklymak reacted with thumbs up emoji
# :ref:`axes_grid` has methods for creating colorbar axes as well:
#
# - :ref:`demo-colorbar-with-inset-locator`
# - :ref:`demo-colorbar-with-axes-divider`
Copy link
Member

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?

jklymak reacted with thumbs up emoji
Comment on lines 171 to 173
#We solvethisproblem 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
# We solve this problem using `.Axes.inset_axes` to locate theaxes in axes
#coordinates. Note that if you zoom in on the axes, and thus
# change the shape ofthe axes, the colorbar will also change position.
# We solve this problem using `.Axes.inset_axes` to locate thecolorbar relative to the
#parent axes. Note that if you zoom in on the parent axes, and thus
# change the shape ofit, 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...!

Copy link
MemberAuthor

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.

rcomer reacted with thumbs up emoji
@jklymakjklymakforce-pushed thedoc-manual-colorbars branch 2 times, most recently from3ca0e25 tofdf1f25CompareSeptember 27, 2023 14:13
Co-authored-by: Ruth Comer <10599679+rcomer@users.noreply.github.com>
Copy link
Member

@rcomerrcomer left a 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.

@rcomerrcomer added this to thev3.8-doc milestoneSep 27, 2023
@rcomerrcomer merged commit37426df intomatplotlib:mainSep 27, 2023
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestSep 27, 2023
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestSep 27, 2023
rcomer added a commit that referenced this pull requestSep 27, 2023
…914-on-v3.8.0-docBackport PR#26914 on branch v3.8.0-doc (DOC: add a couple more placement examples, crosslink axes_grid [ci doc])
rcomer added a commit that referenced this pull requestSep 27, 2023
…914-on-v3.8.xBackport PR#26914 on branch v3.8.x (DOC: add a couple more placement examples, crosslink axes_grid [ci doc])
@ksundenksunden mentioned this pull requestNov 2, 2023
5 tasks
@jklymakjklymak deleted the doc-manual-colorbars branchJanuary 4, 2024 00:45
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@rcomerrcomerrcomer approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
v3.8-doc
Development

Successfully merging this pull request may close these issues.

2 participants
@jklymak@rcomer

[8]ページ先頭

©2009-2025 Movatter.jp