Reference
Every public function in the library, grouped by role.
Core
aes- Bind column names to visual channels to form an aesthetic mapping.after-scale- Transform an aesthetic’s resolved value just before it reaches the geom’s draw step.after-stat- Bind an aesthetic to a column produced by the layer’s stat, or to a per-row computation over the post-stat data.as-factor- Coerce a column to string factors, or tag an aesthetic as discrete.as-numeric- Coerce a column to numeric, or tag an aesthetic as continuous.compose- Arrange multiple plots into a grid or stack with a shared, hoisted legend.from-theme- Pull a value from the resolved theme at render time.plot- Compose a layered plot from data, aesthetics, and geom layers.stage- Compose all three late-binding lanes for a single aesthetic.typst- Mark a value for Typst-markup evaluation.
Datasets
Labs
labs- Build a label dictionary for the plot title, subtitle, caption, and axes.
Guides
draw-key-blank- Draw-key that draws nothing.draw-key-line- Draw-key returning a short horizontal line.draw-key-path- Draw-key returning a short polyline.draw-key-point- Draw-key returning a small filled circle.draw-key-rect- Draw-key returning a small filled rectangle.guide-axis- Customise the x- or y-axis tick labels.guide-axis-logticks- Add minor tick marks at log-scale subdivisions on atransform: "log10"axis.guide-axis-stack- Stack multiple x or y guides on a single axis.guide-axis-theta- Customise the theta (angular) axis undercoord-radial.guide-custom- Render arbitrary Typst content as a legend slot.guide-legend- Customise the legend (swatch) for an aesthetic.guide-none- Suppress the legend for an aesthetic.guides- Bind guide specifications to aesthetics.
Geoms
geom-blank- Invisible layer used to extend trained scales without drawing marks.
Areas and ribbons
geom-area- Area layer: filled polygon fromy = 0up toyalong x, per group.geom-ribbon- Filled band betweenyminandymaxalong the x aesthetic.geom-smooth- Fitted trend line with an optional confidence ribbon.
Bars and histograms
geom-bar- Bar layer that counts rows per x level (stat-count).geom-col- Bar layer with heights taken from the y aesthetic.geom-freqpoly- Frequency polygon: a line through per-bin counts of the x aesthetic.geom-histogram- Histogram layer: bars of binned counts along the x aesthetic.
Contours
geom-contour- Contour-line layer: marching-squares iso-lines over a regular(x, y, z)grid. Pair with a continuous colour scale on_levelto shade by height.geom-contour-filled- Filled iso-band layer: marching-squares cell clipping over a regular(x, y, z)grid. Pair with a continuous fill scale on_levelto shade each band by its lower bound.
Distributions
geom-boxplot- Boxplot layer: draws a Tukey box, whiskers, and outlier points per group.geom-dotplot- Dotplot layer: one dot per observation, stacked within bins.geom-qq- Q-Q point layer: sorted sample versus theoretical quantile.geom-qq-line- Q-Q reference line layer fitted through the IQR of the sample.geom-quantile- Quantile-regression layer: a fitted line per requested τ.geom-rug- Marginal rug ticks at each row’s x and / or y position.
Intervals and errors
geom-crossbar- Crossbar layer: a box fromymintoymaxwith a horizontal bar aty.geom-errorbar- Errorbar layer: vertical range with a horizontal cap at each end.geom-errorbarh- Horizontal errorbar layer: range with a vertical cap at each end.geom-linerange- Linerange layer: one vertical line fromymintoymaxat eachx.geom-pointrange- Pointrange layer: a marker at(x, y)plus a linerange fromymintoymax.
Lines and paths
geom-curve- Curved segment layer: one quadratic bezier from(x, y)to(xend, yend)per row.geom-function- Polyline offun(x)sampled uniformly across the x-range.geom-line- Line layer connecting observations in x order, one path per group.geom-path- Path layer connecting observations in row order, one path per group.geom-segment- Segment layer: one line from(x, y)to(xend, yend)per row.geom-spoke- Spoke layer: one segment from(x, y)along(angle, radius)per row.geom-step- Step layer connecting observations as a stair-step path, one per group.
Points
geom-count- Count layer drawing one marker per unique(x, y), sized by frequency.geom-jitter- Scatter layer withposition-jitterapplied by default.geom-point- Scatterplot layer drawing a marker for each row at(x, y).
Polygons and shapes
geom-ellipse- Ellipse layer: draws one closed ellipse per row from(x0, y0, a, b, angle).geom-mark- Annotation layer enclosing each group with a chosen shape.geom-polygon- Polygon layer: one closed filled polygon per group.
Rectangles and bins
geom-bin-2d- Two-dimensional bin layer: counts (x, y) into a rectangular grid and draws one rectangle per non-empty cell. The fill aesthetic defaults to_count, so a continuous fill scale (scale-fill-viridis-c, etc.) shades the cells by frequency.geom-hex- Hex bin layer: counts (x, y) into a pointy-top hex grid and draws one hexagon per non-empty cell. Default fill encodes count via the fill scale.geom-rect- Rectangle layer drawing one filled box per row from the four corners.geom-tile- Tile layer: filled rectangle centred at(x, y)per row.
Reference lines
geom-abline- Straight reference line described by slope and intercept.geom-hline- Horizontal reference line at one or more y intercepts.geom-vline- Vertical reference line at one or more x intercepts.
Text and annotations
annotate- Build a one-row annotation layer dispatching to a named geom.geom-label- Boxed text label layer reading strings from thelabelaesthetic.geom-text- Text label layer reading strings from thelabelaesthetic.geom-typst- Text label layer whoselabelaesthetic is always evaluated as Typst markup.
Stats
Binning
stat-bin- Bin statistic: partition x into uniform-width bins, count rows per bin.stat-bin-2d- Two-dimensional bin statistic: partition (x, y) into a rectangular grid and count rows per cell.stat-bin-hex- Two-dimensional hexagonal bin statistic: partition (x, y) into a pointy-top hex grid and count rows per cell.stat-bindot- Dot-density bin statistic: emit one stacked row per observation.
Distributions
stat-boxplot- Boxplot statistic: per-x five-number summary with outlier list.stat-contour- Marching-squares contour statistic.stat-contour-filled- Filled iso-band statistic. Partitions the(x, y, z)field into bands defined by successive levels and emits one closed polygon per cell that touches each band. Pair withgeom-polygonorgeom-contour-filled.stat-ecdf- ECDF statistic: one row per unique x value with the cumulative fraction.stat-ellipse- Covariance-ellipse statistic: one ellipse per group from the sample covariance of(x, y).stat-qq- Q-Q statistic: theoretical-vs-sample pairs against a reference distribution.stat-qq-line- Q-Q reference-line statistic: two endpoints of the IQR-fitted line.
Functions and helpers
stat-align- Align statistic: resample each group onto a shared x-grid.stat-connect- Connection statistic: expand consecutive points with intermediate vertices.stat-function- Samplefunatnpoints acrossxlimand emit(x, y)rows.stat-identity- Identity statistic: returns data and mapping unchanged.stat-manual- Manual statistic: run a closure on the data array inside the layer.
Smoothing and regression
stat-quantile- Quantile regression statistic: fit one line per τ and sample it.stat-smooth- Smoother statistic: closed-form linear fit with a pointwise confidence band.
Summaries
stat-count- Count statistic: one output row per distinct x level withy = count.stat-sum- Sum statistic: one output row per unique(x, y)pair with_nand_prop.stat-summary- Per-axis reduction to a central value and an uncertainty band.stat-summary-2d- Two-dimensional summary statistic.stat-summary-bin- Summary statistic over uniform x bins.stat-summary-hex- Hex-grid summary statistic.stat-unique- Unique statistic: keep the first row per(x, y)key, drop later duplicates.
Helpers
get-alt-text- Read the alt text stored on a plot spec.qnorm- Inverse of the standard-normal cumulative distribution function.resolution- Smallest non-zero gap between unique numeric values invalues.
Binning helpers
cut-interval- Cut a numeric vector intonequal-width bins.cut-number- Cut a numeric vector intonbins of (approximately) equal count.cut-width- Cut a numeric vector into bins of fixedwidth.
Formatters
format-comma- Shorthand forformat-number(big-mark: ",").format-currency- Format a numeric break as currency.format-lower- Lower-case a string break (ASCII letters only).format-number- Format a numeric break with optional thousands separator and decimals.format-percent- Format a numeric break as a percentage.format-scientific- Format a numeric break in scientific notation as Typst math.format-title- Title-case a string break: capitalise the first letter of each space-separated word.format-upper- Upper-case a string break (ASCII letters only).format-wrap- Soft-wrap a long string by inserting a newline at word boundaries.
Summary functions
mean- Mean as a degenerate summary(y, ymin: y, ymax: y).mean-cl-boot- Mean with a bootstrap percentile confidence interval.mean-cl-normal- Mean with normal-approximation confidence interval.mean-sd- Mean and standard-deviation band:mean ± multiplier * sd.mean-se- Mean and standard-error band:mean ± multiplier * se.median- Median as a degenerate summary(y, ymin: y, ymax: y).median-hilow- Median plus a central interval coveringconfproportion of the data.quantile- Single quantile as a degenerate summary(y, ymin: y, ymax: y).quantiles- Three quantiles packed into the standard summary shape.summarise- Look up a summary helper by name, or invoke a user-supplied callable.
Scales
col-mix- Blend two colours.expand-limits- Ensure the trained domain includes the supplied values without replacing it.
Alpha scales
scale-alpha-binned- Binned continuous alpha scale.scale-alpha-continuous- Continuous alpha (opacity) scale mapping a numeric column to opacities.scale-alpha-identity- Alpha scale that uses each row’s value as the opacity directly.scale-alpha-manual- Manual discrete alpha scale: supply a per-level array of opacities.
Colour and fill: binned
scale-colour-fermenter- Binned ColorBrewer colour scale.scale-colour-steps- Binned two-stop colour gradient.scale-colour-steps2- Binned diverging colour gradient through a midpoint.scale-colour-stepsn- Binned n-stop colour gradient.scale-colour-viridis-b- Binned viridis colour scale.scale-fill-fermenter- Binned ColorBrewer fill scale.scale-fill-steps- Binned two-stop fill gradient.scale-fill-steps2- Binned diverging fill gradient through a midpoint.scale-fill-stepsn- Binned n-stop fill gradient.scale-fill-viridis-b- Binned viridis fill scale.
Colour and fill: continuous
scale-colour-continuous- Continuous colour scale mapping a numeric column to stroke colours.scale-colour-distiller- Continuous ColorBrewer colour scale.scale-colour-gradient- Continuous two-stop colour gradient.scale-colour-gradient2- Continuous diverging colour gradient through a midpoint.scale-colour-gradientn- Continuous n-stop colour gradient.scale-colour-viridis-c- Continuous viridis colour scale.scale-fill-continuous- Continuous fill scale mapping a numeric column to fill colours.scale-fill-distiller- Continuous ColorBrewer fill scale.scale-fill-gradient- Continuous two-stop fill gradient.scale-fill-gradient2- Continuous diverging fill gradient through a midpoint.scale-fill-gradientn- Continuous n-stop fill gradient.scale-fill-viridis-c- Continuous viridis fill scale.
Colour and fill: discrete
scale-colour-brewer- Discrete ColorBrewer colour scale.scale-colour-discrete- Discrete colour scale mapping categorical levels to stroke colours.scale-colour-grey- Discrete grey colour scale.scale-colour-hue- Discrete equally-spaced hue colour scale.scale-colour-okabe-ito- Discrete Okabe-Ito colour-vision-deficiency-safe colour scale.scale-colour-viridis-d- Discrete viridis colour scale.scale-fill-brewer- Discrete ColorBrewer fill scale.scale-fill-discrete- Discrete fill scale mapping categorical levels to fill colours.scale-fill-grey- Discrete grey fill scale.scale-fill-hue- Discrete equally-spaced hue fill scale.scale-fill-okabe-ito- Discrete Okabe-Ito colour-vision-deficiency-safe fill scale.scale-fill-viridis-d- Discrete viridis fill scale.
Colour and fill: manual and identity
scale-colour-identity- Colour scale that uses each row’s value as the stroke colour directly.scale-colour-manual- Manual discrete colour scale: supply the colour array directly.scale-fill-identity- Fill scale that uses each row’s value as the fill colour directly.scale-fill-manual- Manual discrete fill scale: supply the colour array directly.
Linetype scales
scale-linetype- Discrete linetype scale: maps levels to dash-pattern keywords.scale-linetype-binned- Binned linetype scale: cuts a continuous variable inton-breaksbins, each bin gets one dash keyword frompalette.scale-linetype-continuous- Continuous linetype scale: alias ofscale-linetype-binnedwith the default bin count. Provided as an explicit-name alias.scale-linetype-discrete- Discrete linetype scale: alias ofscale-linetype.scale-linetype-identity- Linetype scale that uses each row’s value as the dash keyword directly.scale-linetype-manual- Manual discrete linetype scale: supply the dash-keyword array directly.
Linewidth scales
scale-linewidth-binned- Binned continuous linewidth scale.scale-linewidth-continuous- Continuous linewidth scale mapping a numeric column to stroke thickness.scale-linewidth-identity- Linewidth scale that uses each row’s value as the stroke thickness.scale-linewidth-manual- Manual discrete linewidth scale: supply a per-level array of Typst lengths.
Palettes
brewer-palette- Look up a ColorBrewer palette by name.okabe-ito- Okabe-Ito colour-vision-deficiency-safe qualitative palette.
Position scales
scale-x-binned- Binned continuous x scale: quantises a numeric axis inton-breaksbins.scale-x-continuous- Continuous x scale: axis title, limits, breaks, labels, and transformation.scale-x-date- Continuous x scale that formats axis labels as dates.scale-x-datetime- Continuous x scale that formats axis labels as datetimes.scale-x-discrete- Discrete x scale: axis title, level ordering, and tick labels.scale-x-log10- Continuous x scale on a base-10 log axis.scale-x-reverse- Continuous x scale flipped left-to-right.scale-x-sqrt- Continuous x scale on a square-root axis.scale-x-time- Continuous x scale that formats axis labels as times of day.scale-y-binned- Binned continuous y scale: quantises a numeric axis inton-breaksbins.scale-y-continuous- Continuous y scale: axis title, limits, breaks, labels, and transformation.scale-y-date- Continuous y scale that formats axis labels as dates.scale-y-datetime- Continuous y scale that formats axis labels as datetimes.scale-y-discrete- Discrete y scale: axis title, level ordering, and tick labels.scale-y-log10- Continuous y scale on a base-10 log axis.scale-y-reverse- Continuous y scale flipped bottom-to-top.scale-y-sqrt- Continuous y scale on a square-root axis.scale-y-time- Continuous y scale that formats axis labels as times of day.
Secondary axes
Shape scales
scale-shape- Discrete shape scale: maps levels to marker-shape keywords.scale-shape-binned- Binned shape scale: cuts a continuous variable inton-breaksbins, each bin gets one shape frompalette.scale-shape-identity- Shape scale that uses each row’s value as the marker keyword directly.scale-shape-manual- Manual discrete shape scale: supply the shape-keyword array directly.
Size scales
scale-radius- Linear-radius continuous size scale.scale-size-area- Area-proportional continuous size scale.scale-size-binned- Binned continuous size scale mapping a numeric column ton-breakssizes.scale-size-binned-area- Binned area-proportional size scale.scale-size-continuous- Continuous size scale mapping a numeric column to a size range.scale-size-identity- Size scale that uses each row’s value as the marker or line size.scale-size-manual- Manual discrete size scale: supply a per-level array of Typst lengths.
Stroke scales
scale-stroke-binned- Binned continuous stroke scale.scale-stroke-continuous- Continuous stroke scale mapping a numeric column to outline thickness.scale-stroke-identity- Stroke scale that uses each row’s value as the outline thickness.scale-stroke-manual- Manual discrete stroke scale: supply a per-level array of Typst lengths.
Coord
coord-cartesian- Cartesian coordinate system with optional panel clipping.coord-fixed- Cartesian coordinate system with a fixed data-unit aspect ratio.coord-flip- Cartesian coordinate system with the x and y axes swapped at render time.coord-radial- Radial coordinate system.coord-transform- Transform the displayed coordinates after statistics have run.
Positions
position-dodge- Dodge position adjustment: place grouped marks side by side.position-fill- Fill position adjustment: stack and normalise each x bucket to sum = 1.position-identity- Identity position adjustment: no offset applied to any row.position-jitter- Random per-row offset on x and y.position-jitterdodge- Combined dodge then jitter position adjustment.position-nudge- Shift every row’s x and y by a fixed amount in data units.position-stack- Stack position adjustment: cumulate y per x bucket.
Facets
facet-grid- Grid facets: panels on a row x column grid from two discrete variables.facet-wrap- Wrap facets: one panel per level of a discrete variable.label-both- Labeller showing both the variable name and the level.label-context- Labeller appending the row count for each level.label-value- Default labeller: shows the level value as-is.label-wrap- Labeller wrapping long labels onto multiple lines.labeller- Combine labellers into a single rule keyed by facet variable.
Themes
Complete themes
theme-bw- Black-and-white theme: white panel, black axes, light grey grid.theme-classic- Classic theme: white panel, axis borders, no gridlines.theme-dark- Dark theme: dark grey panel, white grid, dark axis text.theme-grey- Grey theme: light grey panel with white gridlines.theme-light- Light theme: light grey panel, white grid, soft grey axes.theme-linedraw- Linedraw theme: white panel, strong black axes, very faint grid.theme-minimal- Minimal theme: white panel, light grey gridlines, no axis lines.theme-void- Void theme: no axes, no grid, no panel background.
Modify a theme
Sub-theme accessors
theme-sub-axis- Shortcut for both axes’ title, text, line, and ticks.theme-sub-axis-bottom- Shortcut for the bottom x axis only.theme-sub-axis-left- Shortcut for the left y axis only.theme-sub-axis-right- Shortcut for the right y axis only.theme-sub-axis-top- Shortcut for the top x axis only.theme-sub-axis-x- Shortcut for both x axes (top + bottom).theme-sub-axis-y- Shortcut for both y axes (left + right).theme-sub-legend- Shortcut for legend text and title.theme-sub-panel- Shortcut for panel grid and background.theme-sub-plot- Shortcut for plot title, subtitle, caption, and outer margin.theme-sub-strip- Shortcut for facet strip text and background.
Theme elements
element-blank- Blank element: hides the corresponding theme element.element-geom- Layer-default aesthetics shared across geoms.element-line- Line element: colour and thickness.element-rect- Rectangle element: fill and stroke.element-text- Text element: font size, weight, colour, and angle.element-typst- Typst-markup text element: same fields aselement-textplus automatic Typst-markup evaluation for plain strings reaching this surface.margin- Plot-margin specification: padding on each side of the plot canvas.