Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grouped Stacked Bar Chart - offsetgroup not being respected #5100

Open
Mad-Mint opened this issue Mar 19, 2025 · 1 comment
Open

Grouped Stacked Bar Chart - offsetgroup not being respected #5100

Mad-Mint opened this issue Mar 19, 2025 · 1 comment
Labels
bug something broken P2 considered for next cycle

Comments

@Mad-Mint
Copy link

Hello, I was trying to make a grouped stack bar chart with plotly 6.0.0 and 6.0.1 and both fail to respect offsetgroup. Running the example in the documentation does not yield the documentation's result.

import plotly.graph_objects as go

data = [
    go.Bar(
        x=['Q1', 'Q2', 'Q3', 'Q4'],
        y=[150, 200, 250, 300],
        name='New York',
        offsetgroup="USA"
    ),
    go.Bar(
        x=['Q1', 'Q2', 'Q3', 'Q4'],
        y=[180, 220, 270, 320],
        name='Boston',
        offsetgroup="USA"
    ),
    go.Bar(
        x=['Q1', 'Q2', 'Q3', 'Q4'],
        y=[130, 170, 210, 260],
        name='Montreal',
        offsetgroup="Canada"
    ),
    go.Bar(
        x=['Q1', 'Q2', 'Q3', 'Q4'],
        y=[160, 210, 260, 310],
        name='Toronto',
        offsetgroup="Canada"
    )
]

layout = go.Layout(
    title={
        'text': 'Quarterly Sales by City, Grouped by Country'
    },
    xaxis={
        'title': {
            'text': 'Quarter'
        }
    },
    yaxis={
        'title': {
            'text': 'Sales'
        }
    },
    barmode='stack'
)

fig = go.Figure(data=data, layout=layout)

fig.show()

Output:
Image

Expected Output:
Image

It looks like they are using different plotly.js versions but I can not find out how to update the plotly.js version to v3 with the python package

@gvwilson
Copy link
Contributor

Hi @Mad-Mint - the plotly.js versioning should happen automatically. Can you please post this in https://community.plotly.com/ ? Tech support questions usually get a faster answer there. Thanks - @gvwilson

@gvwilson gvwilson added bug something broken P2 considered for next cycle labels Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken P2 considered for next cycle
Projects
None yet
Development

No branches or pull requests

2 participants