Plot.plot({
marks: [
Plot.barY(
dayFiltered,
Plot.groupX(
{ y: "count" },
{
x: "category",
fill: "day_of_week",
title: (d) => `Day ${d.day_of_week}`
}
)
)
],
y: {
label: "Orders ↑"
},
width,
label: "Days of week",
color: {
scheme: "ylorrd",
legend: true,
type: "threshold",
domain: [1, 2, 3, 4, 5, 6]
}
})