-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
base: main
Are you sure you want to change the base?
Conversation
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.
@@ -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 |
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.
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 |
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.
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) |
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.
Should we also mention the new outside upper left
(#19743)?
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 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
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.
Thanks for making me aware of the duplication. I'll check how to handle this best.
PR summary
Partly adresses #25800. See the individual commit messages.