chart = Plot.plot({
width: 960,
height: 600,
projection: {
type: "azimuthal-equal-area",
rotate: [-13, -59],
domain: {
type: "MultiPoint",
coordinates: focus
}
},
color: {
scheme: "burd",
unknown: "#ddd",
type: "linear",
legend: false,
label: "% change, 2019-2023 period",
percent: true
},
marks: [
Plot.sphere({ fill: "white" }),
Plot.geo(land),
Plot.graticule(),
Plot.geo(countries, {
stroke: "#333",
strokeWidth: 0.2,
fill: "#e1e1e1",
title: (d) => d.id
}),
Plot.geo(upper_zones, {
stroke: "#aaa",
strokeWidth: 0.5,
fill: (d) => d.properties.percentage_change,
fillOpacity: 0.5,
title: (d) =>
`${d.properties.name}\nchange 2022 vs 2019: ${d3.format("+0.1%")(
d.properties.percentage_change
)}`
}),
Plot.text(
[{ longitude: -18, latitude: 67.85, label: "Upper airspace" }],
{
x: "longitude",
y: "latitude",
text: "label",
fontSize: 22,
fontWeight: 400,
stroke: "white",
fill: "black",
textAnchor: "start",
dx: 0
}
),
Plot.text(
upper_zones.features.filter(
(d) => d.properties.percentage_change !== undefined
),
{
x: (d) => d.properties.label_position[0],
y: (d) => d.properties.label_position[1],
text: (d) => d3.format("+0.0%")(d.properties.percentage_change),
title: (d) =>
`${d.properties.name}\nchange 2022 vs 2019: ${d3.format("+0.1%")(
d.properties.percentage_change
)}`,
textAnchor: "middle",
fontSize: 16,
stroke: "white",
fill: "black"
}
),
lower_airspace_inset(),
Plot.sphere({ stroke: "#aaa" })
]
})