geom_timeline: geom_timeline ggplot2 geometry

Description Usage Arguments Value Examples

View source: R/plot.R

Description

This function create an ad hoc geometry to visualize the timeline of earthquakes. Each earthquake is represented by a point, with size and color aestethics ready to be assigned a variable.

Usage

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

Arguments

mapping

Set of aesthetic mappings created by aes or aes_.

data

The data to be displayed in this layer.

stat

The statistical transformation to use on the data for this layer, as a string.

position

Position adjustment, either as a string, or the result of a call to a position adjustment function.

na.rm

If FALSE, the default, missing values are removed with a warning. If TRUE, missing values are silently removed.

show.legend

logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. FALSE never includes, and TRUE always includes.

inherit.aes

If FALSE, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification, e.g. borders.

...

other arguments passed on to layer. These are often aesthetics, used to set an aesthetic to a fixed value, like color = "red" or size = 3. They may also be parameters to the paired geom/stat.

Value

a ggplot2 geometry

Examples

1
2
3
4
5
6
7
8
## Not run: 
data %>%
dplyr::filter(COUNTRY == "USA" & YEAR > 2000) %>%
  ggplot() +
    geom_timeline(aes(x = DATE, y = COUNTRY, size = EQ_PRIMARY, color = DEATHS)) +
    labs(size = "Richter Scale value:", color = "# of Deaths:")

## End(Not run)

frenkg/courseraeq documentation built on May 22, 2019, 12:42 p.m.