geom_timeline_label: Function to plot earthquakes timelines

Description Usage Arguments Value Examples

View source: R/functions.R

Description

This function receives the ggplot2 parameters plus the Geom Timeline to add the earthquakes timeline layer in a ggplot2 object

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
geom_timeline_label(
  mapping = NULL,
  data = NULL,
  stat = "identity",
  position = "identity",
  na.rm = FALSE,
  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

Previous calculation to prepare dataframe to be plotted

position

Position adjustment. Could be a string or the result of a call to a position adjustment function.

na.rm

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

show.legend

logical. Should this layer be included in the legends? NA, the default, incldes 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 usefule for helper functions that define both data and aesthetics and shouldn't inherit behavior from the default plot specification, e.t. borders.

...

Other arguments passed on layer like color = "red" or size = 3.

Value

The layer containing the elements created with Geom GeomTimeline

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
readr::read_delim("earthquakes.txt", delim = "\t") %>%
eq_clean_data() %>%
dplyr::filter(COUNTRY %in% c("CHINA", "USA") & lubridate::year(DATE) >= 2000) %>%
ggplot2::ggplot(ggplot2::aes(x = DATE, y = COUNTRY, size = EQ_PRIMARY, colour = DEATHS)) +
geom_timeline() +
geom_timeline_label(ggplot2::aes(label = LOCATION, n_max = 6)) +
xlab("Date") + ylab("") +
labs(size = "Richter scale", color = "# deaths" ) +
theme(axis.line.y=element_blank(),panel.background=element_blank())

## End(Not run)

danielfsilva88/quakeTools documentation built on Sept. 13, 2020, 12:13 a.m.