eqvis
provides functions to visualize the NOAA earthquake data using either a timeline or map. The earthquake
data must be cleaned first using the eq_clean_data
function. With this function, the country and colon are removed from the LOCATION_NAME
and it is converted to title case. A new DATE
column is derived from the date parts (YEAR, MONTH, DAY
). LATITUDE
and LONGITUDE
are converted to numeric.
A timeline can be produced using ggplot2 with the geom_timeline/stat_timeline functions. It will plot a timeline with
points for each earthquake and can optionally include a size and color/fill aesthectics. If xmin and xmax aesthetics
are provided, stat_timeline will subset the data. The geom_timeline_label function can be used to add a label geom. It
print the label
aesthetic for the top n_max
earthquakes in terms of magnitude.
A map can be produced using eq_map()
. It will display circle markers at the lat/lon locations with a radius
based on the magnitude of the earthquake and popup text reflecting the annotation column provided. An optional
eq_create_label
function is provided that generate label text using the location name, magnitude and deaths
for the earthquake.
The data can be retrieved with the following:
file_url <- "https://www.ngdc.noaa.gov/nndc/struts/results?type_0=Exact&query_0=$ID&t=101650&s=13&d=189&dfn=signif.txt"
eq <- read.delim(file_url)
Maintainer: Kim Aquilino kim.aquilino@gmail.com
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.