Skip to content

Clean up legend loc parameter documentation #25325

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 1 commit into from
Feb 28, 2023

Conversation

QuLogic
Copy link
Member

@QuLogic QuLogic commented Feb 25, 2023

PR Summary

As we now have different docs for the loc parameter to Figure/Axes.legend, we can replace the ambiguous 'axes/figure' with the correct type. And also remove 'best' from the Figure.legend version.

Note, I did not remove 'best' from the numerical table, as that would be annoying to do, so I just annotated it.

Fixes #25323

PR Checklist

Documentation and Tests

  • [n/a] Has pytest style unit tests (and pytest passes)
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • [n/a] New plotting related features are documented with examples.

Release Notes

  • [n/a] New features are marked with a .. versionadded:: directive in the docstring and documented in doc/users/next_whats_new/
  • [n/a] API changes are marked with a .. versionchanged:: directive in the docstring and documented in doc/api/next_api_changes/
  • [n/a] Release notes conform with instructions in next_whats_new/README.rst or next_api_changes/README.rst

As we now have different docs for the *loc* parameter to
`Figure/Axes.legend`, we can replace the ambiguous 'axes/figure' with
the correct type. And also remove 'best' from the `Figure.legend`
version.

Note, I did not remove 'best' from the numerical table, as that would be
annoying to do, so I just annotated it.

Fixes #matplotlib#25323
@QuLogic QuLogic added this to the v3.7.1 milestone Feb 25, 2023
Comment on lines -418 to -420
The legend location can be specified by setting *loc* with a tuple of
2 floats, which is interpreted as the lower-left corner of the legend
in the normalized axes coordinate.
Copy link
Member Author

Choose a reason for hiding this comment

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

This is already described in the loc parameter docstring, so no need for it here.

Comment on lines -413 to -416
Users can specify any arbitrary location for the legend using the
*bbox_to_anchor* keyword argument. *bbox_to_anchor* can be a
`.BboxBase` (or derived there from) or a tuple of 2 or 4 floats.
See `set_bbox_to_anchor` for more detail.
Copy link
Member Author

Choose a reason for hiding this comment

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

And this is described in much more detail in the bbox_to_anchor parameter docstring, so I didn't see a need to keep it either.

Copy link
Member

Choose a reason for hiding this comment

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

Agreed, and the user comes to the parameter docstring before this.

Comment on lines -413 to -416
Users can specify any arbitrary location for the legend using the
*bbox_to_anchor* keyword argument. *bbox_to_anchor* can be a
`.BboxBase` (or derived there from) or a tuple of 2 or 4 floats.
See `set_bbox_to_anchor` for more detail.
Copy link
Member

Choose a reason for hiding this comment

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

Agreed, and the user comes to the parameter docstring before this.

@rcomer rcomer merged commit 217f8f7 into matplotlib:main Feb 28, 2023
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Feb 28, 2023
@QuLogic QuLogic deleted the legend-loc-doc branch February 28, 2023 20:12
QuLogic added a commit that referenced this pull request Feb 28, 2023
…325-on-v3.7.x

Backport PR #25325 on branch v3.7.x (Clean up legend loc parameter documentation)
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.

[Doc]: Misleading Figure.legend() options, loc='best' is not valid.
2 participants