Skip to contents

This internal function adds a custom text annotation to a ggplot object, positioning it at a specified proportion of the plot's x and y axis ranges. The default annotation is used to indicate epidemic control.

Usage

adorn_annotation(
  p,
  annotation_label = "<-- Epidemic control",
  annotation_proportion = 0.9
)

Arguments

p

A ggplot2 plot object to which the annotation will be added.

annotation_label

A character string specifying the text to annotate the plot with. The default value is "<– Epidemic control".

annotation_proportion

A numeric value between 0 and 1 indicating the position of the annotation relative to the axis ranges. Default is 0.9, placing the annotation close to the top-right of the plot.

Value

The original ggplot2 plot object with the annotation added.

Details

This function calculates the annotation position based on the specified proportion of the plot's axis limits. The annotation is angled at 45 degrees to provide visual emphasis, typically used to indicate a threshold or a notable point in the data.