Skip to content

Bug: express bar chart with facet_col and color. It show wrong chart when clicking legend  #5387

@pondhsiao

Description

@pondhsiao

Example:

import pandas as pd
import plotly.express as px
data = {
'Category': ['A', 'B', 'A', 'A', 'B', 'A'],
'Date': ['2025-10-11', '2025-10-11', '2025-10-12', '2025-10-13', '2025-10-13', '2025-10-13'],
'Value': [10, 15, 12, 8, 20, 5],
'Group': ['X', 'X', 'Y', 'Y', 'X', 'Y']
}
df = pd.DataFrame(data)
fig = px.bar(df, x='Date', y='Value',color='Category', facet_col="Group")
fig.show()
Image
When click legend Category B to keep Category A only. It's gone for Group=X

Image

Workaround
for trace in fig.data:
trace.width=8200000

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