geom_timeline_label: geom_timeline_label ggplot2 geometry

Description Usage Arguments Value Examples

Description

This function create an ad hoc geometry to visualize a label for the timeline of earthquakes. The geometry is represented by a vertical line and a text label. The max number of labels is controlled by the parameter n_max.

Usage

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

Arguments

n_max

MAx number of labels to display per each row. Default = 5.

Value

a ggplot2 geometry

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
data %>%
  dplyr::filter(COUNTRY == "USA" & YEAR > 2000) %>%
  ggplot() +
    geom_timeline(aes(x = DATE, y = COUNTRY, size = EQ_PRIMARY, color = DEATHS)) +
    geom_timeline_label(aes(x = DATE, y = COUNTRY, label = LOCATION_NAME,
      size = EQ_PRIMARY), n_max = 5) +
    labs(size = "Richter Scale value:", color = "# of Deaths:")

## End(Not run)

frenkg/coursera.eq documentation built on May 12, 2019, 1:04 p.m.