ENH: Add broadcasted hatch to grouped_bar - #30683
Closed
ilakkmanoharan wants to merge 19 commits into
Closed
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR summary
Closes #30673
Why is this change necessary?
Currently,
Axes.grouped_barsupports color broadcasting (one color per dataset) but not hatch broadcasting.Adding support for broadcasted
hatchvalues improves group distinction and makesgrouped_barconsistent with other multi-dataset plotting APIs such ashist.What problem does it solve?
Without this feature, all grouped bars share the same hatch pattern, reducing visual clarity when color is insufficient or unavailable (e.g., grayscale printing).
This PR allows one hatch per dataset, improving accessibility and plot readability.
What is the reasoning for this implementation?
The design mirrors existing color broadcasting:
This follows Matplotlib’s API design for argument broadcasting and maintains parity with other plotting functions.
Summary of changes
hatchparameter toAxes.grouped_bar.str | Sequence[str] | Noneinput types._axes.pyitype stub for the new argument.test_grouped_bar_hatch.pyto cover:ValueError).grouped_bardocstring to include hatch broadcasting.Example