Support marginal_x/marginal_y="heatmap" in density_heatmap/density_contour - #5707
Open
lucasjamar wants to merge 1 commit into
Open
Support marginal_x/marginal_y="heatmap" in density_heatmap/density_contour#5707lucasjamar wants to merge 1 commit into
lucasjamar wants to merge 1 commit into
Conversation
…ntour Draws a single-row/column heatmap strip in the margin, colored by the same z/histfunc aggregate as the main plot, sharing its coloraxis. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
'heatmap'as a supportedmarginal_x/marginal_yvalue fordensity_heatmap/density_contour, drawing a single-row (marginal_x) or single-column (marginal_y) heatmap strip in the margin, colored by the samez/histfuncaggregate as the main plot (or raw count whenzisn't given).go.Histogram2dtrace reusing the real perpendicular-axis column, collapsed to a single explicit bin (via computedxbins/ybinsedges —nbins*=1alone isn't reliable since plotly.js's "nice number" bin-sizing can still round to 2 bins). Binning happens client-side, same as the main trace.coloraxis/colorbar (coloraxis1) rather than drawing its own. Fordensity_contour, whose main trace is lines-only (contours.coloring="none") and has no existing coloraxis,coloraxis1is now built (from a default colorscale —density_contourhas nocolor_continuous_scaleargument) whenever a heatmap marginal is requested, without changing the main contour trace's own appearance.density_heatmap/density_contour— raises a clearValueErroronscatter/histogram/ecdf.go.Histogram2d(nomarkerproperty), (2)density_contour's discretecolor-grouping (line.color) update would crash when ago.Histogram2dmarginal trace is present in the same group.Fixes #5706
Test plan
test_marginal_heatmap_uses_z_and_histfunc,test_marginal_heatmap_without_z,test_marginal_heatmap_unsupported_chart_type_raises,test_marginal_heatmap_with_discrete_colorintests/test_optional/test_px/test_marginals.pypytest tests/test_optional/test_px/test_marginals.py— 149 passedpytest tests/test_optional/test_px/— 1139 passed, 3 skipped, 4 xfailed (47 pre-existing failures intest_trendline.pyunrelated to this change — localstatsmodels/scipyversion conflict)ruff checkclean on changed files (pinnedruff==0.11.12)histfunc="sum"andhistfunc="avg", and thedensity_contour+ discretecolor+ heatmap marginal crash scenario