Documentation

13.22 Custom plots: kinds, scopes, and variables

Each [[plot]] block adds one named plot. The nine kinds are scatter, line, summary, box, histogram, bar, corr, pairs, and pkpd. Only a name, kind, and required variables are needed, but scope is the most important conceptual choice.

Anatomy of a custom plot specification

Scopes

observations uses eligible observation records; doses uses dose records; all uses every record; subjects uses one derived row per individual. If scope is omitted, EDA chooses observations when requested variables are record-level and subjects otherwise. Explicit scope is safer for governed analyses.

Available record-derived columns include TAD, TAFD, latest DOSE, DVNORM, BLQ, EVENT, PKOBS, and GROUP_ALL. Subject scope adds NOBS, NDOSE, NBLQ, DOSE1, TOTDOSE, CMAX/TMAX/CMIN/CLAST/TLAST/AUCLAST and dose-normalized metrics.

Variable requirements

Scatter, line, and summary require x and y. Box uses category x and numeric y. Histogram uses x. Bar can count x or summarize y. Corr/pairs use vars (internally accepted through the variables list). PK-PD needs appropriate PK/PD data. A list of x or y variables creates panels/pages.

[[plot]]
name = "exposure_vs_bmi"
kind = "scatter"
scope = "subjects"
x = "BMI"
y = ["CMAXD", "AUCLASTD"]
color = "SEX"
smooth = "linear"

Unknown columns stop the run with a configuration error listing available columns. This is preferable to silently drawing an empty plot.

Common mistakes

  • Mixing record-level DV with subject-level AUCLAST under the wrong scope.
  • Leaving auto-scope unreviewed.
  • Giving two custom outputs the same name.
  • Treating custom graphics as outside the analysis audit trail.

Checklist

  • State the population/scope first.
  • Verify every variable and unit.
  • Choose a kind matching the question and data type.
  • Use unique stable names.
  • Review row counts and exclusions.

Further reading

See custom axes/facets, derived columns, and the worked custom plot.