Title: [Bug]: violinplot crashes on empty datasets · Issue #31700 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: violinplot crashes on empty datasets · Issue #31700 · matplotlib/matplotlib
X Title: [Bug]: violinplot crashes on empty datasets · Issue #31700 · matplotlib/matplotlib
Description: Bug summary When one of the datasets passed to boxplot is empty, no boxplot is drawn for that dataset. When the same is done for violinplot, violinplot crashes; instead it would be convenient if it behaved like boxplot (draw nothing for ...
Open Graph Description: Bug summary When one of the datasets passed to boxplot is empty, no boxplot is drawn for that dataset. When the same is done for violinplot, violinplot crashes; instead it would be convenient if it...
X Description: Bug summary When one of the datasets passed to boxplot is empty, no boxplot is drawn for that dataset. When the same is done for violinplot, violinplot crashes; instead it would be convenient if it...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/31700
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: violinplot crashes on empty datasets","articleBody":"### Bug summary\n\nWhen one of the datasets passed to boxplot is empty, no boxplot is drawn for that dataset. When the same is done for violinplot, violinplot crashes; instead it would be convenient if it behaved like boxplot (draw nothing for the empty dataset).\n\n### Code for reproduction\n\n```Python\nplt.boxplot([np.random.randn(sz) for sz in [100, 0, 200]]) # ok\nplt.violinplot([np.random.randn(sz) for sz in [100, 0, 200]]) # crashes\n```\n\n### Actual outcome\n\nSecond line crashes with\n```\nValueError: zero-size array to reduction operation minimum which has no identity\n```\n\n### Expected outcome\n\nEmpty violinplot for the second (empty) dataset.\n\n### Additional information\n\n_No response_\n\n### Operating system\n\nmacOS\n\n### Matplotlib Version\n\n3.12.0.dev68+g1cb6fe289\n\n### Matplotlib Backend\n\nany\n\n### Python version\n\n3.14.0\n\n### Jupyter version\n\nENOSUCHLIB\n\n### Installation\n\ngit checkout","author":{"url":"https://github.com/anntzer","@type":"Person","name":"anntzer"},"datePublished":"2026-05-18T10:52:40.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/31700/matplotlib/issues/31700"}
| 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:3500d1e0-d976-fbbc-3368-e101935cad72 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9748:111866:17CD8AE:1F49A8F:6A51C524 |
| html-safe-nonce | 0cc53934c80b13c77f7450aa99f1fe783507f4a9dd4bfb804d91cb7c9fcb2b38 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NzQ4OjExMTg2NjoxN0NEOEFFOjFGNDlBOEY6NkE1MUM1MjQiLCJ2aXNpdG9yX2lkIjoiMzY1OTA2NzA0NTY2Njk5NzU0MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 4d7b4c8d6bdbe27f4fae15925fa586ab087486e154c40490ef657e969f5401c9 |
| hovercard-subject-tag | issue:4468473077 |
| 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/31700/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0709f87327ca9fdf7d5fc9ee85dbc3ec9b10e6dc5183e914f00622890b02b932/matplotlib/matplotlib/issues/31700 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0709f87327ca9fdf7d5fc9ee85dbc3ec9b10e6dc5183e914f00622890b02b932/matplotlib/matplotlib/issues/31700 |
| og:image:alt | Bug summary When one of the datasets passed to boxplot is empty, no boxplot is drawn for that dataset. When the same is done for violinplot, violinplot crashes; instead it would be convenient if it... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | anntzer |
| 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 | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width