8000 test annotate(textcoords=offset fontsize) by saranti · Pull Request #25989 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

test annotate(textcoords=offset fontsize) #25989

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
May 28, 2023

Conversation

saranti
Copy link
Contributor
@saranti saranti commented May 27, 2023

PR summary

PR checklist

Closes #25907. Adds a test to check that the annotation offset_fontsize parameter actually offsets the text by the correct fontsize units. The unit distance was measured by comparing the fontsize against the number of points in offset_points

if i == 0:
points_coords = str(ann.get_window_extent())
else:
fontsize_coords = str(ann.get_window_extent())
Copy link
Contributor

Choose a reason for hiding this comment

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

would spell the whole thing

anns = [ax.annotate(...) for i in ...]
point_coords, fontsize_coords = [ann.get_window_extent() for ann in anns]
assert str(point_coords) == str(fontsize_coords)

but either way works.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you're happy with that, I'll squash it down 👍

@saranti saranti force-pushed the offset_fontsize branch from 8bd1824 to ecbc1c9 Compare May 28, 2023 13:45
@rcomer rcomer added this to the v3.8.0 milestone May 28, 2023
@rcomer rcomer merged commit 3218d1f into matplotlib:main May 28, 2023
@saranti saranti deleted the offset_fontsize branch January 24, 2024 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ENH]: Add test for annotate(textcoods="offset fontsize")
3 participants
0