add_event: Add an Event Marker on a Plot

View source: R/plot.R

add_eventR Documentation

Add an Event Marker on a Plot

Description

add_event() adds a vertical line and a label denoting an event to a ggplot object.

Usage

add_event(
  gg_obj,
  date,
  lab,
  lab_y,
  hjust = 0,
  vjust = 0,
  angle = -90,
  face = c("bold", "italic", "bold.italic", "plain"),
  line = c("dashed", "solid", "blank", "dotted"),
  color = "grey30",
  ...
)

Arguments

gg_obj

A ggplot object

date

The date of the event

lab

The event label

lab_y

The y coordinate of the event label

hjust

The horizontal alignment of the event label; defaults to 0

vjust

The vertical alignment of the event label; defaults to 0

angle

The angle of the event label; defaults to -90, which reads "sideways" from top to bottom. This is a tradeoff that creates space on most time series plots.

face

The font face of the label text

line

The type of vertical line to use

color

Line and text color

...

Additional arguments to pass to geom_text()

Value

The modified ggplot object


jesse-smith/coviData documentation built on Jan. 14, 2023, 11:08 a.m.