Skip to content

Fix example for "Scale invariant angle label" #23027

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

Closed
wants to merge 3 commits into from

Conversation

kkoutris
Copy link

@kkoutris kkoutris commented May 9, 2022

PR Summary

Fix the plot example so that the letters be inside the arcs.

Closes #22392

PR Checklist

Tests and Styling

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

  • New features are documented, with examples if plot related.
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).

@kkoutris kkoutris changed the title Kkoutris Fix example for "Scale invariant angle label" May 9, 2022
@kkoutris
Copy link
Author

kkoutris commented May 9, 2022

#22392

@andrew-fennell
Copy link
Contributor

andrew-fennell commented May 9, 2022

Hi there, @kkoutris! Thanks for looking into this issue.

It looks like you have a few linting issues being caught by flake8. Pre-commit hooks check this, but you can also use flake8 <file path to lint> to check for linting issues.

@oscargus
Copy link
Member

I took the liberty of adding "Closes ..." to the original post. In that way the issue is automatically closed upon merge.

Copy link
Contributor

@andrew-fennell andrew-fennell left a comment

Choose a reason for hiding this comment

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

I think a different approach is needed to solve this issue.

I added a comment that might offer more insight here: #22392 (comment)

Comment on lines +240 to +247
am1 = AngleAnnotation(center, p1[1], p2[1], ax=ax, size=75,
textposition="inside", text=r"$\alpha$")
am2 = AngleAnnotation(center, p2[1], p1[0], ax=ax, size=35,
textposition="inside", text=r"$\beta$")
am3 = AngleAnnotation(center, p1[0], p2[0], ax=ax, size=75,
textposition="inside", text=r"$\gamma$")
am4 = AngleAnnotation(center, p2[0], p1[1], ax=ax, size=35,
textposition="inside", text=r"$\theta$")
Copy link
Contributor

Choose a reason for hiding this comment

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

textposition="inside" is the default for the AngleAnnotation class.

This can be found here:

text="", textposition="inside", text_kw=None, **kwargs):

@@ -185,7 +185,7 @@ def update_text(self):
r = s / 2
if self.textposition == "inside":
r = s / np.interp(angle_span, [60, 90, 135, 180],
[3.3, 3.5, 3.8, 4])
[10, 3.5, 11.4, 4])
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure this is the right approach to fix the issue. This is moving the text, but the issue is really about the scaling of the angle markings.

@jklymak jklymak marked this pull request as draft June 2, 2022 12:24
@jklymak
Copy link
Member

jklymak commented Jun 2, 2022

Moved to draft until comments addressed. Thanks!

@timhoffm
Copy link
Member

timhoffm commented Feb 2, 2025

Closing as this is not the right approach (see #23027 (review)).

@timhoffm timhoffm closed this Feb 2, 2025
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]: Example for "Scale invariant angle label" does not scale the arc correctly
5 participants