element-rect
Rectangle element: fill and stroke.
Pass the result to theme under keys like panel-background.
Usage
element-rect(
fill: none,
stroke: none,
)Parameters
| Parameter | Default | Description |
|---|---|---|
fill |
none |
Rectangle fill colour, or none to inherit. |
stroke |
none |
Rectangle stroke, or none to inherit. |
Returns
Element dictionary consumed by theme.
Examples
Tinted panel background via theme.
#let d = range(0, 10).map(i => (x: i, y: i * 0.5))
#plot(
data: d,
mapping: aes(x: "x", y: "y"),
layers: (geom-point(size: 2pt),),
theme: theme(panel-background: element-rect(fill: rgb("#f7f0e7"))),
width: 10cm,
height: 6cm,
)Add a stroke to frame the panel as well as fill it.
#let d = range(0, 10).map(i => (x: i, y: i * 0.5))
#plot(
data: d,
mapping: aes(x: "x", y: "y"),
layers: (geom-point(size: 2pt),),
theme: theme(panel-background: element-rect(
fill: rgb("#fff7e6"),
stroke: 1pt + rgb("#cc7a00"),
)),
width: 10cm,
height: 6cm,
)