The eqvis
package provides functions for cleaning and plotting NOAA significant earthquake dataset 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.
The NOAA earthquake dataset can be accessed from: https://www.ngdc.noaa.gov/nndc/struts/results?type_0=Exact&query_0=$ID&t=101650&s=13&d=189&dfn=signif.txt. This dataset contains information about 5,933 earthquakes around the world over an approximately 4,000 year time span. This package was developed to work with years AC only.
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.
A sample_eq
dataset is provided. It is a subset of the complete NOAA dataset, filtered for COUNTRY
values USA
and MEXICO
and YEAR
2000-2017.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.