Plot.plot({
facet: {
data: species,
x: (d, i) => i % 4,
y: (d, i) => Math.floor(i / 4),
marginLeft: 30
},
fx: { axis: null },
fy: { axis: null },
grid: true,
marks: [
Plot.barY(species, {
transform: speciesTransform({ filter: d => d.year === "avg" }),
y: "total",
fill: "gray"
}),
Plot.barY(species, {
transform: speciesTransform({ filter: d => d.year !== "avg" }),
x: "year",
y: "total",
rx: 3
}),
Plot.frame(),
Plot.text(species, { text: d => d, x: 2019, y: 27e6, dy: 10 })
]
})