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

Set barmode="overlay" in histograms by default to avoid misunderstandings #4893

Open
pierre-eliep-met opened this issue Nov 20, 2024 · 1 comment
Labels
bug something broken P3 backlog

Comments

@pierre-eliep-met
Copy link

Reopening of #1865, as asked in the comment.

By default, histograms are not overlayed, which leads to misinterpretation :

import numpy as np
import pandas as pd
import plotly.express as px

x0 = np.random.randn(250)
# Add 1 to shift the mean of the Gaussian distribution
x1 = np.random.randn(250) + 1

df = pd.DataFrame(dict(
    series=np.concatenate((["a"] * len(x0), ["b"] * len(x1))), 
    data=np.concatenate((x0, x1))
))

px.histogram(df, x="data", color="series")

Makes think that there is much more points in red distribution :
Image

While overlying clearly shows that it is just shifted

px.histogram(df, x="data", color="series", barmode="overlay")

Image

This leads to misunderstanding the data shape.

@gvwilson gvwilson added bug something broken P3 backlog labels Nov 26, 2024
@gvwilson
Copy link
Contributor

@archmoj is this a plotly.py issue or should I move it to plotly.js?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken P3 backlog
Projects
None yet
Development

No branches or pull requests

2 participants