Plot

Compose graphable children with linear axes, grid lines, measured tick labels, axis titles, an optional legend, and an optional background. Limits follow Graph; inferred limits receive 5% padding by default.

PropertyDefaultMeaning
coordInferred[xmin, ymin, xmax, ymax] shorthand for both limits
xlim / ylimInferredDirected data limits
flip-x / flip-yfalse / trueReverse horizontal or vertical screen mapping
padding0.05Inferred-limit fractions: scalar, side/axis object, [h, v], or [t, b, l, r]
axistrueEnable or disable both axes by default
xaxis / yaxisaxisBoolean or Axis props for one axis
xticks / yticks5Target count or explicit values / labeled pairs
gridtrueDraw grid lines at axis ticks
title / xlabel / ylabel—String or Element; the y title rotates −90°
legend—Legend Element or array of Legend entries
marginem(3/4)Extra outer space; accepts Box padding forms
label-gapem(1/2)Space between titles and measured axis extents
bounds"outer""frame" makes the allocation the data area alone; see below
background—Full-frame background paint
plot-background—Data-area background paint
border-widthpx(0)Data-area border thickness
border-color"theme:border"Data-area border paint
cliptrueClip data marks to the data area
axis-* / xaxis-* / yaxis-*—Flat Axis option overrides
tick-* / label-*—Shared generated tick and label styles
title-* / xlabel-* / ylabel-*—Generated title text options
grid-* / xgrid-* / ygrid-*—Grid options and styles
legend-*—Generated Legend options
*-style—Nested options for the corresponding scopes

Padding uses Graph's side and axis forms, with numeric fractions of inferred data spans. Explicit limits stay exact.

Fonts inherit from the parent (16px at the root). Axis and grid strokes default to em(1/16), tick lengths to em(5/16), and tick-label offsets to em(1/4). These details, margin, and label-gap scale with font-size; changing only the plot's width or height keeps them the same size. Label-specific font overrides leave axis geometry unchanged. Use axis-stroke-width, tick-stroke-width, or grid-stroke-width with px(...) for fixed thicknesses. Margins come from measured axis overflow and title sizes. Text uses theme:text, axes use theme:muted, and grid lines use theme:neutral. These paints follow the inherited theme. Title and x title wrap at the usable width. Explicit margin adds space to those measurements. The fragment's content rectangle identifies the data area.

For example, axis-stroke={slate} affects both axes and xaxis-label-color={blue} changes only the x tick labels. Use axis-tick-side="inner" to point both axes' ticks into the data area. Common tick/label settings precede common axis settings, then xaxis/yaxis option objects, then flat xaxis-/yaxis- props. Part option records merge per field. At the same scope, flat props override matching nested settings. title-wrap={false} disables title wrapping. See scoped props.

Scopes preserve label-gap and do not enable an explicitly disabled axis. Plot supplies axis/grid domains; explicit xticks/yticks override scoped axis tick options. Callback props such as xaxis-format run when the axes are constructed. Supplied title, label, and legend Elements retain their own descriptions.

Plot fills finite offers, naturally measures 480×320, and derives a missing axis at 1.5 unless aspect is supplied. In a stack, give it a preferred height or an explicit flex allocation. Small frames can exhaust the data area and report overflow; they never shrink text to fit.

With bounds="frame", the allocation is the data area itself: width, height, and aspect size the graph frame, and ticks, labels, and titles sit outside it. Stacked plots then align their data areas whatever their tick labels measure, and an identified plot connects at its frame. Containers do not make room for those decorations, so leave a large enough gap or padding around the plot. The space they need, including margin, is reported as the fragment's outset, and a hugging Page viewport grows to include it.

This first version has linear scales. Log/date scales, minor ticks, label collision avoidance, automatic legend extraction, and legend placement optimization are deferred. Use fewer ticks, shorter labels, or an axis rotate option for crowded categories.