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 labels parameter. Pass the result of the layer_labels() call to configure the label content and layout.

    Learn more (reference notebook).

  • Annotations for geom_smooth(). Use the labels parameter together with smooth_labels() to display statistics computed by the smooth stat (for example, \(R^2\), adjusted \(R^2\), and a fitted model equation). smooth_labels extends layer_labels, so formatting and text template helpers work the same way.

    Learn more (reference notebook).

See also the formatting reference to learn how to format numeric and date-time values in annotations.

Examples#