geom_timeline: geom_timeline

Description Usage Arguments Value Examples

View source: R/geom_timeline.R

Description

This function displays the dates of Earthquakes by presenting each Earthquake, on a straight line, as a point of varying sizes depending on their Ritcher scale value (based on the size variable). The Earthquakes are color coded by the death toll it caused (colour). If the y variable is supplied, the Earthquakes will be displayed in multiple horizontal lines, each line represnting the quakes for each Country.

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

Mapping argument to the ggplot layer function.

data

A Dataframe Object containing the data to plot.

stat

Stat argument to the ggplot layer function.

position

Position argument to the ggplot layer function.

na.rm

na.rm argument to the ggplot layer function.

show.legend

show.legend argument to the ggplot layer function.

inherit.aes

inherit.aes argument to the ggplot layer function.

...

Extra Params.

Value

This function adds the lineGrobs and pointGrob into the current graphics device.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: 

filename <- system.file("extdata", "signif.txt", package="earthquakeGeoms")
library(readr)
input <- readr::read_delim(filename, delim = "\t")

 sample <- input %>%
 eq_clean_data() %>%
 eq_location_clean("LOCATION_NAME")%>%
 filter(YEAR >= 2000) %>%
 filter(COUNTRY %in% c("USA", "MEXICO"))

ggplot2::ggplot(data=sample, aes(x = date, y = COUNTRY, color = DEATHS, size = EQ_PRIMARY)) +
 geom_timeline() +
 scale_size_continuous(name = 'Richter scale value', guide = guide_legend(order = 1)) +
 scale_color_continuous(name = '# of Deaths', guide = guide_colorbar(order = 2))


## End(Not run)

marcelamu95/earthquakeGeoms documentation built on Nov. 21, 2019, 4:46 a.m.