winds = {
const lookup = d3.index(counties.features, (d) => d.id);
return Plot.plot({
projection: "albers-usa",
width: 975,
marks: [
Plot.geo(statemesh, { strokeWidth: 0.75 }),
Plot.geo(nation),
Plot.vector(
elections,
Plot.centroid({
filter: (d) => d.votes > 0,
anchor: "start",
geometry: (d) => lookup.get(d.fips),
sort: (d) => Math.abs(+d.results_trumpd - +d.results_bidenj),
stroke: (d) => +d.results_trumpd > +d.results_bidenj ? "red" : "blue",
length: (d) => Math.sqrt(Math.abs(+d.margin2020 * +d.votes)),
rotate: (d) => (+d.results_bidenj < +d.results_trumpd ? 60 : -60)
})
)
]
});
}