Title: [Bug]: setting patchA of Annotation.arrow_patch has no effect · Issue #28316 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: setting patchA of Annotation.arrow_patch has no effect · Issue #28316 · matplotlib/matplotlib
X Title: [Bug]: setting patchA of Annotation.arrow_patch has no effect · Issue #28316 · matplotlib/matplotlib
Description: Bug summary I am trying to improve some edge cases for plotting arrows in adjustText. Without going into details, sometimes I have to use ax.annotate to add arrows instead of directly using FancyArrowPatch. However in this case the arrow...
Open Graph Description: Bug summary I am trying to improve some edge cases for plotting arrows in adjustText. Without going into details, sometimes I have to use ax.annotate to add arrows instead of directly using FancyAr...
X Description: Bug summary I am trying to improve some edge cases for plotting arrows in adjustText. Without going into details, sometimes I have to use ax.annotate to add arrows instead of directly using FancyAr...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/28316
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: setting patchA of Annotation.arrow_patch has no effect","articleBody":"### Bug summary\n\nI am trying to improve some edge cases for plotting arrows in adjustText. Without going into details, sometimes I have to use ax.annotate to add arrows instead of directly using FancyArrowPatch. However in this case the arrows are not associated with the text objects and strike through them. I thought I could modify the arrow patch of the Annotation object to point to the corresponding Text object. The object appears to be set correctly, however this doesn't fix the clipping of the arrow! With a regular FancyArrowPatch this procedure works just as expected. Interestingly, if I update other properties (color) it works perfectly.\r\n\r\n(As an aside, why do the two arrows have a different style in the example below?)\n\n### Code for reproduction\n\n```Python\nimport matplotlib.pyplot as plt\r\nfrom matplotlib import patches\r\nxytext = 0.2, 0.5\r\nf, ax = plt.subplots()\r\nann = ax.annotate('', xy=(0.5, 0.6), xytext=xytext, arrowprops=dict(arrowstyle=\"-\u003e\"))\r\nann_arrowpatch = ann.arrow_patch\r\nprint(ann_arrowpatch.patchA)\r\ntext = plt.text(xytext[0], xytext[1], 'Text', ha='center', va='center')\r\nann_arrowpatch.set_patchA(text)\r\nprint(ann_arrowpatch.patchA)\r\n\r\nann_arrowpatch.set_color('b')\r\n\r\narrowpatch = patches.FancyArrowPatch(posA=xytext, posB=(0.5, 0.4), arrowstyle=\"-\u003e\", color='r')\r\nax.add_patch(arrowpatch)\r\nprint(arrowpatch.patchA)\r\narrowpatch.set_patchA(text)\r\nprint(arrowpatch.patchA)\n```\n\n\n### Actual outcome\n\nNone\r\nText(0.2, 0.5, 'Text')\r\nNone\r\nText(0.2, 0.5, 'Text')\r\n\r\n\r\n\n\n### Expected outcome\n\nExpect that the blue arrow is also clipped by the Text\n\n### Additional information\n\n_No response_\n\n### Operating system\n\nOS/X\n\n### Matplotlib Version\n\n3.8.0\n\n### Matplotlib Backend\n\nboth inline and ipympl\n\n### Python version\n\n3.11.7\n\n### Jupyter version\n\n6.4.5\n\n### Installation\n\nconda","author":{"url":"https://github.com/Phlya","@type":"Person","name":"Phlya"},"datePublished":"2024-05-29T14:23:26.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":11},"url":"https://github.com/28316/matplotlib/issues/28316"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e404da00-f4dd-2c82-222e-87340fc7599a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DA76:1FEBBD:1F91ED:2AF145:6A52720B |
| html-safe-nonce | 69ff994ec8c54688ee67070d31fcf8760d140ea12b8a0466525e3e9599db7292 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQTc2OjFGRUJCRDoxRjkxRUQ6MkFGMTQ1OjZBNTI3MjBCIiwidmlzaXRvcl9pZCI6IjcyMjc1NzM5OTU0NDQ1MzE3MjMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 321724e3215d76d4c33fd802468f0e792c97e73c3092121c75823d0476d36bca |
| hovercard-subject-tag | issue:2323467876 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/28316/issue_layout |
| twitter:image | https://opengraph.githubassets.com/90c12354c40f788041665050ee7e0debb8b8cd7596672e507bdfd5bbe85af195/matplotlib/matplotlib/issues/28316 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/90c12354c40f788041665050ee7e0debb8b8cd7596672e507bdfd5bbe85af195/matplotlib/matplotlib/issues/28316 |
| og:image:alt | Bug summary I am trying to improve some edge cases for plotting arrows in adjustText. Without going into details, sometimes I have to use ax.annotate to add arrows instead of directly using FancyAr... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Phlya |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width