Plot.plot({
width,
inset: 10,
projection: { type: "orthographic", rotate: [-longitude, -30] },
length: { domain: [0, 41e6], range: [0, 100] },
marks: [
Plot.graticule({ strokeOpacity: 0.05 }),
() => insetShadow,
Plot.geo(basemap[0], {
fill: "#c9d8df",
imageFilter: effect ? "url(#inset-shadow)" : null
}),
Plot.geo(basemap[1], { stroke: "white", strokeOpacity: 0.7 }),
Plot.vector(ghs_urban_centres_2015, {
x: "LON",
y: "LAT",
r: 2,
length: "P15",
shape: barMap,
anchor: "start",
fill: "#D80B8C",
fillOpacity: 0.8,
imageFilter: effect ? "drop-shadow(0.07rem 0.07rem 0.07rem white)" : null,
tip: true,
title: (d) =>
`${d.NAME} (${d.COUNTRY})\n
Pop 2015: ${d.P15.toLocaleString(undefined, {
maximumFractionDigits: 0,
maximumSignificantDigits: 3
})}`
}),
Plot.sphere({
stroke: "grey",
imageFilter: effect ? "blur(5px)" : null,
clip: "sphere"
}),
legendBar([1e6, 1e7, 2e7, 4e7], { fill: "#D80B8C", fillOpacity: 0.8 })
],
caption:
"Source: GHS Urban Centre Database 2015. European Commission, Joint Research Centre (JRC)"
})