-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[Doc]: Bracket ArrowStyle Angle Unclear #23176
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
Comments
Hello, I would like to work with that issue. However, I think I did not completely understand your idea, it is to draw the angles in the image to make it more clear, like in your sugestion? |
@story645 Something like this? |
Yup, except the angle is always between the brace and the perpendicular |
I see, but I'm unsure how I would do that with matplotlib |
I think by importing the ArcAnnotation class from the scale invariant example (you can cross link in the text) and using that to label the angles. I think the perpendicular can be drawn using either vlines or plot. |
Ok, thanks. I'll see this tomorrow |
Hi @story645, can I contribute to this issue? Is this what you are looking for: |
That looks great! Go for it!!! |
Bonus: Maybe add an arrow head to the grey arc to indicate the angle direction (from the blue line to the bracket)? |
Sure thing @timhoffm, I'll look into that. |
Hi @timhoffm, I looked at a few ways of adding the arrows. One way is to simply add a FancyArrowPatch to the plot (as shown below), but this won't be scale invariant. Secondly, I added an arrow annotation to AngleAnnotation (similar to the text annotation):
I then tried to update it's position at plot time. I can easily set self.arrow.yx (similar to self.text.xy) but can't access the xytext variable (arrow._arrow_relpos I believe) to tell the updated arrow where to point from. Is it possible to set this during plot time, and if not do you have any other suggestions? Am I on the right track or is the FancyArrowPatch solution fine? |
The |
I was thinking this becomes a gallery example w/ the other annotation examples and is then linked to at the bottom of https://matplotlib.org/devdocs/api/_as_gen/matplotlib.patches.ArrowStyle.html#matplotlib.patches.ArrowStyle in the way that examples are linked in https://matplotlib.org/devdocs/api/_as_gen/matplotlib.patches.Arrow.html Then you also should be able to import the code since it'll be in the same folder. |
Ok thanks for the guidance @story645, first contributor here so a lot to learn 👌🏻😁 Appreciate it. Should I delete the PR? |
Absolutely not! Please just update the PR by restoring the what's new, creating a new example, and updating the arrow style docstrings to point to the example https://sphinx-gallery.github.io/stable/configuration.html#add-mini-galleries-for-api-documentation |
…example to make angles clear matplotlib#23176
…atplotlib#23176 (matplotlib#24145) * removed AngleAnnotation from angle_on_bracket_arrow example * Fixes indentation mistake. * rebase to main, remove conflicting commit
Documentation Link
https://matplotlib.org/devdocs/users/prev_whats_new/whats_new_3.4.0.html?highlight=bracket#angles-on-bracket-arrow-styles
Problem
I can't tell from this figure what Angle = 60 is relative to, since the top angle is >60 and the lower angle is <60 in the first example, and '0 degrees means perpendicular to the line' is buried in the api docs (I missed what that means like 6 times)
Suggested improvement
An example, that's cross referenced against the API docs, where the angle is marked up, similar to the scale invariant docs

I think it'd be nice to include the formulas for setting the bracket horizontal or vertical relative to the axes, but that's totally extra. I think it's a good first issue since it's completely standalone, a relatively small addition, and this information is missing.
The text was updated successfully, but these errors were encountered: