-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
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
DOC: change marginal scatter plot to subplot_mosaic #29670
Conversation
2c2741d
to
99c31da
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.
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.
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. |
99c31da
to
7fc37be
Compare
d6cfc3f
to
789f3a5
Compare
d64a582
to
792c28a
Compare
@@ -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 |
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 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` |
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.
# - `matplotlib.figure.Figure.add_gridspec` |
No longer used in the example.
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.
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`
While `.Axes.inset_axes` may be a bit more complex, it allows correct handling | ||
of main Axes with a fixed aspect ratio. |
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.
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.
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 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.
…670-on-v3.10.x Backport PR #29670 on branch v3.10.x (DOC: change marginal scatter plot to subplot_mosaic)
…670-on-v3.10.0-doc Backport PR #29670 on branch v3.10.0-doc (DOC: change marginal scatter plot to subplot_mosaic)
Thanks for the help @timhoffm |
Follow up to #29667 to use subplot_mosaic instead of
add_gridspec
and threeadd_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.