geom_timeline: Create a timeline geom

Description Usage Arguments Value Note Examples

Description

This function adds a geom which displays a timeline for NOAA earthquake data. This is the basic timeline visualization without additional modifications. For a cleaner visualization the wrapper function, eq_time, should be used.

Usage

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

Arguments

mapping

A set of aesthetic mappings. If null, uses the default setting in ggplot()

data

A dataset If null, uses the default data specified in ggplot()

stat

The name of the statistical transformation to use. Identity means keep the data as is.

position

The method used to adjust overlapping objects. Identity means keep the position as is.

na.rm

Flag to remove values with NA

show.legend

Flag to say whether layer should be present in legend.

inherit.aes

Flag to say whether default aesthetics should be inherited.

...

Additional arguments passed to layer()

Value

This function returns a layer that can be added to a plot using the ggplot function

Note

The parameters for GeomTimeLine include columns from the earthquake data: Required parameters: x=DATE Optional parameters: y=COUNTRY,size=EQ_PRIMARY,color=DEATHS,alpha=x where x is a number from 0 to 1

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
readr::read_delim(filename, delim = "\t") %>%
eq_clean_data() %>%
dplyr::filter(COUNTRY == "USA" & lubridate::year(DATE) >= 2000) %>%
ggplot() +
geom_timeline(aes(x=DATE,size=EQ_PRIMARY,color=DEATHS),alpha=0.5)

readr::read_delim(filename, delim = "\t") %>%
eq_clean_data() %>%
dplyr::filter((COUNTRY=="USA" | COUNTRY=="CHINA") & lubridate::year(DATE) >= 2000) %>%
ggplot() +
geom_timeline(aes(x=DATE,y=COUNTRY,size=EQ_PRIMARY,color=DEATHS),alpha=0.5)


## End(Not run)

leigitcode/earthquakesViz documentation built on May 7, 2019, 11:14 a.m.