Plot.plot({
marginBottom: 72,
marginLeft: 48,
x: {
type: "log",
ticks: selectedCities.map((d) => d[2015]),
tickFormat: (d, i) =>
`${selectedCities[i]["Urban Agglomeration"]} — ${d3.format(".2s")(
+selectedCities[i]["2015"] * 1000
)}`,
tickRotate: -15,
grid: true
},
y: { type: "log", label: "↑ 2030 vs. 2015" },
color: { type: "ordinal" },
marks: [
Plot.ruleY([1]),
Plot.dot(cities, {
x: "2015",
y: (d) => d[2030] / d[2015],
fill: "Country Code",
title: "Urban Agglomeration"
})
]
})