Plot.plot({
y: {
grid: true
},
marks: [
Plot.rectY(
data,
Plot.binX({ y: "count" }, { x: "dt", thresholds: "sturges" })
),
Plot.axisX({
ticks: 20,
tickFormat: (
(formatYear, formatMonth) => (x) =>
d3.utcMonth.count(d3.utcYear(x), x) < 1
? `${formatMonth(x)}\n${formatYear(x)}`
: formatMonth(x)
)(d3.utcFormat("%Y"), d3.utcFormat("%b"))
})
]
})