Plot.plot({
projection: "albers-usa",
marks: [
Plot.geo(states, { fill: "white", stroke: "#e2e2e2" }),
Plot.dot(us_power_plants, {
x: "longitude",
y: "latitude",
r: "Total_MW",
stroke: "PrimSource",
strokeOpacity: .5,
opacity: d => selectSource.includes(d.PrimSource) ? 0.7 : 0,
}),
Plot.density(us_power_plants, {
x: "longitude",
y: "latitude",
bandwidth: 10,
thresholds: 10,
stroke: "PrimSource",
fill: "PrimSource",
fillOpacity: 0.25,
opacity: d => selectSource.includes(d.PrimSource) ? 0.7 : 0,
mixBlendMode: "multiply",
weight: "Total_MW"
})
],
height: 500,
width: 800,
margin: 50,
density: {
domain: [100, 2000]
},
r: { range: [1, 15], domain: d3.extent(us_power_plants, (d) => d.Total_MW) },
color: { legend: true }
})