Skip to content
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

Remove some examples from Userdemo #25801

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

timhoffm
Copy link
Member

@timhoffm timhoffm commented May 1, 2023

PR summary

Partly adresses #25800. See the individual commit messages.

While we should consolidate the examples for creating complex Axes
layouts (or rather have a guide on this), that's beyond the scope of
this PR. All three examples are special enough so that we want to keep
them until we have something better.
texts_albels_and_annotations/legend_outside

This also splits the plots in two and adds context documentation.
@timhoffm timhoffm added this to the v3.8.0 milestone May 1, 2023
@timhoffm timhoffm changed the title Remove userdemo Remove some examples from Userdemo May 1, 2023
@@ -8,6 +8,8 @@
*height_ratios*, and the control of the spacing around and between subplots
using subplot params (*left*, *right*, *bottom*, *top*, *wspace*, and
*hspace*).

.. redirect-from:: /gallery/userdemo/demo_gridspec03
Copy link
Member

Choose a reason for hiding this comment

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

Can we re-number these now? There's no need for the gaps.

legend box.

By default, Axes fill the whole figure area, and thus legends placed outside would
be cut of. We therefore use a layout manager to resize everything so that the legend
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
be cut of. We therefore use a layout manager to resize everything so that the legend
be cut off. We therefore use a layout manager to resize everything so that the legend

fig, ax = plt.subplots(layout='constrained')
ax.plot([1, 2, 3], label="line 1")
ax.plot([3, 2, 1], label="line 2")
ax.legend(bbox_to_anchor=(1.05, 1), loc='upper left', borderaxespad=0)
Copy link
Member

Choose a reason for hiding this comment

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

Should we also mention the new outside upper left (#19743)?

Copy link
Member

Choose a reason for hiding this comment

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

The User Guide is pretty comprehensive on that. I'm not sure what the thinking is in general about duplicating information across examples/tutorials/guide.
https://matplotlib.org/devdocs/users/explain/axes/legend_guide.html#figure-legends

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for making me aware of the duplication. I'll check how to handle this best.

@timhoffm timhoffm marked this pull request as draft May 2, 2023 11:32
@ksunden ksunden modified the milestones: v3.8.0, v3.8-doc Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants