observablehq / plot

A concise API for exploratory data visualization implementing a layered grammar of graphics
https://observablehq.com/plot/
ISC License
4.41k stars 176 forks source link

Multi-line date labels can collide with scale label #1859

Open tophtucker opened 1 year ago

tophtucker commented 1 year ago

If the date axis is not named one of the special names we suppress, the axis label may collide with the tick labels. (I see why this happens and auto margins are very tricky but I wanted an issue to track this.)

untitled (65)

Plot.plot({
  marks: [
    Plot.rectY(pizza, Plot.binX({ y: "count" }, { x: "order_date", tip: true })),
    Plot.ruleY([0])
  ]
})
Fil commented 1 year ago

Wouldn't you want to leave the margin as is, and remove 2023?

tophtucker commented 1 year ago

In this specific case, I’d really probably just want to remove the label “order_date”. But I can imagine wanting a label on a date axis and wanting it to adjust automatically if it’s multi-line. Though I know it may not be easy to infer if it’s multi-line! So maybe this is more similar to https://github.com/observablehq/plot/issues/383.