Skip to content

[MNT]: DISCUSSION: Should Axes.grouped_bar() enforce hatch list length or allow cycling like colors? #30712

Closed

Description

@ilakkmanoharan

Summary

Should Axes.grouped_bar() enforce the hatch list length to match the number of datasets,
or should it allow automatic cycling, consistent with colors and other style arguments?
If we decide that hatch should enforce length,
should other style arguments (colors, linestyles, markers, etc.)
also be updated in the future for consistency —
or should the broader design direction remain permissive and cycling-based?

Arguments for cycling (current behavior)

Consistency: Aligns with colors, linestyles, and markers, maintaining familiar user expectations.
Flexibility: Shorter lists still produce usable plots without errors.
User-friendly: Avoids unnecessary exceptions in exploratory or educational workflows.
Backward-compatible: Keeps consistent with historical behavior in most Matplotlib APIs.

Arguments for enforcing

Explicitness: Detects mistakes when users intend unique styles per dataset.
Clarity: Prevents silent repetition of hatches that could cause visual confusion.
Predictability: Ensures a clear 1:1 mapping between datasets and style definitions.

Request for feedback
Before finalizing the implementation, feedback is requested on:
Preferred default behavior (cycle vs enforce)
Whether the decision should apply only to hatches or be standardized across all style arguments
Potential implications for the public API and documentation (e.g., user expectations, legend consistency)

Proposed fix

No response

Activity

  1. timhoffm commented on Nov 2, 2025

    @timhoffm
    Member

    @ilakkmanoharan What is the intended scope of this discussion? For a short-term grouped_bar() implementation, I've answered the question already [here](#30683 (comment).

    If you plan on opening the general discussion, please reflect that in title and discussion proposal.

  2. ilakkmanoharan commented on Nov 5, 2025

    @ilakkmanoharan
    ContributorAuthor

    @timhoffm
    I have added '[MNT]: DISCUSSION:' in the title.
    Are you saying this issue should be a feature request?

  3. jklymak commented on Nov 5, 2025

    @jklymak
    Member

    Let's close this. Please discuss in the comments on the PR.

  4. timhoffm commented on Nov 5, 2025

    @timhoffm
    Member

    @ilakkmanoharan no you are missing the point: If you want to discuss hatching specific to grouped_bar in your PR, do so there (but I've already given the answer there). If you want to start a general discussion on enforcing length checks of parameter lists, that's a discussion for a dedicated issue, but then indidcate that it's a general topic, and certainly neither grouped_bar() no hatch should be in focus / in the title. They are merely on of many applications of the pattern.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions