Description Usage Format Examples
The geom_* function is constructed as a regular function. Build a geom called geom_timeline_label() for adding annotations to the earthquake data. This geom adds a vertical line to each data point with a text annotation (e.g. the location of the earthquake) attached to each line. There should be an option to subset to n_max number of earthquakes, where we take the n_max largest (by magnitude) earthquakes. Aesthetics are x, which is the date of the earthquake and label which takes the column name from which annotations will be obtained. Note that you should run geom_timeline first such that we have our points to annotate.
1 |
An object of class GeomTimelineLabel
(inherits from Geom
, ggproto
, gg
) of length 5.
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## Not run:
ggplot(df, aes(x = date, y = COUNTRY,
color = as.numeric(TOTAL_DEATHS),
size = as.numeric(EQ_PRIMARY),
label = CLEAN_LOCATION_NAME)) +
geom_timeline() +
labs(size = "Richter scale value", color = "# deaths") +
ggplot2::theme(panel.background = ggplot2::element_blank(),
legend.position = "bottom",
axis.title.y = ggplot2::element_blank()) + ggplot2::xlab("DATE") +
geom_timeline_label(data=df)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.