How to make schoolbook style axes in lilaq plots with the labels at the tips of the axes?

I am trying to create plots for school students in lilaq, and have used the schoolbox-style from the documentation and set the alignment for the axes to be “top”/“right”.

#show: schoolbook-style 
#show lq.selector(lq.label): set align(top + right)

#let xvals = lq.linspace(0, 10)
#lq.diagram(
  ylim: (-2, auto),
  xlabel: [$x$],
  ylabel: [$y$],
  lq.plot(xvals, xvals.map(x => calc.sin(x) + 2),
  mark: none,
  smooth: true)
)

The default behaviour with my current code is to have the axes labels in the following locations, which is not where I want them.

I can move the axes labels to where I want them, but this method does not seem particularly robust (and is probably dependent on the font choices and other factors).

xlabel: lq.xlabel(dx: 0.8em, dy: -2.4em)[$x$],
ylabel: lq.ylabel(angle: 0deg, dx: 2.8em, dy: -1.2em)[$y$],

Is there a way I can have these axes labels where I want them without resorting to using dx and dy in this fashion?

1 Like

Hi @Bryn,

This is a very good question, and although I too would like to center axes labels on lilaq diagrams, a discussion started on that here: How to rotate or reposition axis labels in lilaq? - #3 by janekfleper

I suggest the discussion carries on there as this is a duplicate.

1 Like

Thanks for the reference - I had not seen that question, and although it is slightly different, the discussion indicates that currently it’s not possible to achieve the flexibility I would like.