geom_timeline_label: The geom_timeline_label function

Description Usage Arguments Examples

View source: R/geoms.R

Description

Used in conjunction with GeomTimelineLabel. See the layout contained within the course materials p.g. 452 Note that you should run geom_timeline first such that we have our points to annotate This geom will then look to annotate the largest n_max earthquakes with a vertical line and a label tagging these points. Given that we are only annotating n_max earthquakes we sort the data by magnitude and select the largest before plotting.

Usage

1
2
3
geom_timeline_label(mapping = NULL, data = NULL, stat = "identity",
  position = "identity", na.rm = FALSE, show.legend = NA,
  inherit.aes = TRUE, n_max = 5, ...)

Arguments

n_max

An integer (default = 5) indicating the maximum number of earthquakes to display.

Examples

 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)

simongarisch/R-Capstone-NOAA documentation built on May 24, 2019, 7:25 p.m.