Improve legend loc and bbox_to_anchor documentation (#26620)#31422
Conversation
|
Thank you for opening your first PR into Matplotlib! If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks. We also ask that you please finish addressing any review comments on this PR and wait for it to be merged (or closed) before opening a new one, as it can be a valuable learning experience to go through the review process. You can also join us on gitter for real-time discussion. For details on testing, writing docs, and our review process, please see the developer guide. We strive to be a welcoming and open project. Please follow our Code of Conduct. |
Co-authored-by: Tim Hoffmann <[email protected]>
Co-authored-by: Tim Hoffmann <[email protected]>
|
Thanks for the review! Applied both suggestions. |
PR summary
Fixes #26620 — Improves the
locandbbox_to_anchorparameter documentation in the legend module.Why is this change necessary? The current
locdocumentation uses three separate paragraphs to describe legend positions, which is verbose and harder to scan. Thebbox_to_anchordocs don't clearly state it's an advanced option or link to relevant guides.What problem does it solve? Makes legend positioning easier to understand at a glance by adding a visual ASCII grid of all 9 positions, and clarifies the relationship between
locandbbox_to_anchor.What is the reasoning for this implementation? Follows the suggestions in [Doc]: Improve legend loc and bbox_to_anchor documentation #26620 by maintainer @timhoffm.
Changes
loc: Replaced three text paragraphs with a concise explanation and an ASCII visual grid showing all 9 legend positions. Clarified that positions are within a bounding box configurable viabbox_to_anchor.bbox_to_anchor: Clarified this is an advanced option for free placement. Added cross-references toFigure.legendfor outside placement and to the:ref:legend_guide``.AI Disclosure
I used Claude (Anthropic) for researching the issue and drafting the documentation text. The changes were reviewed and verified by me.
PR checklist