Related to #3521 (closed as stale in 2024, reopening as a fresh issue per maintainer request).
For 2D histograms and contour plots, marginal histograms (marginal_x/marginal_y="histogram") always show raw bin counts, regardless of the z value and histfunc passed to density_heatmap/density_contour. The main plot correctly aggregates z via histfunc, but the marginal subplots do not.
Example:
import plotly.express as px
df = px.data.tips()
fig = px.density_heatmap(
df, x="size", y="tip", z="total_bill", histfunc="sum",
marginal_x="histogram", marginal_y="histogram",
)
fig.show()
Expected: the marginal histograms show the sum of total_bill per bin, matching the main heatmap.
Actual: the marginal histograms show raw row counts per bin.
I have a fix ready and will open a PR referencing this issue.
Related to #3521 (closed as stale in 2024, reopening as a fresh issue per maintainer request).
For 2D histograms and contour plots, marginal histograms (
marginal_x/marginal_y="histogram") always show raw bin counts, regardless of thezvalue andhistfuncpassed todensity_heatmap/density_contour. The main plot correctly aggregateszviahistfunc, but the marginal subplots do not.Example:
Expected: the marginal histograms show the sum of
total_billper bin, matching the main heatmap.Actual: the marginal histograms show raw row counts per bin.
I have a fix ready and will open a PR referencing this issue.