Thanks to visit codestin.com
Credit goes to github.com

Skip to content

DOC: change marginal scatter plot to subplot_mosaic #29670

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

Merged
merged 2 commits into from
Feb 26, 2025

Conversation

jklymak
Copy link
Member

@jklymak jklymak commented Feb 23, 2025

Follow up to #29667 to use subplot_mosaic instead of add_gridspec and three add_subplot calls.

I actually removed the gridspec example, though happy to revert and put at the end. I don't think users in general should ever need to use gridspec.

@github-actions github-actions bot added the Documentation: examples files in galleries/examples label Feb 23, 2025
@jklymak jklymak force-pushed the doc-marginal-subplot-mosaic branch from 2c2741d to 99c31da Compare February 24, 2025 01:31
Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

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

Additional note: The examples seems to be more about subplots and placements rather than lines bars and markers. I propose to move this to the "Subplots, Axes and figures" section. Here or in a followup PR.

@jklymak
Copy link
Member Author

jklymak commented Feb 24, 2025

"Subplots, Axes and figures" section. Here or in a followup PR.

For sure could do that - I think the original motivation was to show folks how to make this relatively common plot type, so having it here lets them see that its possible, though of course the only "hard" thing about it is the axes layout. I could see the case for going in either direction.

@jklymak jklymak force-pushed the doc-marginal-subplot-mosaic branch from 99c31da to 7fc37be Compare February 24, 2025 16:27
@jklymak jklymak force-pushed the doc-marginal-subplot-mosaic branch from d6cfc3f to 789f3a5 Compare February 25, 2025 14:59
@jklymak jklymak force-pushed the doc-marginal-subplot-mosaic branch from d64a582 to 792c28a Compare February 25, 2025 15:49
@@ -109,12 +102,24 @@ def scatter_hist(x, y, ax, ax_histx, ax_histy):

# %%
#
# While we recommend using one of the two methods described above, there are
# number of other ways to achieve a similar layout:
# - The Axes can be positioned manually in relative coordinates using
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
# - The Axes can be positioned manually in relative coordinates using
#
# - The Axes can be positioned manually in relative coordinates using

Sorry, overlooked one additional ReST formatting issue (bullet lists must be separated with an empty line)

# .. admonition:: References
#
# The use of the following functions, methods, classes and modules is shown
# in this example:
#
# - `matplotlib.figure.Figure.add_subplot`
# - `matplotlib.figure.Figure.subplot_mosaic`
# - `matplotlib.figure.Figure.add_gridspec`
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
# - `matplotlib.figure.Figure.add_gridspec`

No longer used in the example.

Copy link
Member Author

Choose a reason for hiding this comment

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

replaced with add_subplot also added pyplot.subplot_mosaic because that is more relevant.

#    - `matplotlib.figure.Figure.subplot_mosaic`
#    - `matplotlib.pyplot.subplot_mosaic`
#    - `matplotlib.figure.Figure.add_subplot`
#    - `matplotlib.axes.Axes.inset_axes`
#    - `matplotlib.axes.Axes.scatter`
#    - `matplotlib.axes.Axes.hist`

Comment on lines 18 to 19
While `.Axes.inset_axes` may be a bit more complex, it allows correct handling
of main Axes with a fixed aspect ratio.
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
While `.Axes.inset_axes` may be a bit more complex, it allows correct handling
of main Axes with a fixed aspect ratio.

Optional, but could be left out. That is also explained at the start of the inset_axes example itself.

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess I think it is also useful to explain why there are two methods where they are listed. A bit of repetition is probably OK.

@timhoffm timhoffm added this to the v3.10.0-doc milestone Feb 26, 2025
@timhoffm timhoffm merged commit 0b7a88a into matplotlib:main Feb 26, 2025
22 checks passed
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Feb 26, 2025
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Feb 26, 2025
timhoffm added a commit that referenced this pull request Feb 27, 2025
…670-on-v3.10.x

Backport PR #29670 on branch v3.10.x (DOC: change marginal scatter plot to subplot_mosaic)
timhoffm added a commit that referenced this pull request Feb 27, 2025
…670-on-v3.10.0-doc

Backport PR #29670 on branch v3.10.0-doc (DOC: change marginal scatter plot to subplot_mosaic)
@jklymak
Copy link
Member Author

jklymak commented Feb 27, 2025

Thanks for the help @timhoffm

@jklymak jklymak deleted the doc-marginal-subplot-mosaic branch February 27, 2025 01:23
@ksunden ksunden mentioned this pull request Mar 3, 2025
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation: examples files in galleries/examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants