Plot.plot({
marginLeft: 60,
marginRight: 60,
grid: true,
y: { label: null, domain: ["Dream", "Biscoe", "Torgersen"] },
fy: { label: null },
color: { legend: true },
marks: [
Plot.barX(
penguins,
Plot.groupY({ x: "count" }, { fy: "species", y: "island", fill: "sex" })
),
Plot.text(
[
`While Chinstrap and Gentoo penguins were each observed on only one island, Adelie penguins were observed on all three islands.`
],
{
fy: ["Adelie"],
frameAnchor: "top-right",
lineWidth: 18,
dx: -6,
dy: 6
}
),
Plot.frame()
]
})