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:4440d54c-e136-2394-2e53-ff8bae9e4dda |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DBDA:FB8AB:B87BDF:FB2276:6A516382 |
| html-safe-nonce | 4e736131868a1fdbdcb23f96f2b9b44a102817318c5dd63fb126739f78b6f85c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQkRBOkZCOEFCOkI4N0JERjpGQjIyNzY6NkE1MTYzODIiLCJ2aXNpdG9yX2lkIjoiNDkyMTQ0NDEzMzk1NTAwMzI2NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 8ad1f569b70f265fcd29a24d5199b08fc2ca22bdb9610760ad7ccf44aca2e348 |
| 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 | 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 | 2eeb434949a926fad21064b4d395a54759f7a0b2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width