geom_timeline: Module 2: Visualize the times at which earthquakes occur...

Description Usage Arguments Details Value Examples

View source: R/geom_timeline.R

Description

Module 2: Visualize the times at which earthquakes occur within certain countries

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

Create asthetics mapping.

data

The data

stat

The statistical transformation 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

show the legends or not

inherit.aes

the default aesthetics

...

Other arguments passed on to [layer()]. These are often aesthetics, used to set an aesthetic to a fixed value, like 'colour = "red"' or 'size = 3'. They may also be parameters to the paired geom/stat.

#' @section Aesthetics: geom_timeline understands the following aesthetics

  • x # Time variable

  • y # Factor indicating some stratification

  • color # Color of border of elements

  • shape # Shape

  • size # Size

  • alpha # Transparency (1: opaque; 0: transparent)

  • fill # Color of inside of elements

  • stroke # Stroke

Details

The data to be used with this geom from NOAA website

Value

Produce a time line plot of selected earthquakes.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# The data must be cleaned using the function \code{eq_clean_data}, included in the package.
# Aesthetics can be specified in the \code{ggplot} function or in \code{geom_timeline} geom function
## Not run: 
data <- readr::read_delim("signif.txt", delim = "\t")
data <- eq_clean_data(data)
data %>%
dplyr::filter(COUNTRY == c("MEXICO","USA") & lubridate::year(DATE) >= 2010) %>%
ggplot(aes(x=DATE,y=COUNTRY,color=TOTAL_DEATHS,size=EQ_PRIMARY)) +
geom_timeline(alpha=.5) +
theme(legend.position="bottom", legend.box="horizontal", plot.title=element_text(hjust=0.5)) +
ggtitle("Earthquakes Visualization Tool") +
labs(size = "Richter scale value", color = "# deaths")

## End(Not run)

vnmath/SoftwareDevinR documentation built on July 6, 2020, 9:36 a.m.