legend
lq.legend(..children, fill=white.transparentize(20%), inset=0.3em, stroke=0.5pt + gray, radius=1.5pt, position=top + right, pad=2pt, dx=0pt, dy=0pt, z-index=25)(source)A diagram legend listing all labeled plots.
#lq.diagram(
legend: (position: top + left),
lq.plot((1,2,3), (1,2,3), label: [Data A]),
lq.plot((1,2,3), (2,3,4), label: [Data B]),
)
Also refer to the legend tutorial for more details.
..children : array
The items to place in the legend. This field is
filled automatically by diagram.
fill : none | color | gradient | tiling default: white.transparentize(20%)
How to fill the background of the legend.
inset : relative default: 0.3em
Determines the padding of the entire legend within its box.
stroke : none | stroke default: 0.5pt + gray
How to stroke the outer border of the legend.
radius : relative | dictionary default: 1.5pt
The radius of the outer border of the legend.
position : alignment | array default: top + right
Where to place the legend in the diagram. This can be an alignment
or a position (x, y) where x and y are relative lengths, i.e.,
they can be
- lengths like
20ptor2em, - ratios like
50%(measuring in the data area), - or a combination thereof.
To place the legend outside the diagram, say to the right, use a
combination of position: left + horizon and dx: 100%. Positioning
of the legend is treated more in-depth in the
legend tutorial.
pad : length default: 2pt
In the case that legend.position is an alignment, pad determines
how much to pad the legend from the outer edge of the data area
of the diagram.
dx : relative default: 0pt
The horizontal displacement of the legend from the position specified
through legend.position.
dy : relative default: 0pt
The vertical displacement of the legend from the position specified
through legend.position.
z-index : int | float default: 25
Specifies the position of the legend in the order of rendered diagram objects.