Plot.plot({
y: {
grid: true,
tickFormat: (value, index, values) => Math.abs(value)
},
marks: [
Plot.barY(
penguins.filter((d) => d.sex !== null),
Plot.groupX(
{ y: (d) => (d[0].sex === "MALE" ? d.length : -d.length) },
{ x: "species", fill: "sex" }
)
),
Plot.ruleY([0])
]
})