Annotating Charts#
Lets-Plot provides several ways to annotate charts:
Label annotations for geometry layers. Some geoms (such as pie, bar, and crossbar) support built-in text labels via the
labelsparameter. Pass the result of thelayer_labels()call to configure the label content and layout.
Annotations for
geom_smooth(). Use thelabelsparameter together withsmooth_labels()to display statistics computed by thesmoothstat (for example, \(R^2\), adjusted \(R^2\), and a fitted model equation).smooth_labelsextendslayer_labels, so formatting and text template helpers work the same way.
Bracket annotations. Use
geom_bracket()to add labeled brackets highlighting relationships between categories or marking an interval. Usegeom_bracket_dodge()to draw brackets that connect dodged groups within each category (e.g., comparisons inside grouped boxplots/bars).
See also the formatting reference to learn how to format numeric and date-time values in annotations.