The built-in geoms
Each is a function that returns a layer. Pass options to configure the layer, and geom-specific
params for its geometry and behavior. Paint (colors, widths, opacities) lives in the stylesheet instead:
Params and paint, geom by geom
params set geometry and behavior; the style.* target beside them holds the geom’s paint.
Every target also takes the shared
alpha and saturation, plus its paint word: fill on a bar, area, point or tile, stroke on a line or rule. A dash pattern is a dashArray in the stylesheet ([] solid, [4, 2] dashed) and a lineType name ('solid', 'dashed', 'dotted') when mapped from data. Two things catch people out. A geom’s cornerRadius is a token ('none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full') or a number of pixels. And a defaults entry loses to a mapped aesthetic, while an overrides entry beats it. Styling has the full cascade.
A
params key the geom does not declare is accepted and ignored.Layers
Everygeom.*() you pipe in adds a layer. Layers draw in order, so later ones sit on top. They share the spec-level mapping unless one overrides it. This is how combo charts are built:
Common layer options
Beyondparams, every geom accepts these options:
Position modes
When several observations share the same x (becausecolor or group splits the data), a layer’s position decides how they arrange:
Each geom has its own default:
geom.bar() is 'dodge', geom.area() is 'stack', and geom.point(), geom.line(), geom.rule() and geom.tile() are 'identity'. So a bar chart with a color mapping comes out grouped and an area chart comes out stacked, with no position of your own. geom.tile() accepts only 'identity'; any other value fails to compile.
Next
- Scales — map values to positions, colors and sizes
- Styling — the stylesheet that paints every geom
- Statistics — summarize a layer before drawing it
- Chart types — geoms assembled into recipes
- Heatmap & waffle — the tile geom end to end

