Plot.plot({
marginLeft: 100,
marginRight: 60,
grid: true,
y: { label: null, domain: new Set(ttdata.map((x) => x.type)) },
fy: { label: null, domain: new Set(ttdata.map((x) => x.group)) },
color: { legend: true, domain: ["Detect", "Characterize", "Respond"] },
marks: [
Plot.barX(
ttdata,
Plot.groupY(
{ x: "sum" },
{ fy: "group", y: "type", fill: "type", x: "value" }
)
),
Plot.ruleX([0])
]
})