geom_timeline: Make time line points

Description Usage Arguments Value Examples

View source: R/Module2_functions.R

Description

This function makes plot time line of earthquakes in selected time range with a point for each earthquake. Optional aesthetics include color, size, and alpha (for transparency). The xaesthetic is a date and an optional y aesthetic is a factor indicating some stratification in which case multiple time lines will be plotted for each level of the factor (e.g. country).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
geom_timeline(
  mapping = NULL,
  data = NULL,
  stat = "identity",
  position = "identity",
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = TRUE,
  ...
)

Arguments

mapping

List of aesthetic created by aes() to use for plot.

data

The data to be displayed in this layer. NULL, the default, is the data inherited from the plot data as specified in the call to ggplot().

stat

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

position

Position adjustment.

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.

inherit.aes

Will aesthetics be inherited (TRUE/FALSE). If FALSE, overrides the default aesthetics, rather than combining with them.

...

Other arguments passed on to layer.

Value

PointsGrob object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
readr::read_delim("signif.txt", delim = "\t") %>%
eq_clean_data() %>%
 dplyr::filter((COUNTRY == "USA" ) & (lubridate::year(DATE) >= 2000 &
                                        lubridate::year(DATE) <= 2020)) %>%
 ggplot() +
 theme_eq + ggplot2::labs(size = "Richter scale value", fill = "# deaths") +
 geom_timeline( aes(x = DATE, size = EQ_PRIMARY, fill = DEATHS))

## End(Not run)

piavat/eqPlotc5 documentation built on Feb. 20, 2021, 12:15 a.m.