facet: Facet a plot by one or two variables

View source: R/layout.R

facetR Documentation

Facet a plot by one or two variables

Description

Splits a plot into small multiples, one panel for each value of rows, cols, or both. Panels share their axes unless free_scales lets them vary. With a single faceting variable, wrap sets how many panels go in each row.

Usage

facet(spec, rows = NULL, cols = NULL, free_scales = "none", wrap = NULL)

Arguments

spec

A glyph_spec

rows

Row faceting variable: a bare column name, a computed expression (e.g. factor(cyl)), or NULL

cols

Column faceting variable: a bare column name, a computed expression, or NULL

free_scales

"none", "x", "y", "both"

wrap

If only one variable, wrap into a grid with this many columns

Value

Modified glyph_spec


glyph documentation built on Oct. 21, 2026, 5:12 p.m.