Nesting axes labels in observable plot?

Hi there!

Really enjoying observable plot. I’ve had this thought a couple times building barcharts, would it be possible to nest axes labels ? The only thing I have come up with is to make the chart at the right bar resolution (# or bars) with placeholder labels and then try to manually update the html/svg somehow. Thanks for any thoughts folks have!

Here’s an example with nesting x axis labels

here’s one with nesting y

That’s a tough one, because it’s not immediately obvious how the labels relate to the data. I guess it means you have to layer a few custom axis marks?

Nice! Yes that got me totally going

Plot.plot({grid: true,y: { type: “linear” },marginRight: 150,marks: [Plot.axisY({
  anchor: "right",

  labelAnchor: "top",
  ticks: [1, 0.5, 0],
  tickSize:0,
  tickFormat: (d,i) => {
    
    return ["top","middle","bottom"][i];
  },
  insetRight: -80
}),
Plot.axisY({
  anchor: "right",

  labelAnchor: "top",
  insetRight: -40
})]})

1 Like