Plot.plot({
height: 640,
grid: true,
x: {
type: "log",
label: "GDP per capita ($)"
},
y: {
axis: "right",
label: "Population that is fully vaccinated (per 100 people)"
},
r: {
range: [2, 36],
type: "sqrt",
},
color: {
type: log ? "log" : "linear",
scheme: diverging ? "piyg" : "purd",
reverse: diverging ? false : true,
marginLeft: 30
},
marks: [
Plot.dot(vaccinatedClean, {
y: "people_fully_vaccinated_per_hundred",
x: "gdp_per_capita",
r: "population",
fill: "gdp_per_capita",
fillOpacity: .5,
stroke: "gdp_per_capita",
strokeWidth: 2,
mixBlendMode: "multiply",
title: d => `${d.location}\nVaccinated: ${d.people_fully_vaccinated_per_hundred}% \nGDP: $${d.gdp_per_capita} per capita`
}),
Plot.text(
vaccinatedClean
.sort((a,b) => b.population - a.population)
.slice(0,5),
{
y: "people_fully_vaccinated_per_hundred",
x: "gdp_per_capita",
text: "location",
stroke: "#fff",
fill: "#333",
strokeWidth: 3
})
],
style: {
padding: 10,
paintOrder: "stroke"
}
})