Build Status

Package "eqplot"

This package will provide tools to visualize the earthquake dataset obtained from the U.S. National Oceanographic and Atmospheric Administration (NOAA) on significant earthquakes around the world. This dataset contains information about 5,933 earthquakes over an approximately 4,000 year time span.

Installation

You can install eqplot from github with:

# install.packages("devtools")
devtools::install_github("atibot/eqplot", build_vignettes = TRUE)

Examples

These are basic examples which show you how to solve common problems.

Timeline plot

## basic example code
library(dplyr)
library(lubridate)
data("raw_df")
test_df <-
raw_df %>% eq_clean_data() %>%
dplyr::filter(COUNTRY == "TURKEY" | COUNTRY == "JAPAN") %>%
dplyr::filter(DATE >= eq_date("2000-01-01") & DATE <= eq_date("2017-01-01"))
# plot timeline
ggtimeline <- ggplot2::ggplot(test_df)
ggtimeline2 <- ggtimeline + geom_timeline(
ggplot2::aes(
x = DATE,
y = COUNTRY,
size = EQ_PRIMARY,
fill = TOTAL_DEATHS
)
) +
eq_theme +
ggplot2::scale_size_continuous(name = "Richer scale value", breaks = c(0, 2, 4, 6, 8)) +
ggplot2::scale_fill_continuous(name = "# deaths") +
ggplot2::labs(title = "Earthquakes")
# plot labels
ggtimeline3 <- ggtimeline2 + geom_timeline_label(ggplot2::aes(
x = DATE,
y = COUNTRY,
mag = EQ_PRIMARY,
label = LOCATION_NAME
),
n_max = 5)
#draw plot
ggtimeline3

Map plot with Date

data("raw_df")
raw_df %>% eq_clean_data() %>%
dplyr::filter(COUNTRY == "MEXICO" & lubridate::year(DATE) >= 2000) %>%
eq_map(annot_col = "DATE")

Map plot with Date, Location, Magnitude and Deaths

data("raw_df")
raw_df %>% eq_clean_data() %>%
dplyr::filter(COUNTRY == "MEXICO" & lubridate::year(DATE) >= 2000) %>%
dplyr::mutate(popup_text = eq_create_label(.)) %>%
eq_map(annot_col = "popup_text")

Map plot with Cluster options

data("raw_df")
raw_df %>% eq_clean_data() %>%
dplyr::mutate(popup_text = eq_create_label(.)) %>%
eq_map(annot_col = "popup_text", cluster = TRUE)

Vignette

Once the package is installed, view the vignette for more details.

vignette(topic = "eqplot", package = "eqplot")


atibot/eqplot documentation built on May 17, 2019, 4 p.m.