Skip to content

Different anchors for x and y labels. #161

@patrick-kidger

Description

@patrick-kidger

I have the following:

#import "@preview/cetz:0.4.2"
#import "@preview/cetz-plot:0.1.3"
#cetz.canvas({
  cetz.draw.set-style(axes: (label: (offset: 0.2, anchor: "north")))
  cetz-plot.plot.plot(
    size: (2, 2),
    axis-style: "school-book",
    x-label: [Foo],
    y-label: [Bar],
    x-tick-step: none,
    y-tick-step: none,
    cetz-plot.plot.add(((0, 0), (1, 1)))
  )
})

however this only produces a reasonable-looking label for the x label. The y label overlaps with the y-axis, and for this label I would like to be able to set anchor: "south".

I've already consulted the manual and couldn't find any documented way to adjust both labels independently. (I've also tried various suggestively-named arguments, e.g. axes: (y-label: (anchor: "south")), but these don't seem to have any effect and are presumably just silently ignored.)

Is this possible?

(And whilst I'm here: setting anchor: "south" mostly gets me what I want for the y label, but a little extra vertical space is still needed to get it far enough away. I can hack around this by adding #v(0.3em) to the y-label, but it also struck me that there might be a better way to do this.)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions