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

  • economics - US monthly economic time series (subset).
  • mpg - Fuel economy of 30 cars (small fuel-economy reference dataset).
  • penguins - Morphological measurements for 344 penguins (Palmer Archipelago).

Labs

  • labs - Build a label dictionary for the plot title, subtitle, caption, and axes.

Guides

Geoms

  • geom-blank - Invisible layer used to extend trained scales without drawing marks.

Areas and ribbons

  • geom-area - Area layer: filled polygon from y = 0 up to y along x, per group.
  • geom-ribbon - Filled band between ymin and ymax along 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 _level to 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 _level to 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 from ymin to ymax with a horizontal bar at y.
  • 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 from ymin to ymax at each x.
  • geom-pointrange - Pointrange layer: a marker at (x, y) plus a linerange from ymin to ymax.

Lines and paths

  • geom-curve - Curved segment layer: one quadratic bezier from (x, y) to (xend, yend) per row.
  • geom-function - Polyline of fun(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

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 the label aesthetic.
  • geom-text - Text label layer reading strings from the label aesthetic.
  • geom-typst - Text label layer whose label aesthetic 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 with geom-polygon or geom-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 - Sample fun at n points across xlim and 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 with y = count.
  • stat-sum - Sum statistic: one output row per unique (x, y) pair with _n and _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 in values.

Binning helpers

  • cut-interval - Cut a numeric vector into n equal-width bins.
  • cut-number - Cut a numeric vector into n bins of (approximately) equal count.
  • cut-width - Cut a numeric vector into bins of fixed width.

Formatters

  • format-comma - Shorthand for format-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 covering conf proportion 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

Colour and fill: binned

Colour and fill: continuous

Colour and fill: discrete

Colour and fill: manual and identity

Linetype scales

Linewidth scales

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 into n-breaks bins.
  • 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 into n-breaks bins.
  • 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

  • dup-axis - Duplicate the primary axis on the opposite side of the panel.
  • sec-axis - Secondary axis derived from the primary through a transformation.

Shape scales

  • scale-shape - Discrete shape scale: maps levels to marker-shape keywords.
  • scale-shape-binned - Binned shape scale: cuts a continuous variable into n-breaks bins, each bin gets one shape from palette.
  • 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

Stroke scales

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

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

  • theme - Build a custom theme from per-element overrides.
  • theme-get - Get the current global default theme.
  • theme-set - Set the global default theme for all subsequent plots.

Sub-theme accessors

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 as element-text plus automatic Typst-markup evaluation for plain strings reaching this surface.
  • margin - Plot-margin specification: padding on each side of the plot canvas.
Back to top