Plot.plot({
fit: californiaCounties,
color: {
type: "quantize",
scheme: "Purples",
domain: [0, d3.max(Object.values(fireCounts))]
},
marks: [
Plot.geo(californiaCounties, {
fill: d => (fireCounts[d.properties.CountyName] || 0),
stroke: "lightgrey",
title: d => `${d.properties.CountyName}: ${fireCounts[d.properties.CountyName] || 0} fires`
}),
Plot.dot(fires_cleaned, {
x: "Longitude",
y: "Latitude",
r: 1.5,
fill: "grey",
opacity: 0.5
}),
Plot.text(californiaCounties.features.filter(d => (fireCounts[d.properties.CountyName] || 0) > 20), {
text: d => d.properties.CountyName,
x: d => d.properties.CENTROID_X || d3.geoCentroid(d)[0],
y: d => d.properties.CENTROID_Y || d3.geoCentroid(d)[1],
fill: "black",
fontSize: 10,
fontWeight: "bold",
textAnchor: "middle"
})
]
})