Title: `stairs` with dashed linestyle and fill=True raises ValueError · Issue #31302 · matplotlib/matplotlib · GitHub
Open Graph Title: `stairs` with dashed linestyle and fill=True raises ValueError · Issue #31302 · matplotlib/matplotlib
X Title: `stairs` with dashed linestyle and fill=True raises ValueError · Issue #31302 · matplotlib/matplotlib
Description: If you change test_stairs_options to mpl20 style, then it crashes. What we have worked out is that it is due to artist "G", which sets ls='--', fill=True, but does not set a linewidth. The setup for stairs sets a default linewidth=0 if f...
Open Graph Description: If you change test_stairs_options to mpl20 style, then it crashes. What we have worked out is that it is due to artist "G", which sets ls='--', fill=True, but does not set a linewidth. The setup fo...
X Description: If you change test_stairs_options to mpl20 style, then it crashes. What we have worked out is that it is due to artist "G", which sets ls='--', fill=True, but does not set a linew...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/31302
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`stairs` with dashed linestyle and fill=True raises ValueError","articleBody":"If you change `test_stairs_options` to `mpl20` style, then it crashes. What we have worked out is that it is due to artist \"G\", which sets `ls='--', fill=True`, but does _not_ set a `linewidth`.\n\nThe setup for `stairs` sets a default `linewidth=0` if `fill=True`. The difference between classic and mpl20 styles is that the latter performs `linewidth`-scaling on the `linestyle`. So in mpl20 style, the dashes are scaled to 0, which raises in the backend.\n\n\u003e ```\n\u003e __________________ test_stairs_options[png] ___________________\n\u003e \n\u003e args = (), kwds = {'extension': 'png', 'request': \u003cFixtureRequest for \u003cFunction test_stairs_options[png]\u003e\u003e}\n\u003e \n\u003e @wraps(func)\n\u003e def inner(*args, **kwds):\n\u003e with self._recreate_cm():\n\u003e return func(*args, **kwds)\n\u003e \n\u003e /usr/lib64/python3.13/contextlib.py:85: \n\u003e _ _ _ _ _ _ _ _ _ _ _ _\n\u003e lib/matplotlib/figure.py:3508: in savefig\n\u003e self.canvas.print_figure(fname, **kwargs)\n\u003e lib/matplotlib/backend_bases.py:2275: in print_figure\n\u003e result = print_method(\n\u003e lib/matplotlib/backend_bases.py:2132: in \u003clambda\u003e\n\u003e print_method = functools.wraps(meth)(lambda *args, **kwargs: meth(\n\u003e lib/matplotlib/backends/backend_agg.py:539: in print_png\n\u003e self._print_pil(filename_or_obj, \"png\", pil_kwargs, metadata)\n\u003e lib/matplotlib/backends/backend_agg.py:487: in _print_pil\n\u003e FigureCanvasAgg.draw(self)\n\u003e lib/matplotlib/backends/backend_agg.py:440: in draw\n\u003e self.figure.draw(self.renderer)\n\u003e lib/matplotlib/artist.py:94: in draw_wrapper\n\u003e result = draw(artist, renderer, *args, **kwargs)\n\u003e lib/matplotlib/artist.py:71: in draw_wrapper\n\u003e return draw(artist, renderer)\n\u003e lib/matplotlib/figure.py:3275: in draw\n\u003e mimage._draw_list_compositing_images(\n\u003e lib/matplotlib/image.py:133: in _draw_list_compositing_images\n\u003e a.draw(renderer)\n\u003e lib/matplotlib/artist.py:71: in draw_wrapper\n\u003e return draw(artist, renderer)\n\u003e lib/matplotlib/axes/_base.py:3282: in draw\n\u003e mimage._draw_list_compositing_images(\n\u003e lib/matplotlib/image.py:133: in _draw_list_compositing_images\n\u003e a.draw(renderer)\n\u003e lib/matplotlib/artist.py:71: in draw_wrapper\n\u003e return draw(artist, renderer)\n\u003e lib/matplotlib/patches.py:740: in draw\n\u003e self._draw_paths_with_artist_properties(\n\u003e lib/matplotlib/patches.py:723: in _draw_paths_with_artist_properties\n\u003e gc.set_dashes(*self._dash_pattern)\n\u003e _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\n\u003e \n\u003e self = \u003cmatplotlib.backend_bases.GraphicsContextBase object at 0x7f3016ba3750\u003e, dash_offset = 0.0, dash_list = [0.0, 0.0]\n\u003e \n\u003e def set_dashes(self, dash_offset, dash_list):\n\u003e \"\"\"\n\u003e Set the dash style for the gc.\n\u003e \n\u003e Parameters\n\u003e ----------\n\u003e dash_offset : float\n\u003e Distance, in points, into the dash pattern at which to\n\u003e start the pattern. It is usually set to 0.\n\u003e dash_list : array-like or None\n\u003e The on-off sequence as points. None specifies a solid line. All\n\u003e values must otherwise be non-negative (:math:`\\\\ge 0`).\n\u003e \n\u003e Notes\n\u003e -----\n\u003e See p. 666 of the PostScript\n\u003e `Language Reference\n\u003e \u003chttps://www.adobe.com/jp/print/postscript/pdfs/PLRM.pdf\u003e`_\n\u003e for more info.\n\u003e \"\"\"\n\u003e if dash_list is not None:\n\u003e dl = np.asarray(dash_list)\n\u003e if np.any(dl \u003c 0.0):\n\u003e raise ValueError(\n\u003e \"All values in the dash list must be non-negative\")\n\u003e if dl.size and not np.any(dl \u003e 0.0):\n\u003e raise ValueError(\n\u003e 'At least one value in the dash list must be positive')\n\u003e E ValueError: At least one value in the dash list must be positive\n\u003e \n\u003e lib/matplotlib/backend_bases.py:897: ValueError\n\u003e ``` \n\n _Originally posted by @QuLogic in [#31300](https://github.com/matplotlib/matplotlib/pull/31300/changes/d1d3d894a39e79b6d740a6586909714cd68fc3ef#r2932743766)_","author":{"url":"https://github.com/QuLogic","@type":"Person","name":"QuLogic"},"datePublished":"2026-03-13T20:02:21.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/31302/matplotlib/issues/31302"}
| 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:374cee64-7a6e-9047-990a-9bb107bb427b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E2D0:2162D1:2328761:3134FAE:6A50BF8B |
| html-safe-nonce | 0bdf601198b593253d229f8a2683acc474e777e847c503bad56abddbbafc8872 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMkQwOjIxNjJEMToyMzI4NzYxOjMxMzRGQUU6NkE1MEJGOEIiLCJ2aXNpdG9yX2lkIjoiODM1OTkyMTAwODk3NTU5MzM1NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2535aecf7710d6b0871539f2850df308c8553fe5044dde9572f7712c99f25ca5 |
| hovercard-subject-tag | issue:4073147474 |
| 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/31302/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ca7998be0caa20b4f7946567900c57794e4da85fb02d56a6809f1d7366b63761/matplotlib/matplotlib/issues/31302 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ca7998be0caa20b4f7946567900c57794e4da85fb02d56a6809f1d7366b63761/matplotlib/matplotlib/issues/31302 |
| og:image:alt | If you change test_stairs_options to mpl20 style, then it crashes. What we have worked out is that it is due to artist "G", which sets ls='--', fill=True, but does not set a linewidth. The setup fo... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | QuLogic |
| hostname | github.com |
| expected-hostname | github.com |
| None | 72b13e0e8d0319acdd27a145cfe73f4f06c791713d0ac4690e41fb68ad28cac0 |
| 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 | 08e79d53fc070870d5b168356afebb1e286a2ffe |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width