addTooltips(
Plot.plot({
projection: {
type: "Mercator",
domain: precincts,
width: 450,
height: 454,
marginBottom: 2,
marginLeft: 70,
},
marks: [
Plot.geo(precincts, {
fill: (d) => (d.properties.dem_votes/(d.properties.rep_votes+d.properties.dem_votes+
d.properties.other_votes + d.properties.lib_votes)*100),
title: (d) =>
`County: ${d.properties.NAME}\n DVotes: ${d.properties.dem_votes}\nRVotes: ${d.properties.rep_votes} \n Precinct: ${d.properties.PRECINCT}`
}),
Plot.geo(co_counties2, { stroke: "#e2e2e2" }),
],
caption: htl.html`Colorado Precinct 2020`,
color: {
type: "linear",
n: 5,
scheme: "blues",
label: "% Democratic Vote",
legend: true
}
})
)