Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
Fix grouped_bar: legend labels, colors, and hatch handling#30768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Fix grouped_bar: legend labels, colors, and hatch handling#30768
Conversation
Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
timhoffm left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This PR is not properly scoped. It contains the commits from your separate PR on hatch handling, which has nothing to do with#30739.
Please take more care when creating PRs.
ilakkmanoharan commentedNov 20, 2025
Thank you for the feedback, Tim This PR includes the commits from the hatch-handling PR because the fix also needs to incorporate hatch behavior, just like it does for label and color. Since those hatch-related updates are not yet in main, the work for this issue had to be built on top of that PR. Once the hatch-handling PR is merged, this PR will show only the intended diff. |
timhoffm commentedNov 21, 2025
Thanks for the clarification. For the future, please note such an aspect in the PR message. It's an important piece of information for reviewers. |
PR summary
This pull request fixes issues with the grouped_bar method in Axes related to legend labels, bar colors, and hatch patterns.
Why is this change necessary?
Previously, single labels passed to grouped_bar were not applied to all bars, resulting in empty legends. Additionally, color and hatch patterns were not consistently applied across all grouped bars, and passing label and color twice could cause a TypeError.
What problem does it solve?
Ensures that a single label string propagates to all datasets.
Correctly applies colors and hatch patterns for each bar.
Prevents TypeError when labels or colors are passed multiple times.
Updates tests to verify proper handling of single and multiple labels.
What is the reasoning for this implementation?
By expanding single labels to a list internally and correctly mapping colors and hatches to each dataset, we preserve intuitive usage of grouped_bar and maintain correct legend, color, and hatch behavior without changing the API.
Example usage:
PR checklist
closes [Bug]: grouped_bar can pass label and color twice, causing TypeError#30739