geom-point
Scatterplot layer drawing a marker for each row at (x, y).
Default stat is "identity" and default position is "identity". fill paints the marker body; colour paints the outline. Shape and alpha can be mapped via aes or set to fixed values through the layer parameters below.
Usage
geom-point(
mapping: none,
data: none,
size: auto,
colour: auto,
fill: auto,
stroke: auto,
alpha: auto,
shape: auto,
key: auto,
stat: "identity",
position: "identity",
inherit-aes: true,
)Parameters
| Parameter | Default | Description |
|---|---|---|
mapping |
none |
Layer-specific aesthetic mapping built with aes. Falls back to the plot mapping when none. |
data |
none |
Layer-specific dataset. Falls back to the plot data when none. |
size |
auto |
Marker size (a Typst length). |
colour |
auto |
Fixed marker outline colour. auto resolves via the colour scale, falling back to the theme ink only when neither colour nor fill is set. |
fill |
auto |
Marker body fill. auto resolves via the fill scale or a neutral default. |
stroke |
auto |
Marker outline thickness (a Typst length) or stroke dictionary; none disables the outline and the colour aesthetic. |
alpha |
auto |
Marker opacity in [0, 1]. |
shape |
auto |
Marker shape keyword (e.g., "circle", "square", "triangle"). auto honours the shape scale. |
key |
auto |
Legend glyph override built with a draw-key-* helper. auto picks the default for the geom. |
stat |
"identity" |
Statistical transform name. Usually left at "identity". |
position |
"identity" |
Position adjustment name. Usually left at "identity". |
inherit-aes |
true |
Whether to merge the plot-level mapping into this layer’s mapping. |
Returns
Layer dictionary consumed by plot.
Examples
Default scatter, mapping fill to a categorical column.
#let d = (
(x: 1, y: 2, sp: "a"),
(x: 2, y: 4, sp: "b"),
(x: 3, y: 3, sp: "a"),
(x: 4, y: 5, sp: "b"),
)
#plot(
data: d,
mapping: aes(x: "x", y: "y", fill: "sp"),
layers: (geom-point(size: 3pt),),
width: 10cm,
height: 6cm,
)Map shape and size alongside fill to encode three dimensions on the same scatter.
#let d = (
(x: 1, y: 2, sp: "a", w: 1),
(x: 2, y: 4, sp: "b", w: 2),
(x: 3, y: 3, sp: "a", w: 3),
(x: 4, y: 5, sp: "b", w: 4),
)
#plot(
data: d,
mapping: aes(x: "x", y: "y", fill: "sp", shape: "sp", size: "w"),
layers: (geom-point(),),
width: 10cm,
height: 6cm,
)The classic penguins scatter: flipper length vs body mass, coloured and shaped by species.
#plot(
data: penguins,
mapping: aes(
x: "flipper-len",
y: "body-mass",
fill: "species",
shape: "species",
),
layers: (geom-point(size: 2pt, alpha: 0.85),),
labs: labs(
x: "Flipper Length (mm)",
y: "Body Mass (g)",
fill: "Species",
shape: "Species",
),
width: 11cm,
height: 6cm,
)