GeomTimelineLabel: ggplot geom to plot text annotations for a time line of...

Description Usage Arguments Format Value Examples

Description

This function reads an Earthquake dataset in a dataframe format to create annotations to the plotted data.This geom adds a vertical line to each data point with a text annotation showing the location (or other information) of the earthquake attached to each line. The x aesthetic is a date and an optional y aesthetic is a factor that stratifies the data by country, in which case multiple time lines will be plotted, one for each country. The label aesthetic indicates the name of the location of the earthquake (or the information to be dislayed). There is the option to subset to n_max number of earthquakes, where the function takes the n_max largest (by magnitude) earthquakes.

Usage

1

Arguments

x

A character vector ofthe dates when the earthquakes took place.

label

A character vector of the names of the locations wherein earthquakes took place.

y

Optional aesthetic which contains a character vector of the country names wherein the earthquakes took place.

n_max

Optional aesthetic that represents a number indicating the number of the largest earthquakes (by magnitude) to be annotated.

magnitude

Optional aesthetic which contains a numeric vector of the magnitude (in the Richter scale) of each earthquake.

Format

An object of class GeomTimelineLabel (inherits from Geom, ggproto) of length 5.

Value

A geom to plot text labels for location (but also for date, magnitude, deaths, etc) linked to selected earthquakes which can be added to a ggplot.

Examples

1
2
3
4
5
## Not run: 
quakedata<-eq_clean_data("signif.txt") %>% eq_location_clean()
ggplot() + geom_timeline(data = quakedata,aes(x = DATETIME, y = COUNTRY, size = EQ_PRIMARY, colour = TOTAL_DEATHS)) + geom_timeline_label(data = quakedata,aes(x = DATETIME, label = LOCATION_NAME,y = COUNTRY, n_max = 10, magnitude = EQ_PRIMARY)) + scale_color_gradient()

## End(Not run)

DanielAyllon/EarthQuakeAnalyzer documentation built on May 6, 2019, 1:23 p.m.