Plot.plot({
width: 928,
height: 832,
x: {axis: "top", tickFormat: "%"},
y: {label: null},
color: {scheme: "Spectral", legend: "ramp", width: 340, label: "Age (years)"},
marks: [
Plot.barX(tidy, {
x: "population",
y: "state",
fill: "age",
offset: "normalize",
sort: {color: null, y: "-x", reduce: "first"}
}),
Plot.ruleX([0])
]
})