Plot.plot({
color: { legend: true, scheme: "BuGn" },
round: true,
width: 800,
marks: [
Plot.dot(
athletes,
Plot.hexbin(
{ fill: "density" },
{
x: "weight",
y: "height",
fx: (x) => "Binned Density",
binWidth
}
)
),
Plot.raster({
fill: gaussianDensity2d(
...sampleMeanCov2(
athletes,
(x) => x.weight,
(x) => x.height
)
),
x1: d3.min(athletes, (x) => x.weight),
x2: d3.max(athletes, (x) => x.weight),
y1: d3.min(athletes, (x) => x.height),
y2: d3.max(athletes, (x) => x.height),
fx: (x) => "Gaussian Density",
pixelSize: 4
})
]
})