Plot.plot({
marginTop: 40,
width: 650,
height: 400,
x: {
tickFormat: d3.format("d")
},
color: {scheme: "YlGn", legend: true, domain: ["Bottom 80%", "Top 20-5%", "Top 5-1%", "Top 1%"]},
marks: [
Plot.text([{}], {
text: () => "Distribution of Taxable Wealth in Massachusetts 1820 - 1910 (10 year increments)",
frameAnchor: "top",
anchor: "middle",
dy: -20,
fontSize: 13,
fontWeight: "bold"
}),
Plot.barY(data1, {x: "Year", y: "Wealth", fill: "Percent", reverse: true}),
Plot.textY(
data1,
Plot.stackY(
{
x: "Year",
z: "Percent",
y: "Wealth",
text: (d) => (d.Wealth < 5 ? null : d.Wealth),
reverse: true
}
)
),
Plot.ruleY([0])
]
})