Plot.plot({
width: 1000,
marginLeft: 40,
y: {
label: "↑ Million People",
transform: d => d /1_000_000
},
x: {
label: "State"
},
marks: [
Plot.barY(data, {
x: "name",
y: "20-29",
sort:{x: "y", reverse:true},
fill: d => d["20-29"] > 1_000_000 ? "salmon" : "dodgerblue"
})
]
})