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

ecdf with normed histogram #4772

Open
luifire opened this issue Sep 30, 2024 · 0 comments
Open

ecdf with normed histogram #4772

luifire opened this issue Sep 30, 2024 · 0 comments
Labels
feature something new P3 not needed for current cycle

Comments

@luifire
Copy link

luifire commented Sep 30, 2024

I really like the plotly.express.ecdf and have been using it a lot in my daily work.
When I show ecdf plots in meetings, I usually show it with marginal='histogram', since this is easier understandable for the non-data-scientists in the room.
However, since the amount of data varies I would like to have a normalized histogram, i.e. have percent values.

I know this would be possible with subplots, but there are really a lot of ugly adjustments to make.
So a solution could be to show the percentage in the hint as well, or something like histnorm from plotly.express.histogram.

Example for easy testing:

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

# Generate random data
np.random.seed(42)  # For reproducibility
data = np.random.normal(loc=0, scale=1, size=1000)  # Normal distribution data

# Create a pandas dataframe
df = pd.DataFrame({'Values': data})

# Create ECDF plot with histogram
fig = px.ecdf(data, 
              ecdfnorm='percent', 
              marginal='histogram')

# Show the figure
fig.show()
@gvwilson gvwilson added feature something new P3 not needed for current cycle labels Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new P3 not needed for current cycle
Projects
None yet
Development

No branches or pull requests

2 participants