category_order is not working after using facet plots
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 18.8k
- Forks
- 2.8k
- Avg merge
- 16h 26m
- Merged PRs (30d)
- 21
Description
Hi, I don't know why but the update_yaxes with category_orders as parameters is not working after using the facet_col parameters in the plotly express bar plots.
px.bar(pe_final, x='Count', y='index',
color='Count', color_continuous_scale=px.colors.sequential.dense,
orientation='h',
text=pe_final['Count'].astype('str') + '<br>'+pe_final['Perc'].astype('str')).update_yaxes(categoryorder="total ascending")

This is when not using the facet col
px.bar(pe_final, x='Count', y='index',
facet_col='Type',
color='Count', color_continuous_scale=px.colors.sequential.dense,
orientation='h',
text=pe_final['Count'].astype('str') + '<br>'+pe_final['Perc'].astype('str')).update_yaxes(categoryorder="total ascending")

This is when using the facet col, and my category orders did not work.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the two Plotly Express bar-plot examples, comparing behavior with and without facet_col='Type' and categoryorder='total ascending'. Start by tracing the update_yaxes category-order handling for faceted figures and add a regression test for the shown case. Done means the faceted plot applies the requested category order consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100