plotly / plotly/plotly.py

ecdf with normed histogram

Open
#4,772 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature P3
Dominant language
Python
Stars
18.8k
Forks
2.8k
Avg merge
16h 26m
Merged PRs (30d)
21

Description

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()

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the px.ecdf entry point and compare how marginal='histogram' is configured with histnorm in px.histogram. Determine whether normalized marginal bins or percentage hover information is the intended behavior, then verify the result with the provided NumPy and pandas example; done means the ECDF histogram marginal can represent percentages without manual subplots.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, pandas, plotly, python
Domain
data-visualization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.