px.ecdf // x_log leads to shifted marginal histogram
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 18.8k
- Forks
- 2.8k
- Avg merge
- 16h 26m
- Merged PRs (30d)
- 21
Description
When trying to display a marginal histogram combined with log_x = true, the histogram does not seem to get placed correclty.
Minimal reproducible example (plotly 5.4.0):
import plotly.express as px
import pandas as pd
import numpy as np
df = pd.DataFrame({'data': np.random.randn(10000)+8})
fig = px.ecdf(df, x='data', marginal='histogram', log_x=True)
fig.show()
I expect the histogram's median at 8 (normal distribution with offset of 8), but it is placed somewhere at more than 11. The actual ecdf is displayed correctly. With log_x = False, both the histogram and the ecdf are displayed correctly.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the minimal px.ecdf example from the issue and inspect the marginal histogram handling when log_x=True. Trace the ECDF and histogram placement paths, then add a regression test showing that the histogram median aligns with the source data while the ECDF remains correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, pandas, python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100