Skip to content

Apply histfunc/z aggregation to marginal histograms in density_heatmap/density_contour - #5705

Open
lucasjamar wants to merge 1 commit into
plotly:mainfrom
lucasjamar:fix-marginal-histogram-histfunc-3521
Open

Apply histfunc/z aggregation to marginal histograms in density_heatmap/density_contour#5705
lucasjamar wants to merge 1 commit into
plotly:mainfrom
lucasjamar:fix-marginal-histogram-histfunc-3521

Conversation

@lucasjamar

Copy link
Copy Markdown

Summary

  • Marginal histogram subplots (marginal_x/marginal_y="histogram") in density_heatmap/density_contour always showed raw bin counts, ignoring the z value and histfunc passed to the main plot.
  • Mirrors the main trace's effective histfunc onto the marginal go.Histogram trace, feeding z onto the axis opposite the shared coordinate, so the marginal now aggregates consistently with the main plot.
  • Behavior is unchanged when z is not passed.

Fixes #5704
Related to #3521

Test plan

  • Added test_marginal_histogram_uses_z_and_histfunc / test_marginal_histogram_without_z_is_unchanged in tests/test_optional/test_px/test_marginals.py
  • pytest tests/test_optional/test_px/test_marginals.py — 145 passed
  • pytest tests/test_optional/test_px/ — 1135 passed, 3 skipped, 4 xfailed (47 pre-existing failures in test_trendline.py unrelated to this change — local statsmodels/scipy version conflict)
  • ruff check clean on changed files (pinned ruff==0.11.12)

…p/density_contour

Marginal histogram subplots always showed raw bin counts, ignoring the z
value and histfunc the user passed to the main plot.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Marginal histograms ignore z/histfunc in density_heatmap/density_contour

1 participant