Title: [Bug]: set linestyle='dashed' raise error with quiver and legend · Issue #28298 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: set linestyle='dashed' raise error with quiver and legend · Issue #28298 · matplotlib/matplotlib
X Title: [Bug]: set linestyle='dashed' raise error with quiver and legend · Issue #28298 · matplotlib/matplotlib
Description: Bug summary Issue description: I am trying to print the linear arrow with dashed style, but there is error waring "ValueError: At least one value in the dash list must be positive" Code: Part Code like following plt.quiver(0, 0, v1[0], v...
Open Graph Description: Bug summary Issue description: I am trying to print the linear arrow with dashed style, but there is error waring "ValueError: At least one value in the dash list must be positive" Code: Part Code ...
X Description: Bug summary Issue description: I am trying to print the linear arrow with dashed style, but there is error waring "ValueError: At least one value in the dash list must be positive" Code: ...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/28298
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: set linestyle='dashed' raise error with quiver and legend","articleBody":"### Bug summary\n\nIssue description:\r\nI am trying to print the linear arrow with dashed style, but there is error waring \r\n\"ValueError: At least one value in the dash list must be positive\"\r\n\r\nCode: \r\nPart Code like following\r\nplt.quiver(0, 0, v1[0], v1[1], angles='xy', scale_units='xy', scale=1, color='r', label='v1 (3, 4)', linestyle='solid')\r\nplt.quiver(0, 0, v2[0], v2[1], angles='xy', scale_units='xy', scale=1, color='b', label='v2 (4, -3)', linestyle='solid')\r\nv_sum = v1 + v2\r\nplt.quiver(0, 0, v_sum[0], v_sum[1], angles='xy', scale_units='xy', scale=1, color='g', linestyle='dashed', linewidth=0, label='v1 + v2')\r\n\r\n#I searched similar issue ticket: https://github.com/matplotlib/matplotlib/issues/8821 to set lw=0, it's still not work\r\n\r\nenviroment:\r\nmy python version: Python 3.12.3\r\nmatplotlib version: 3.9.0\r\n\n\n### Code for reproduction\n\n```Python\nplt.quiver(0, 0, v1[0], v1[1], angles='xy', scale_units='xy', scale=1, color='r', label='v1 (3, 4)', linestyle='solid')\r\nplt.quiver(0, 0, v2[0], v2[1], angles='xy', scale_units='xy', scale=1, color='b', label='v2 (4, -3)', linestyle='solid')\r\nv_sum = v1 + v2\r\nplt.quiver(0, 0, v_sum[0], v_sum[1], angles='xy', scale_units='xy', scale=1, color='g', linestyle='dashed', linewidth=0, label='v1 + v2')\n```\n\n\n### Actual outcome\n\nThere is empty present \r\n\r\n\r\n\r\n(mathenv) C:\\WorkSpace\\math\u003ec:/WorkSpace/math/mathenv/Scripts/python.exe c:/WorkSpace/math/linearAnalog.py\r\nException in Tkinter callback\r\nTraceback (most recent call last):\r\n File \"C:\\Python312\\Lib\\tkinter\\__init__.py\", line 1967, in __call__\r\n return self.func(*args)\r\n ^^^^^^^^^^^^^^^^\r\n File \"C:\\Python312\\Lib\\tkinter\\__init__.py\", line 861, in callit\r\n func(*args)\r\n File \"c:\\WorkSpace\\math\\mathenv\\Lib\\site-packages\\matplotlib\\backends\\_backend_tk.py\", line 271, in idle_draw\r\n self.draw()\r\n File \"c:\\WorkSpace\\math\\mathenv\\Lib\\site-packages\\matplotlib\\backends\\backend_tkagg.py\", line 10, in draw\r\n super().draw()\r\n File \"c:\\WorkSpace\\math\\mathenv\\Lib\\site-packages\\matplotlib\\backends\\backend_agg.py\", line 387, in draw\r\n self.figure.draw(self.renderer)\r\n File \"c:\\WorkSpace\\math\\mathenv\\Lib\\site-packages\\matplotlib\\artist.py\", line 95, in draw_wrapper\r\n result = draw(artist, renderer, *args, **kwargs)\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"c:\\WorkSpace\\math\\mathenv\\Lib\\site-packages\\matplotlib\\artist.py\", line 72, in draw_wrapper\r\n return draw(artist, renderer)\r\n ^^^^^^^^^^^^^^^^^^^^^^\r\n File \"c:\\WorkSpace\\math\\mathenv\\Lib\\site-packages\\matplotlib\\figure.py\", line 3155, in draw\r\n mimage._draw_list_compositing_images(\r\n File \"c:\\WorkSpace\\math\\mathenv\\Lib\\site-packages\\matplotlib\\image.py\", line 132, in _draw_list_compositing_images\r\n a.draw(renderer)\r\n File \"c:\\WorkSpace\\math\\mathenv\\Lib\\site-packages\\matplotlib\\artist.py\", line 72, in draw_wrapper\r\n return draw(artist, renderer)\r\n ^^^^^^^^^^^^^^^^^^^^^^\r\n File \"c:\\WorkSpace\\math\\mathenv\\Lib\\site-packages\\matplotlib\\axes\\_base.py\", line 3109, in draw\r\n mimage._draw_list_compositing_images(\r\n File \"c:\\WorkSpace\\math\\mathenv\\Lib\\site-packages\\matplotlib\\image.py\", line 132, in _draw_list_compositing_images\r\n a.draw(renderer)\r\n File \"c:\\WorkSpace\\math\\mathenv\\Lib\\site-packages\\matplotlib\\artist.py\", line 72, in draw_wrapper\r\n return draw(artist, renderer)\r\n ^^^^^^^^^^^^^^^^^^^^^^\r\n File \"c:\\WorkSpace\\math\\mathenv\\Lib\\site-packages\\matplotlib\\legend.py\", line 777, in draw\r\n self._legend_box.draw(renderer)\r\n File \"c:\\WorkSpace\\math\\mathenv\\Lib\\site-packages\\matplotlib\\artist.py\", line 39, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"c:\\WorkSpace\\math\\mathenv\\Lib\\site-packages\\matplotlib\\offsetbox.py\", line 383, in draw\r\n c.draw(renderer)\r\n File \"c:\\WorkSpace\\math\\mathenv\\Lib\\site-packages\\matplotlib\\artist.py\", line 39, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"c:\\WorkSpace\\math\\mathenv\\Lib\\site-packages\\matplotlib\\offsetbox.py\", line 383, in draw\r\n c.draw(renderer)\r\n File \"c:\\WorkSpace\\math\\mathenv\\Lib\\site-packages\\matplotlib\\artist.py\", line 39, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"c:\\WorkSpace\\math\\mathenv\\Lib\\site-packages\\matplotlib\\offsetbox.py\", line 383, in draw\r\n c.draw(renderer)\r\n File \"c:\\WorkSpace\\math\\mathenv\\Lib\\site-packages\\matplotlib\\artist.py\", line 39, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"c:\\WorkSpace\\math\\mathenv\\Lib\\site-packages\\matplotlib\\offsetbox.py\", line 383, in draw\r\n c.draw(renderer)\r\n File \"c:\\WorkSpace\\math\\mathenv\\Lib\\site-packages\\matplotlib\\artist.py\", line 39, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"c:\\WorkSpace\\math\\mathenv\\Lib\\site-packages\\matplotlib\\offsetbox.py\", line 669, in draw\r\n c.draw(renderer)\r\n File \"c:\\WorkSpace\\math\\mathenv\\Lib\\site-packages\\matplotlib\\artist.py\", line 72, in draw_wrapper\r\n return draw(artist, renderer)\r\n ^^^^^^^^^^^^^^^^^^^^^^\r\n File \"c:\\WorkSpace\\math\\mathenv\\Lib\\site-packages\\matplotlib\\patches.py\", line 632, in draw\r\n self._draw_paths_with_artist_properties(\r\n File \"c:\\WorkSpace\\math\\mathenv\\Lib\\site-packages\\matplotlib\\patches.py\", line 594, in _draw_paths_with_artist_properties\r\n gc.set_dashes(*self._dash_pattern)\r\n File \"c:\\WorkSpace\\math\\mathenv\\Lib\\site-packages\\matplotlib\\backend_bases.py\", line 924, in set_dashes\r\n raise ValueError(\r\nValueError: At least one value in the dash list must be positive\n\n### Expected outcome\n\nExpect the plt.quiver can print a dash arrow for the sum of two linear array\n\n### Additional information\n\n_No response_\n\n### Operating system\n\n_No response_\n\n### Matplotlib Version\n\n3.9.0\n\n### Matplotlib Backend\n\n_No response_\n\n### Python version\n\n_No response_\n\n### Jupyter version\n\n_No response_\n\n### Installation\n\nNone","author":{"url":"https://github.com/quzhijing","@type":"Person","name":"quzhijing"},"datePublished":"2024-05-25T17:41:48.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":8},"url":"https://github.com/28298/matplotlib/issues/28298"}
| 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:151e201a-7045-843f-6632-03f4afcca110 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 918C:3EE845:4550CC4:5FA8B3C:6A4F51EA |
| html-safe-nonce | 6fc68e7944824bc56df890346cebdcd7fb15deec28f237d9b95c7a4b22299859 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MThDOjNFRTg0NTo0NTUwQ0M0OjVGQThCM0M6NkE0RjUxRUEiLCJ2aXNpdG9yX2lkIjoiMTA3Njk4MzY5NzE2MzM3NTA4MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 837e09a026b9053a9a43b2aae1677188d57db24b01ff4541e0e679be7b14ef57 |
| hovercard-subject-tag | issue:2317152278 |
| 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/28298/issue_layout |
| twitter:image | https://opengraph.githubassets.com/81544e72f6251784a22bd5329e218432db9899d954cf8175c80997454c280faa/matplotlib/matplotlib/issues/28298 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/81544e72f6251784a22bd5329e218432db9899d954cf8175c80997454c280faa/matplotlib/matplotlib/issues/28298 |
| og:image:alt | Bug summary Issue description: I am trying to print the linear arrow with dashed style, but there is error waring "ValueError: At least one value in the dash list must be positive" Code: Part Code ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | quzhijing |
| hostname | github.com |
| expected-hostname | github.com |
| None | b92d11c0aa4a77d54ef4af1078b6a15fb5a70a215b30c4ecf28889d5a8e656d9 |
| 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 | 4b249b445842943ed31549e027f57a8ade9881ed |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width