Plot.plot({
caption: "Data from the World Bank (2024).",
projection: "equal-earth",
width,
color: {
legend: true,
label: "Region",
unknown: "white"
},
marks: [
Plot.geo(geo, {
fill: (d) => d.properties["Region"],
stroke: "currentColor",
strokeWidth: 0.5
}),
Plot.sphere(),
Plot.tip(
geo.features,
Plot.pointer(
Plot.centroid({
channels: {
Country: (d) => d.properties["Name"],
Region: (d) => d.properties["Region"]
},
format: {
Country: true,
Proportion: d3.format(".2%")
}
})
)
)
]
})