place
Places any type of content in the data area. The coordinates of the origin
can be given as data coordinates, as percentage relative to the data area
or in absolute lengths (see rect
).
#lq.diagram(
lq.place(0.5, 0.5)[Hello],
lq.place(0%, 0.3, align: left)[
Text placed at `x: 0%` and `y: 0.3`
]
)
Unlike other plotting commands, place
is not clipped to the data area by
default and the z-index is higher, making the placed content appear
on top of most other diagram objects.
#lq.diagram(
lq.plot((1, 2, 3), (1, 2.1, 3)),
lq.place(
10%, 0%,
align: left,
box(fill: yellow, inset: 2pt)[
Here comes the plot🎶 ↓
]
)
)
Clipping can be activated via place.clip
and the z-index can be changed
through place.z-index
.
With place
, a smaller plot can also be placed within another plot.
#let xs = lq.linspace(-5, 5, num: 20)
#lq.diagram(
lq.plot((1,2,3), (1,2,3)),
lq.place(25%, 50%,
lq.diagram(
title: [mini],
fill: white,
width: 40pt, height: 30pt,
lq.plot(xs, xs.map(x => x*x))
)
)
)
x : float
| relative
The coordinate of the origin.
y : float
| relative
The coordinate of the origin.
body : any
The content to place in the data area.
align : alignment
default: center + horizon
How to align the content at the origin coordinates.
clip : bool
default: false
Whether to clip the plot to the data area. See plot.clip
.
z-index : int
| float
default: 21
Determines the position of the content in the order of rendered diagram
objects. See plot.z-index
.