If I was you, I would try both lines of code independently.
Font
If you comment the first line of code, to leave only the one changing the font, that should work (assuming you have the font named “Lato” available for the compiler to use.
Width
Regarding the width: 90%, it triggers the following:
assertion failed: field ‘width’ of element ‘diagram’: expected length, found ratio
Which is what is expected for the width parameter as it can only accept a length (and not a ratio). In other words, it works as designed. See diagram − Lilaq.
passing a ratio to diagram.width will be possible starting with lilaq:0.5.0, I implemented this here last week.
The text set rule should just work fine (check it out by adding a diagram.title for instance). Note that Lilaq uses Zero for displaying tick labels on axes, so the math font is actually used here! Either you need to use a math font or tell Zero, not to use math for its number formatting by setting math: false via
#import "@preview/lilaq:0.4.0" as lq
// Keep only diagram data area for tests
#let diagram = lq.diagram(xaxis: none, yaxis: none)
#let scale-width(ratio, body) = {
layout(size => {
let (height, width) = measure(diagram)
show: lq.set-diagram(width: width * ratio)
diagram
})
}
#diagram
#scale-width(100%, diagram)
#scale-width(80%, diagram)
#scale-width(50%, diagram)
Note that the end product with axis and titles, etc. won’t reflect the “real” width ratio as code calculates the width of the whole diagram, as opposed to the width of the data area.
width
The width of the diagram’s data area (excluding axes, labels etc.).