Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

null values reset stacking in express barchart #5324

Open
Labels
P2considered for next cycle bugsomething broken
@bhogan-mitre

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:

Image

Based on input data:

Image

Note that South Korea should be stacked to a total of 35 and not 24.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2considered for next cycle bugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /