rect
lq.rect(x, y, width=auto, height=auto, fill=none, stroke=auto, radius=0pt, inset=5pt, outset=0pt, label=none, clip=true, z-index=2, ..body)
Plots a rectangle or square with origin (x, y)
. The origin coordinates as well
as width and height can either be given as
- data coordinates (
int
orfloat
), - or absolute coordinates from the top left corner of the data area (
length
), - or in percent relative to the data area (
ratio
), - or a combination of the latter two (
relative
).
Note that coordinate types can also be mixed (e.g., a length for x
and a scalar for y
).
For example in order to access the center, you can write (50%, 50%)
.
#lq.diagram(
width: 3cm, height: 3cm,
lq.rect(2, 2, width: 10, height: 4, fill: yellow),
lq.rect(10, 4, width: 4, height: 4, fill: red),
lq.rect(50%, 50%, width: 45%, height: 45%, stroke: blue)
)
x : float
| relative
The x coordinate of the origin.
y : float
| relative
The y coordinate of the origin.
width : auto
| float
| relative
default: auto
The rectangle's width.
height : auto
| float
| relative
default: auto
The rectangle's height.
fill : none
| color
| gradient
| tiling
default: none
How to fill the rectangle.
stroke : auto
| none
| stroke
default: auto
How to stroke the rectangle.
radius : relative
default: 0pt
The corner rounding radius of the rectangle.
inset : relative
| dictionary
default: 5pt
How much to pad the content of the rectangle. See the built-in std.rect#inset
.
outset : relative
| dictionary
default: 0pt
How much to expand the rectangle beyond its defined size.
See the built-in std.rect#outset
.
label : content
default: none
The legend label for this plot. See plot.label
.
clip : bool
default: true
Whether to clip the plot to the data area. See plot.clip
.
z-index : int
| float
default: 2
Determines the position of this plot in the order of rendered diagram objects.
See plot.z-index
.
..body : any
An optional body to place inside the rectangle.