chart = Plot.plot({
x: { type: "linear", grid: true },
y: { grid: true },
r: { range: [1, width / 17] },
color: {
legend: true,
domain: ["americas", "europe", "africa", "asia", "unknown"],
range: ["#7feb00", "#ffe700", "#00d5e9", "#ff5872", "#ffb600"]
},
width,
height,
marks: [
Plot.text([year], {
x: d3.max(data, d => d.fem_pri_20_24),
dx: -width / 2,
y: d3.max(data, d => d.lex),
dy: height / 2,
fill: "#ccc",
fontFamily: "monospace",
fontSize: width / 3,
text: d => "" + d
}),
Plot.dot(data, {
filter: d => d.time === year,
x: "fem_pri_20_24",
y: "lex",
strokeWidth: 1,
stroke: "black",
fill: "world_4region",
r: "pop",
opacity: 0.8,
tip: true,
title: "name"
}),
]
});