geom_timeline_label: Geom for Timeline Data

Description Usage Arguments Examples

Description

This is a simple geom function to display

Usage

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

Arguments

mapping

Mapping

data

Data

stat

Stat

position

position

...

nothing special

na.rm

Whether remove NA or not

n_max

Maximum number of labels

show.legend

Show legend

inherit.aes

Inherit aes

Examples

1
2
3
4
5
6
7
8
library(ggplot2)
library(dplyr)
library(grid)

datapath <- system.file("extdata", "earthquakes.txt", package = "gsedr")
data <- readr::read_delim(datapath, delim = "\t") %>% eq_clean_data()
ddd <- data %>% dplyr::filter(COUNTRY %in% c('USA', 'JAPAN','TURKEY','HAITI','INDONESIA')) %>% dplyr::filter(!is.na(EQ_PRIMARY), !is.na(DEATHS)) %>% dplyr::filter(YEAR > 1900)
ddd %>% ggplot(aes(x=DATE,y=COUNTRY,size=as.numeric(EQ_PRIMARY),colour=as.numeric(TOTAL_DEATHS))) + geom_point(alpha=0.6) + geom_timeline_label(aes(label = LOCATION_NAME), n_max = 3) + scale_colour_gradient(low="skyblue",high = "red") + annotate("text", label = "ship", parse=TRUE) + labs(size = "Richter scale value", color = "# deaths") + theme_minimal()

ksnt/gsedr documentation built on May 12, 2019, 1:05 p.m.