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.
You can install eqplot from github with:
# install.packages("devtools") devtools::install_github("atibot/eqplot", build_vignettes = TRUE)
These are basic examples which show you how to solve common problems.
## 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
data("raw_df") raw_df %>% eq_clean_data() %>% dplyr::filter(COUNTRY == "MEXICO" & lubridate::year(DATE) >= 2000) %>% eq_map(annot_col = "DATE")
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")
data("raw_df") raw_df %>% eq_clean_data() %>% dplyr::mutate(popup_text = eq_create_label(.)) %>% eq_map(annot_col = "popup_text", cluster = TRUE)
Once the package is installed, view the vignette for more details.
vignette(topic = "eqplot", package = "eqplot")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.