Title: Raise a clear error when grouped_bar gets singular label/color (#30739) by Kundhan73 · Pull Request #32006 · matplotlib/matplotlib · GitHub
Open Graph Title: Raise a clear error when grouped_bar gets singular label/color (#30739) by Kundhan73 · Pull Request #32006 · matplotlib/matplotlib
X Title: Raise a clear error when grouped_bar gets singular label/color (#30739) by Kundhan73 · Pull Request #32006 · matplotlib/matplotlib
Description: Closes #30739. Axes.grouped_bar passes each dataset's label and color to bar() itself and also forwards **kwargs. If a caller passes a singular label=/color= (they land in kwargs), bar() receives the keyword twice and raises an opaque TypeError: ...bar() got multiple values for keyword argument 'label'. This adds an early guard in grouped_bar that raises a clear TypeError pointing the user to the plural labels/colors parameters, plus a parametrized test. Open question: the reporter expected label="dataset" to work (i.e. alias singular → plural). I went with a clear error since a single label/color is ambiguous across N datasets and contradicts the documented plural API — happy to change to aliasing if you prefer. No changelog entry added since grouped_bar is provisional and 3.11 is unreleased; let me know if you'd like one.
Open Graph Description: Closes #30739. Axes.grouped_bar passes each dataset's label and color to bar() itself and also forwards **kwargs. If a caller passes a singular label=/color= (they land in kwargs), bar() receiv...
X Description: Closes #30739. Axes.grouped_bar passes each dataset's label and color to bar() itself and also forwards **kwargs. If a caller passes a singular label=/color= (they land in kwargs), bar() re...
Opengraph URL: https://github.com/matplotlib/matplotlib/pull/32006
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:6b45c38a-100b-6f99-0a32-2cab707010bb |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 8504:1FA07A:1D19C1B:27BC6BE:6A540A28 |
| html-safe-nonce | 0d05e63bc20f1880f5fe80c828c390d2e3593cceafd180d9d2a2189c8023befa |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NTA0OjFGQTA3QToxRDE5QzFCOjI3QkM2QkU6NkE1NDBBMjgiLCJ2aXNpdG9yX2lkIjoiODYzNzUxOTM4Njg1OTgwMTEyOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 9ebc15fd40fae08a8d5ce7554094c6427f054d34d474a8588aeefabbd9c0ff97 |
| hovercard-subject-tag | pull_request:4004467730 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/matplotlib/matplotlib/pull/32006/files |
| twitter:image | https://avatars.githubusercontent.com/u/88417719?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/88417719?s=400&v=4 |
| og:image:alt | Closes #30739. Axes.grouped_bar passes each dataset's label and color to bar() itself and also forwards **kwargs. If a caller passes a singular label=/color= (they land in kwargs), bar() receiv... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width