How to add second grid to lilaq plot?

In lilaq there is a possibility to add a second axis to the graph using lq.axis and in this case one of the ways is the method when you can simply add plot to lq.axis and lilaq will independently select the limits for the axis. But in this case the grid for the plot will be aligned with the main axis. I looked through all the lilaq documentation and did not find any mention of the possibility of adding a secondary grid.

#let time = (0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300)
#let data = (
  "IY": (40.95, 37.45, 37.44, 38.52, 40.62, 44.25, 43.85, 47.52, 54.28, 56.22, 63.68),
  "IW": (194, 193, 187, 151, 177, 163, 161, 147, 121.61, 116.37, 79),
  "IB": (0.96, -1.25, 2.36, 3.49, 3.20, 6.44, 6.07, 9.49, 16.25, 18.15, 26.63)
)

#lq.diagram(
  lq.plot(
    time,
    data.at("IY"),
    color: black,
    mark: "+",
    label: [Yellowness ind.],
    stroke: stroke(dash: "solid"),
  ),
  lq.yaxis(
    label: [Whiteness ind.],
    position: right,
    lq.plot(
      time,
      data.at("IW"),
      color: black,
      mark: "+",
      label: [Whiteness ind.],
      stroke: stroke(dash: "dotted"),
    ),
  ),
  lq.plot(
    time,
    data.at("IB"),
    color: black,
    mark: "+",
    label: [Browning ind.],
    stroke: stroke(dash: "dashed"),
  ),
  width: 100%,
  height: height_plt,
  title: [Change in indices over time],
  ylabel: [Numerical value (Y.I., B.I.)],
  xlabel: [Time, s],
  legend: (position: horizon + left),
)

Hi @MAX2 ,

Do you only want the second grid? Or both at the same time? In the latter case, won’t they overlay in a way that is hard to read?

I’m asking because I also thought about grids for secondary axes before and they would not be hard to implement (basically all infrastructure is already there). I was just very unsure about the usefulness which is why this wasn’t added yet.

Sorry for the long wait, I think it would be best if both grids were visible, but the second one could be a different color (a lighter gray or something very light like yellow or cyan), also in this particular example there is no need for vertical grid lines, so it would be best if there was an option to use only horizontal grid lines (or vertical in other cases).

That sounds reasonable.

By the way, the x/y strikes can already be configured independently, see https://lilaq.org/docs/reference/grid:

#show: lq.cond-set(lq.grid.with(kind: "x"), stroke: none)

#lq.diagram(
  width: 4.5cm, height: 3cm
)