{{ message }}
Fix FancyArrow rendering for zero-length arrows#30243
Merged
Merged
Conversation
ad9c92b to
070837b
Compare
Contributor
Author
QuLogic
reviewed
Jul 2, 2025
| else: | ||
| length = distance + head_length | ||
| if not length: | ||
| if (isinstance(length, np.ndarray) and length.size == 0) or (not length): |
Contributor
Author
|
Thank you for the review, @QuLogic! 🙌 |
timhoffm
approved these changes
Jul 3, 2025
QuLogic
approved these changes
Jul 3, 2025
Member
|
Thanks @nrnavaneet! Congratulations on your first PR to Matplotlib 🎉 We hope to hear from you again. |
QuLogic
pushed a commit
to QuLogic/matplotlib
that referenced
this pull request
Jul 3, 2025
QuLogic
pushed a commit
to QuLogic/matplotlib
that referenced
this pull request
Jul 3, 2025
jkseppan
added a commit
that referenced
this pull request
Jul 4, 2025
…3.10.x Backport PR #30243 on branch v3.10.x (Fix FancyArrow rendering for zero-length arrows)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes #30242: Cannot create empty FancyArrow (expired NumPy deprecation).
Summary of changes:
• Addresses a bug where FancyArrow(length=0) caused issues due to expired NumPy behavior.
• Adds an explicit check for zero length to safely initialize self.verts as an empty array.
• Adds a test case test_empty_fancyarrow in test_patches.py to confirm correct behavior for zero-length arrows.
This change ensures that FancyArrow gracefully handles length=0 without triggering errors or deprecated behavior in newer NumPy versions.