Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Allow specifying category order for legends in stacked bar plots #121

Description

@alecfwilson

I'd like to be able to set the order in which the items in color stack. For example, I'd like to make Sun the top value of this plot:

tips = px.data.tips()

fig = px.bar(
    tips,
    x="sex",
    y="total_bill",
    color="day",
    category_orders={
        "day": [
            "Mon",
            "Tue",
            "Wed",
            "Thu",
            "Fri",
            "Sat",
            "Sun"
        ]
    },
)
fig

but it returns:
image

I thought category_order would handle this, but it does not.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions