Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Adjust docstrings of legend for typos, font size#24804

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
ksunden wants to merge1 commit intomatplotlib:main
base:main
Choose a base branch
Loading
fromksunden:legend_docstrings

Conversation

ksunden
Copy link
Member

PR Summary

As far as I can tell, fontsize is a floating point value in points that
is passed directly to legend_handler... which makes me skeptical about
the documentation that says it is an integer number of pixels.

PR Checklist

Documentation and Tests

  • [n/a] Has pytest style unit tests (andpytest passes)
  • [n/a] Documentation is sphinx and numpydoc compliant (the docs shouldbuild 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 indoc/users/next_whats_new/
  • [n/a] API changes are marked with a.. versionchanged:: directive in the docstring and documented indoc/api/next_api_changes/
  • [n/a] Release notes conform with instructions innext_whats_new/README.rst ornext_api_changes/README.rst

As far as I can tell, fontsize is a floating point value in points thatis passed directly to legend_handler... which makes me skeptical aboutthe documentation that says it is an integer number of pixels.
@ksunden
Copy link
MemberAuthor

A brief summary of some thoughts here:

  • fontsize for legend_handler is documented as "integer in pixels"

  • the only place it is passed internally is inlegend.py, wherelegend_artist is called, where it is evident that the value being passed is a floating point number in points (self._fontsize, set at init time as explicitly the font size in points)

  • for most handlers, font size isn't even used (even in cases where itis used, it is multiplied by values with a default of 0 which are, at least internally, never set to non-zero values)

  • the exception where the fontsize comes into play and uses a non-zero value are asmarker_pad and[xy]err_pad scale factor

  • even in such a case, the computation is always floating point math anyway, so even if we say it should be pixels, float type is still appropriate, though the implementation should probably be adjusted. (partial pixels are a thing, especially with HiDPI screens)

  • If we are actually happy with current behavior, the docs should be updated to reflect it is float size in points rather than int size in pixels

@story645
Copy link
Member

If it isn't in points it probably should be in points 'cause consistency. Is there a way to test by passing the same # to this method and something that's documented as pixel and seeing if they look the same, or nah 'cause the numbers get multiplied in different ways before they hit the renderer?

(I think we should maybe define a custom float type "points", but that's part of the larger internal typing discussion)

@tacaswell
Copy link
Member

If it is in points, then where we use it needs to become dpi aware?

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@ksunden@story645@tacaswell

[8]ページ先頭

©2009-2025 Movatter.jp