Plot.plot({
height: 300,
marginLeft: 60,
y: { axis: null },
x: { nice: true },
fy: { domain: ["FEMALE", "MALE"] },
color: { legend: true },
facet: { data: penguins, y: "sex" },
marks: [
Plot.areaY(
penguins,
Plot.binX(
{ y2: "proportion" },
{
x: "culmen_length_mm",
fill: "species",
fillOpacity: 0.1,
thresholds: 10,
curve: "natural"
}
)
),
Plot.ruleY([0]),
Plot.lineY(
penguins,
Plot.binX(
{ y: "proportion" },
{
x: "culmen_length_mm",
stroke: "species",
thresholds: 10,
curve: "natural"
}
)
)
]
})