geom_timeline_label: Make a time line label geom

Description Usage Arguments Value Examples

Description

geom_timeline_label() function makes a ggplot2::Geom intended 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 is 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.

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

ggplot parameter

data

Earthquake data in the dataframe in format of NOAA earthquakes database (Dataframe), mandatory.

stat

ggplot parameter

position

ggplot parameter

na.rm

ggplot parameter

show.legend

ggplot parameter

inherit.aes

ggplot parameter

...

other ggplot parameter

The folloing parameters must be passed as parameters of aesthetic:

xmindate Minimal date of the considering time frame (Date), mandatory. xmaxdate Maximum date of the considering time frame (Date), mandatory. event_date Date of earthquake, usually name of the column in data (Date), mandatory. richter Richter's magnitude of earthquakes, usually name of the column in data (numeric), mandatory. death Deaths produced by earthquakes, usually name of the column in data (numeric), mandatory. labels Text labels of earthquakes, usually name of the column in data (character), mandatory.

Value

Timeline labels geom (ggplot2 object)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
  ggplot2::ggplot() +
  theme_void() +
  geom_timeline(data = earthquakes, aes(event_date = DATE,
                                  xmindate = 2000,
                                  xmaxdate = 2010,
                                  richter = EQ_PRIMARY,
                                  death = DEATHS,
                                  transparency = 0.3,
                                  colour = "red",
                                 scale = 0.5,
                                  layers = COUNTRY))+
  theme(legend.position="none") +
  geom_timeline_label(data = earthquakes, aes(event_date = DATE,
                                        xmindate = 2000,
                                        xmaxdate = 2010,
                                        richter = EQ_PRIMARY,
                                        layers = COUNTRY,
                                       labels = LOCATION_NAME))

flyeye/earthquakes documentation built on May 16, 2019, 1:42 p.m.