Title: [Bug]: agg.path.chunksize leaves gaps in lines at chunk boundaries · Issue #32641 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: agg.path.chunksize leaves gaps in lines at chunk boundaries · Issue #32641 · matplotlib/matplotlib
X Title: [Bug]: agg.path.chunksize leaves gaps in lines at chunk boundaries · Issue #32641 · matplotlib/matplotlib
Description: Bug summary With agg.path.chunksize set, a long line is drawn with a gap at every chunk boundary: two segments are missing each time. The docs say the line is split into several lines of at most chunksize vertices, not that points are dr...
Open Graph Description: Bug summary With agg.path.chunksize set, a long line is drawn with a gap at every chunk boundary: two segments are missing each time. The docs say the line is split into several lines of at most ch...
X Description: Bug summary With agg.path.chunksize set, a long line is drawn with a gap at every chunk boundary: two segments are missing each time. The docs say the line is split into several lines of at most ch...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/32641
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: agg.path.chunksize leaves gaps in lines at chunk boundaries","articleBody":"### Bug summary\n\nWith `agg.path.chunksize` set, a long line is drawn with a gap at every chunk boundary: two segments are missing each time. The docs say the line is split into several lines of at most `chunksize` vertices, not that points are dropped. The rc docs warn about \"minor artifacts\", but I would not expect whole segments to go missing.\n\n### Code for reproduction\n\n```Python\nimport matplotlib as mpl\nimport matplotlib.pyplot as plt\nimport numpy as np\n\n\ndef render(chunksize):\n with mpl.rc_context({\"agg.path.chunksize\": chunksize}):\n fig, ax = plt.subplots()\n x = np.arange(200)\n ax.plot(x, x % 2, lw=1, solid_joinstyle=\"round\", solid_capstyle=\"round\",\n antialiased=False, color=\"k\")\n ax.set_axis_off()\n fig.canvas.draw()\n img = np.asarray(fig.canvas.buffer_rgba()).copy()\n fig.savefig(f\"chunksize_{chunksize}.png\")\n plt.close(fig)\n return img\n\n\nprint(\"pixels differing:\", int((render(0) != render(150)).any(-1).sum()))\n```\n\n### Actual outcome\n\n`pixels differing: 961`. `chunksize_150.png` has a visible gap in the zigzag where the line is split.\n\n\u003cimg width=\"640\" height=\"480\" alt=\"main_chunksize_150\" src=\"https://github.com/user-attachments/assets/882ae171-1f5b-4935-bb1f-73739c6759ad\" />\n\n### Expected outcome\n\nNo gaps. With round caps and joins and antialiasing off, the chunked line should look the same as \n\n\u003cimg width=\"640\" height=\"480\" alt=\"fixed_chunksize_150\" src=\"https://github.com/user-attachments/assets/71f30c12-ce8a-4503-a2de-8a71d9761e45\" />\n\nthe unchunked one (0 pixels differing).\n\n### Additional information\n\nIn `RendererAgg.draw_path` the chunk ends are computed as `i1[:-1] = i0[1:] - 1` and used as an exclusive slice end. So vertex `i0[k+1] - 1` is in no chunk, and the segments on both sides of it are not drawn. Letting consecutive chunks share their boundary vertex fixes it; I can open a PR.\n\nThe same output with the released 3.10.8.\n\n### Operating system\n\nLinux (Ubuntu on WSL2)\n\n### Matplotlib Version\n\n3.12.0.dev943+gc21a3923e\n\n### Matplotlib Backend\n\nagg\n\n### Python version\n\n3.14.10\n\n### Jupyter version\n\n_No response_\n\n### Installation\n\ngit checkout","author":{"url":"https://github.com/yqtian-se","@type":"Person","name":"yqtian-se"},"datePublished":"2026-11-22T12:27:07Z","url":"https://github.com/matplotlib/matplotlib/issues/32641"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:48a81403-08e8-bf8c-ad47-f846cac71812 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D82E:17CA31:E0BF86:12D9F06:6B064EDC |
| html-safe-nonce | d6e528ed1d5c9f8a130e342070338ee77f9056bb9385ac23801eff9bd2da30a5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEODJFOjE3Q0EzMTpFMEJGODY6MTJEOUYwNjo2QjA2NEVEQyIsInZpc2l0b3JfaWQiOiI4MTE5MDk3MjM2MzA4NTEyNDc2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | faa5e35b171373207b8326117f7d62c002ea9def8ff18a354822aee174623a4c |
| hovercard-subject-tag | issue:6542359614 |
| 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/32641/issue_layout |
| twitter:image | https://opengraph.githubassets.com/60c53bae340f81a8dccf9e6687429a5cc9ee79a88572566c2783c4ca9c11bfcb/matplotlib/matplotlib/issues/32641 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/60c53bae340f81a8dccf9e6687429a5cc9ee79a88572566c2783c4ca9c11bfcb/matplotlib/matplotlib/issues/32641 |
| og:image:alt | Bug summary With agg.path.chunksize set, a long line is drawn with a gap at every chunk boundary: two segments are missing each time. The docs say the line is split into several lines of at most ch... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | yqtian-se |
| hostname | github.com |
| expected-hostname | github.com |
| None | 772b6997ca4daa0428dd49a25d76052e765555ae560fe9c88517eb828bbd861e |
| 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 | f1f9a08f7c769a37f1dfc18ad43d463c222a7eea |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width