geom_timeline: geom_timeline

Description Usage Arguments Value Parameters to Geom Examples

Description

This layer function displays the dates of Earthquakes (coming from your data) 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.

*Note: All of the optional arguments above can be applied as columns of the dataset (inside the function aes), or as individual values (outside of the function aes).

Value

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

Parameters to Geom

data: A Dataframe Object containing the data to plot.

x: Column of 'data' depicting the x-coordinate of where each of the points will be located.

size: OPTIONAL. Column of 'data' depicting size of each point in the pointsGrob displayed (if missing, the first nmax labels will be displayed).

y: OPTIONAL. Column of 'data' depicting the y-coordinate of where each of the points will be located.

colour: OPTIONAL. Column of 'data' depicting the colour of each point in the pointGrob displayed.

shape: OPTIONAL. Column of 'data' depicting the shape of each of the points.

alpha: OPTIONAL. Column of 'data' which will be used to apply the alpha to each point.

fill: OPTIONAL. Color 'string' (added outside of aes) to modify the default fill of the points (before applying colour).

stroke: OPTIONAL. Stroke of the image (need not be used).

*Note: All of the optional arguments above can be applied as columns of the dataset (inside the function aes), or as individual values (outside of the function aes).

Examples

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

## Data Setup

dataset = readr::read_delim("data/signif.txt", delim = "\t") %>%
  eq_clean_data() %>%
  filter(COUNTRY %in% c("USA", "CHINA"), YEAR > 2000)

## Function Call

ggplot2::ggplot(dataset, ggplot2::aes(DATE,
                                      colour = TOTAL_DEATHS,
                                      y = COUNTRY,
                                      size = as.numeric(EQ_PRIMARY) )) +
  geom_timeline() +
  ggplot2::guides(size = ggplot2::guide_legend(title = "Ritcher scale value")) +
  ggplot2::scale_colour_continuous(name = "# of DEATHS") +
  ggplot2::theme_classic()


## End(Not run)

ronybsulca/earthquakeGeoms documentation built on May 6, 2019, 5:03 p.m.