We currently have an example in the density documentation where this works out reasonably well by accident.
However if we pick flipper_len instead of bill_len we see misalignment happening.
VISUALISE flipper_len AS x FROM ggsql:penguins
DRAW histogram
REMAPPING density AS y
SETTING opacity => 0.5
DRAW density
SETTING opacity => 0.5
Currently the histogram density is computed as:
{count} * 1.0 / SUM({count})
To get good alignment with the density layer, we'd need to account for the binwidth as well.
I'm proposing the current histogram density variable becomes fraction or something, and have a new density computation that divides by the binwidth.
We currently have an example in the density documentation where this works out reasonably well by accident.
However if we pick
flipper_leninstead ofbill_lenwe see misalignment happening.Currently the histogram density is computed as:
To get good alignment with the density layer, we'd need to account for the binwidth as well.
I'm proposing the current histogram
densityvariable becomesfractionor something, and have a newdensitycomputation that divides by the binwidth.