{
const values = new Map(gdp.map((d) => [d.country, d.gdp_per_capita]));
return Plot.plot({
color: {
legend: true,
scheme: "Cool",
type: "threshold",
domain: roundBreaksLog(
gdp.map((d) => d["gdp_per_capita"]),
k_gdp_log
),
width: Math.sqrt(k_gdp_log) * 100,
tickFormat: (d) => d / 1000,
label: "GDP per capita (dollars, thousands)",
unknown: "#ccc"
},
projection: "equal-earth",
marks: [
Plot.geo(
countries,
Plot.centroid({
fill: (d) => values.get(d.properties.a3),
stroke: "white",
title: (d) => `${d.properties.a3}\n${values.get(d.properties.a3)}`,
strokeWidth: 0.5,
tip: true
})
),
Plot.sphere()
]
});
}