geom_timeline_label: Create a timeline plot of earthquakes with labels showing the...

Description Usage Arguments Value Examples

Description

This function creates a plot showing earthquakes by date, country, and city or region. It is similar to geom_timeline, but has the option to add labels showing the city or region in which the earthquake took place. It uses the GeomTimelineLabel geom.

Usage

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

Arguments

mapping

An aesthetic mapping created by ggplot2::aes.

data

A data frame containing the data to be plotted.

stat

A string indicating the data transformation to be used.

position

A string giving the poistion adjustment.

na.rm

A logical controlling how missing values are handled. If FALSE, missing values are removed and a warning is printed, otherwise missing values are removed without a warning.

show.legend

A logical indicating whether the layer created by this function should have a legend.

inherit.aes

A logical. If FALSE, the default aesthetics are overridden.

n_max

A integer constant. If n_max is used, only the n_max largest earthquakes, as determined by the value of size, are given labels. The default behavior is to label all earthquakes.

...

additional arguments passed to the layer.

Value

This function adds an earthquake timeline plot with labels to the current ggplot.

Examples

1
2
3
4
5
6
eq_data <- eq_clean_data("NOAA_earthquakes.txt")
eq_data <- subset(eq_data, Country == "Mexico" & YEAR >= 2000)

ggplot2::ggplot(eq_data) +
  geom_timeline_label(ggplot2::aes(x=DATE, y=Country, fill=TOTAL_DEATHS,
                          size=EQ_PRIMARY, label=LocalLocation))

lmitchell4/earthquake documentation built on May 29, 2019, 3:42 a.m.