heatmap = Plot.plot({
width: 720,
height: 300,
marginLeft: 90,
facet: {
data: pizza,
y: "pizza_name",
x: "size"
},
x: { label: "By date" },
fx: { label: "Size", domain: ["Small", "Medium", "Large", "Extra Large"] },
fy: { label: "" },
color: {
scheme: "RdPu",
legend: true,
label: "Number of orders"
},
marks: [
Plot.tickX(
pizza,
Plot.binX(
legend.linked ? { stroke: "sum"} : { fill: "sum"},
{
x: "order_date",
interval: legend.interval.value,
stroke: "orders",
tip: true,
sort: "-stroke"
}
)
),
Plot.frame({ stroke: "#aaa", strokeWidth: 0.5 })
]
})