geom_timeline_label: Label Largest Earthquakes on Timeline

Description Usage Arguments Aesthetics Examples

View source: R/geom_timeline_label.R

Description

geom_timeline_label works best when used with geom_timeline, labeling the top n earthquakes, by magnitude, with a specified label field. By default, the labels are for the top 5 earthquakes for each country specified, however, the user may adjust this with the n_max aesthetic.

Usage

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

Arguments

mapping

See ggplot2 layer

data

See ggplot2 layer

stat

See ggplot2 layer

position

See ggplot2 layer

na.rm

See ggplot2 layer

show.legend

See ggplot2 layer

inherit.aes

See ggplot2 layer

...

other arguments passed on to layer.

Aesthetics

geom_timeline_label undertands the following aesthetics (required aesthetics are in bold):

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
library(dplyr); library(ggplot2)
quakes <- eq_load_clean_data()

quakes %>%
  dplyr::filter(COUNTRY %in% c('USA', 'UK')) %>%
  dplyr::filter(DATE > '2000-01-01') %>%
  ggplot() +
  geom_timeline(aes(x = DATE, y = COUNTRY, color = TOTAL_DEATHS,
                    size = EQ_PRIMARY)) +
  geom_timeline_label(aes(x = DATE, y = COUNTRY, magnitude = EQ_PRIMARY,
                         label = LOCATION_NAME, n_max = 5)) +
  scale_size_continuous(name = 'Richter scale value') +
  scale_color_continuous(name = '# of Deaths') +
  theme_eq()

DYZI/Earthquake documentation built on May 7, 2019, 6:54 p.m.