addTooltips(
Plot.plot({
y: {
grid: true,
tickFormat: d => d + 1,
label: "↑ Male/Female Ratio"
},
color: {scheme: "PiYg"},
marks: [
Plot.barY(populationByPrefecture, {
x: "地区",
y: d => d["性别比"] - 1,
fill: d => Math.sign(d["性别比"] - 1),
title: "性别比",
sort: {x: "y", reverse: true},
}),
Plot.ruleY([0])
]
})
)