Plot.plot({
width: width,
height: '600',
marginBottom: '60',
x: {
domain: [...variableCategories],
tickRotate: 35,
label: null,
},
y: {
grid: true,
percent: true,
},
marks: [
Plot.barY(data, Plot.stackY({
x: variablesByName.get(variable),
y: "value",
fill: variablesByName.get(secondaryVariable),
title: variablesByName.get(secondaryVariable),
offset: "expand"
})),
Plot.ruleY([0])
]
})