null values reset stacking in express barchart
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 18.8k
- Forks
- 2.8k
- Avg merge
- 16h 26m
- Merged PRs (30d)
- 21
Description
It seems like null values in the middle of a series reset the stacking so that the next value starts at zero. I tried it upstream in a JS codepen and it is handled okay there, so I believe it is an issue with the python API or possibly with plotly.express.
Reprex modified from https://plotly.com/python/bar-charts/#bar-charts-with-text
import plotly.express as px
wide_df = px.data.medals_wide()
# set null value in middle 'silver' series
wide_df.iloc[0,2] = None
fig = px.bar(
wide_df,
x="nation",
y=["gold", "silver", "bronze"],
title="Nulls Reset Stacking",
text_auto=True)
fig.show()
Output:
Based on input data:
Note that South Korea should be stacked to a total of 35 and not 24.
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
Start with the plotly.express.bar call in the supplied reproducer and compare its null-handling with the upstream JavaScript behavior referenced in the issue. Recreate the example using the medals_wide data and verify that South Korea's following bar remains stacked to a total of 35 rather than restarting at zero.
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
- 52/100