geom_timeline_label: Plot a labeled timeline of earthquakes within a given time...

Description Usage Arguments Value Examples

Description

This function utilizes the GeomTimelineLable geom to plot the earthquake events with labels (location of the earthquake). There is an option to subset to n_max number of earthquakes, where we take the n_max largest (by magnitude) earthquakes. In the provided example, the color aes reflects the number of deaths resulted from the earthquake with grey ones indicating no data available. The size aes reflects the magnitude of the eqrthquake. The X-axis is the date. n_max can be customized, the default value is 5.

Usage

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

Arguments

mapping

Aesthetic mappings created by aes

data

Dataset from NOAA website

stat

The statistical transformation used

position

Position adjustment function

na.rm

Remove the NA values from the data frame

show.legend

Legend

inherit.aes

Default aesthetics

...

Other arguments

Value

The labeled timeline plot.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#Pick data points ranging from date \code{xmin} to \code{xmax} from the cleaned dataset to plot
           ## Not run: eq_tidy_data <- eq_clean_data(eq_download_data())
           ## Not run: xmin <- as.Date("1999-01-01")
           ## Not run: xmax <- as.Date("1999-07-01")
           ## Not run: sample_data <- filter(eq_tidy_data, DATE >= xmin & DATE <= xmax)
           ## Not run: ggplot(sample_data,
                   aes(x = DATE, label = LOCATION, size = EQ_PRIMARY, fill = DEATHS,
                   color = DEATHS, n_max = 4)) +
                   geom_timeline_label() +
                   theme_minimal()
## End(Not run)

perfectslumber/NOAAsignif documentation built on May 23, 2019, 5:04 a.m.