Chapter 7 eq_map
This function plots circles on OpenStreetMaps, which represents earthquakes. When you click in it appaers a popup, which shows a single information (that you define as annot_col
).
7.1 Example 1
Plotting circles and popup Date of earthquake.
# Path to the raw data.
raw_data_path <- system.file("extdata", "signif.txt", package = "msdr")
# Loading the dataset of Earthquake.
df <- readr::read_delim(file = raw_data_path,
delim = '\t',
col_names = TRUE,
progress = FALSE,
col_types = readr::cols())
# Ploting all earthquakes from 1500 to 1700.
df %>%
# Converting data, cleaning and creating.
eq_clean_data() %>%
#Filtering.
filter(YEAR > 1500 &
YEAR < 1700) %>%
# Adding circles and popups.
eq_map(annot_col = 'DATE')
The popups shows the DATE
when you click the circle.
7.2 Example 2
Popup showing the Location of earthquake.
# Ploting all earthquakes from 1500 to 1700.
df %>%
# Converting data, cleaning and creating.
eq_clean_data() %>%
#Filtering.
filter(YEAR > 1000 &
YEAR < 2019,
COUNTRY %in% 'CHILE') %>%
# Adding circles and popups.
eq_map(annot_col = 'LOCATION')
In this example I have selected the earthquakes in Chile. The function has autozoom to fit the circles in the view.