Title: [ENH]: FancyArrow in 3D · Issue #22571 · matplotlib/matplotlib · GitHub
Open Graph Title: [ENH]: FancyArrow in 3D · Issue #22571 · matplotlib/matplotlib
X Title: [ENH]: FancyArrow in 3D · Issue #22571 · matplotlib/matplotlib
Description: Problem Hello, FancyArrow can not be used in 3D. Some proposals (#21688) consists in creating a new class. Could it be possible: to extend FancyArrow to 3D (as for quiver) to solve -if possible- the arrow head problem representation when...
Open Graph Description: Problem Hello, FancyArrow can not be used in 3D. Some proposals (#21688) consists in creating a new class. Could it be possible: to extend FancyArrow to 3D (as for quiver) to solve -if possible- th...
X Description: Problem Hello, FancyArrow can not be used in 3D. Some proposals (#21688) consists in creating a new class. Could it be possible: to extend FancyArrow to 3D (as for quiver) to solve -if possible- th...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/22571
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[ENH]: FancyArrow in 3D","articleBody":"### Problem\n\nHello,\r\n\r\nFancyArrow can not be used in 3D.\r\nSome proposals (#21688) consists in creating a new class.\r\nCould it be possible: \r\n1. to extend FancyArrow to 3D (as for quiver)\r\n2. to solve -if possible- the arrow head problem representation when loocking the arrow along its axis (see the 2nd plot in the figure below)\r\n\r\nThanks,\r\nPatrick\r\n\r\n```\r\nimport numpy as np\r\nimport matplotlib.pyplot as plt\r\nfrom matplotlib.patches import FancyArrowPatch, FancyArrow\r\nfrom mpl_toolkits.mplot3d import proj3d\r\n\r\n\r\nclass Arrow3D(FancyArrowPatch):\r\n \"\"\" Create fancy arrow (artist) for 3d matplotlib visualisation \"\"\"\r\n\r\n def __init__(self, xs, ys, zs, *args, **kwargs):\r\n FancyArrowPatch.__init__(self, (0, 0), (0, 0), *args, **kwargs)\r\n self._verts3d = xs, ys, zs\r\n\r\n def draw(self, renderer):\r\n xs3d, ys3d, zs3d = self._verts3d\r\n xarr, yarr, _ = proj3d.proj_transform(xs3d, ys3d, zs3d, self.axes.M)\r\n self.set_positions((xarr[0], yarr[0]), (xarr[1], yarr[1]))\r\n FancyArrowPatch.draw(self, renderer)\r\n\r\n\r\nfig, ax = plt.subplots(1, 2, figsize=(12, 5),\r\n subplot_kw=dict(projection=\"3d\",\r\n proj_type='ortho'))\r\n\r\nax[0].voxels(np.ones((1, 1, 1)), facecolors=[0, 0, 0, 0], edgecolors='k')\r\n# ax[0].add_artist(FancyArrow(0, 0, 0, 1, 1, 1))\r\nax[0].add_artist(Arrow3D((0, 1), (0, 1), (0, 1), mutation_scale=50))\r\n\r\nax[1].voxels(np.ones((1, 1, 1)), facecolors=[0, 0, 0, 0], edgecolors='k')\r\nax[1].view_init(elev=28, azim=45)\r\n# ax[1].add_artist(FancyArrow(0, 0, 0, 1, 1, 1)))\r\nax[1].add_artist(Arrow3D((0, 1), (0, 1), (0, 1), mutation_scale=50))\r\n\r\nplt.show()\r\n```\r\n\r\n\r\n\n\n### Proposed solution\n\n_No response_","author":{"url":"https://github.com/patquem","@type":"Person","name":"patquem"},"datePublished":"2022-02-28T10:33:00.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/22571/matplotlib/issues/22571"}
| 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:e0cfb19c-98cb-40cd-002c-df4c9dad41e3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 95A6:2677B0:1CBDFB:269C70:6A5286D8 |
| html-safe-nonce | 7f6519f91da483317a812a7e37ebce1a47b0f72da845a0274ecb76f1c8c8f46f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NUE2OjI2NzdCMDoxQ0JERkI6MjY5QzcwOjZBNTI4NkQ4IiwidmlzaXRvcl9pZCI6IjkzNTU1NTUwNTA1MjYxNjQwOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 510d51ca45ca60b3b53b7f66feb37d0feb905541ba7920855b9d028d070bbd49 |
| hovercard-subject-tag | issue:1153920703 |
| 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/22571/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5a80b5a40f91f1ce5bcf379bc7fcaa1ec590af6ad1d29299966e4e8b7d2b6f86/matplotlib/matplotlib/issues/22571 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5a80b5a40f91f1ce5bcf379bc7fcaa1ec590af6ad1d29299966e4e8b7d2b6f86/matplotlib/matplotlib/issues/22571 |
| og:image:alt | Problem Hello, FancyArrow can not be used in 3D. Some proposals (#21688) consists in creating a new class. Could it be possible: to extend FancyArrow to 3D (as for quiver) to solve -if possible- th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | patquem |
| 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 | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width