geom_timeline_label: Label timeline geom for NOAA earthquakes data

Description Usage Arguments Value Examples

View source: R/NOAAviz.R

Description

geom_timeline_label is used for adding annotations to NOAA 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." (Mastering Software Development in R Capstone, Week 2)

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

aesthetic mappings

data

The datafram to create a timeline for

stat

The stat to transform the data with, by default "identity"

position

Adjusts the position of the layer in the grob

na.rm

If FALSE, the default, missing values are removed with a warning. If TRUE, missing values are silently removed.

show.legend

Display legends

inherit.aes

Should the aes be inherited

...

Other args

Value

a ggplot timeline object with labels

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
paste0("https://www.ngdc.noaa.gov/",
       "nndc/struts/results?type_0=Exact&",
       "signif.txtquery_0=$ID&t=101650&s=13&",
       "d=189&dfn=signif.txt") %>%
    readr::read_delim(delim = "\t") %>%
    eq_clean_data() %>%
    dplyr::filter(COUNTRY = "ANTARTICA") %>%
    ggplot2::ggplot(aes(x = DATE, Y = COUNTRY)) +
    geom_timeline() +
    geom_timeline_label(aes(label = LOCATION_NAME),
                        n_max = 5)

## End(Not run)

jdallmann/NOAAviz documentation built on Nov. 4, 2019, 2:35 p.m.