Plot.plot({
marginLeft: 180,
x: {
type: "linear",
domain: segments,
ticks: segments,
tickFormat: (d) => (d === Math.floor(d) ? `${d}:00` : `${Math.floor(d)}:30`)
},
color: {
scheme: "YlGnBu",
legend: true,
label: "Count (median)"
},
marks: [
Plot.ruleX([12.5], { strokeDasharray: "2,6" }),
Plot.rectX(
bikes,
Plot.binX(
{ fill: "median", interval: 0.25 },
{
x: "time",
y: "location",
fill: "count",
sort: { y: "fill", reverse: true },
tip: true
}
)
)
]
})