Skip to content

Addresses issue #24618 "Road sign" boxstyle/annotation, alternative to #24697#24744

Closed
Abitamim wants to merge 5 commits intomatplotlib:mainfrom
Abitamim:adjustable-arrow-head-annotation
Closed

Addresses issue #24618 "Road sign" boxstyle/annotation, alternative to #24697#24744
Abitamim wants to merge 5 commits intomatplotlib:mainfrom
Abitamim:adjustable-arrow-head-annotation

Conversation

@Abitamim
Copy link
Copy Markdown
Contributor

PR Summary

This PR is to address the concerns raised in #24618. I've added the ability to specify "arrow_head" and "arrow_width" in the boxstyle attributes. By specifying "head_width=1" for DArrow, LArrow, or RArrow, this makes the head of the arrow flush with the top and bottom of the body.

I need advise on if this was the correct approach, or if I should try something else.

I have also added a test and documentation. I will likely have to redo all of these commit because git is messy, but I would like feedback on what I have done.

PR Checklist

Documentation and Tests

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

Release Notes

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

@oscargus
Copy link
Copy Markdown
Member

Thank you!

Some minor comments to consider. (Hard to say which one we will go with in the end, so for what it is worth.)

I think that incorrect input should raise a ValueError rather than adjusting to be within the bounds. Not sure that having an upper limit of 10 for head_width actually makes sense. Imaging doing a very big plot etc.

It would be nice if one can modify the position of where the arrow part starts, now it can be quite crammed (but apart from that looks nice!). As I understand it, it is not possible at the moment? I seem to recall that there is a very nice illustration of the (fancy?) arrow properties somewhere that @timhoffm did. Maybe he would be kind enough to point it out? (I should have linked that in the issue I realize.)

@timhoffm
Copy link
Copy Markdown
Member

@oscargus do you mean the arrow in quiver? This does not help with BoxStyle.

@story645
Copy link
Copy Markdown
Member

@oscargus what do you think is left to do on this PR?

@ksunden ksunden mentioned this pull request Jul 21, 2023
5 tasks
@ksunden ksunden modified the milestones: v3.8.0, v3.9.0 Aug 8, 2023
greater than this is contrained to the edge values.
"""
self.pad = pad
if head_width > 10:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This can be done as self.head_width = np.clip(head_width, 0, 10)

@tacaswell
Copy link
Copy Markdown
Member

We like this one better than #24618 and do mostly like the parameterization (fraction of height + angle is less ambigious than two fractional lengths) but have a couple of to-dos / concerns

  • should "width" be "height" as it is a fraction of the height
  • do we need the limits on the length and angle (going greater than 180 could make >< shapes as well)
  • needs a whats new to show this off

[notes from call with @ksunden and @QuLogic ]

@timhoffm
Copy link
Copy Markdown
Member

Superseeded by #31198. @Abitamim thanks for your input, even though this specific PR is superseeded.

@timhoffm timhoffm closed this Mar 26, 2026
@github-project-automation github-project-automation bot moved this from Waiting for author to Done in First Time Contributors Mar 26, 2026
@QuLogic QuLogic modified the milestones: future releases, v3.11.0 Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

7 participants