Plot.plot({
width: 1200,
height: 1200,
projection: {
type: projectionType,
domain: mapBoundary,
inset: mapInset
},
color: {
type: "quantile",
n: 9,
scheme: "blues",
label: "Population",
legend: false
},
marks: [
Plot.geo(
geometry,
Plot.centroid({
stroke: "#333",
strokeWidth: 0.5,
fill: (d) => populationDict.get(d.properties.N03_007)?.value,
title: (d) => {
const props = populationDict.get(d.properties.N03_007);
return `${props?.name}\npopulation: ${props?.value}`;
},
tip: true
})
),
Plot.geo(mapBoundary, { stroke: "red", strokeWidth: 2 }),
Plot.geo(d3.geoGraticule().step([1, 1])(), {
stroke: "gray",
strokeOpacity: 0.2
}),
Plot.graticule(),
Plot.frame()
]
})