plot_timeline | R Documentation |
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
)
events_df |
A data frame with at least these columns:
|
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. |
A ggplot2 object for the plot.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.