The time line is plotted horizontally with ticks for years. The labels with descriptions are above and/or below that line.

plot_timeline(
  events_df,
  ys,
  description_width = 20,
  expand_x = c(0.1, 0.1),
  expand_y = c(0.05, 0.05),
  include_refs = TRUE
)

Arguments

events_df

A data frame with at least these columns:

date_published

A vector of Date objects for dates when the event of interest was published. Note that the actual time when those events occurred is most likely earlier, sometimes much earlier than the publication date, and the events might have become quite influential before their publication. But the publication date is the easiest way to get an actual date.

description

Short descriptions of the events. The plot won't look good if the descriptions are too long.

ys

A numeric vector of the y coordinates of the items. Since I don't know how to implement the ggrepel algorithm to make sure that the labels don't overlap for geom_richtext, I have to manually set the y coordinates to make sure that the labels don't overlap and look good.

description_width

Width of the description text in characters to wrap the text in the labels.

expand_x

A numeric vector of length 2 of the proportion to expand the x axis on the left and the right. This is a way to manually make sure that the labels are not cropped off at the edge of the plot.

expand_y

Same as expand_x, but for the y axis.

include_refs

Logical, indicating whether to include references in the text box.

Value

A ggplot2 object for the plot.