Tracking Mt. Vesuvius: Seismic Centroids on the Move
The graphic highlights a subtle but consistent westward shift in the center of seismic activity at Mount Vesuvius over the past decade.
#TidyTuesday
Raster
Maps
{ggmap}
Author
Aditya Dahiya
Published
May 11, 2025
About the Data
This dataset captures seismic activity at Mount Vesuvius, one of the most iconic and closely monitored volcanoes in the world, located in Campania, Italy. The data originates from the Istituto Nazionale di Geofisica e Vulcanologia (INGV), Italy’s national institute for geophysics and volcanology, and is accessible through its Open Data Portal. The specific dataset was curated from the GOSSIP portal, which offers interactive access to seismic records for various volcanic regions. Originally available as individual CSV files in Italian, the dataset was consolidated and partially translated into English for broader usability. It includes variables such as the event’s date, time, location, depth, magnitude, and classification (e.g., earthquake or eruption), with metadata indicating the quality and review level of each observation. This dataset was featured in the #TidyTuesday project for the week of May 13, 2025, and made available for analysis in R, Python, and Julia. Special thanks to Libby Heeren for curating and sharing this valuable resource for public exploration and visualization.
Figure 1: This graphic shows the geographic distribution of seismic events at Mount Vesuvius from 2013 to 2024, with each earthquake represented as a grey dot sized by its duration magnitude (Md). For each year, the red circle marks the weighted centroid of all events, calculated using Md as the weighting factor. Over the 12-year period, the centroids trace a clear westward shift beginning in 2019, suggesting a possible geographic migration of seismic activity within the region. This trend may warrant further investigation into evolving subsurface dynamics at the volcano.
How the Graphic Was Created
To visualize the westward migration of seismic activity near Mount Vesuvius, I used the tidyverse suite for data wrangling and ggplot2 for plotting. Earthquake data were obtained via readr::read_csv(), and weighted centroids by year were computed using dplyr::summarise() with weighted.mean(). A background terrain map was retrieved using ggmap::get_stadiamap() and layered with terra::rast(). The final plot includes yearly earthquake points sized by duration_magnitude_md, annual centroid paths (geom_path()), and highlighted centroids (geom_point() and geom_label()) using a diverging color scale from paletteer. The plot was styled with custom fonts via showtext and exported using ggsave().
Loading required libraries
Code
pacman::p_load( tidyverse, # All things tidy scales, # Nice Scales for ggplot2 fontawesome, # Icons display in ggplot2 ggtext, # Markdown text support for ggplot2 showtext, # Display fonts in ggplot2 colorspace, # Lighten and Darken colours magick, # Download images and edit them ggimage, # Display images in ggplot2 patchwork # Composing Plots)# Load Geospatial Mapping packagespacman::p_load(ggmap, sf, terra, tidyterra)# Getting the Data: Using Rvesuvius <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/main/data/2025/2025-05-13/vesuvius.csv')
Visualization Parameters
Code
# Font for titlesfont_add_google("Barlow",family ="title_font") # Font for the captionfont_add_google("Barlow Condensed",family ="caption_font") # Font for plot textfont_add_google("Barlow Semi Condensed",family ="body_font") showtext_auto()# A base Colourbg_col <-"white"seecolor::print_color(bg_col)# Colour for highlighted texttext_hil <-"grey40"seecolor::print_color(text_hil)# Colour for the texttext_col <-"grey30"seecolor::print_color(text_col)line_col <-"grey30"# Define Base Text Sizebts <-90# Caption stuff for the plotsysfonts::font_add(family ="Font Awesome 6 Brands",regular = here::here("docs", "Font Awesome 6 Brands-Regular-400.otf"))github <-""github_username <-"aditya-dahiya"xtwitter <-""xtwitter_username <-"@adityadahiyaias"social_caption_1 <- glue::glue("<span style='font-family:\"Font Awesome 6 Brands\";'>{github};</span> <span style='color: {text_hil}'>{github_username} </span>")social_caption_2 <- glue::glue("<span style='font-family:\"Font Awesome 6 Brands\";'>{xtwitter};</span> <span style='color: {text_hil}'>{xtwitter_username}</span>")plot_caption <-paste0("**Data:** Italian Istituto Nazionale di Geofisica e Vulcanologia (INGV)", " | **Code:** ", social_caption_1, " | **Graphics:** ", social_caption_2 )rm(github, github_username, xtwitter, xtwitter_username, social_caption_1, social_caption_2)# Add text to plot-------------------------------------------------plot_subtitle <-str_wrap("Each dot represents a seismic event at Mount Vesuvius from 2013 to 2024, sized by its magnitude. Annual weighted centroids show a notable westward migration since 2019.", 90)str_view(plot_subtitle)plot_title <-"Mt. Vesuvius: Westward Drift of Seismic Centroids"
Exploratory Data Analysis and Wrangling
Code
# pacman::p_load(summarytools)# dfSummary(vesuvius) |> # view()# Get base map for this area# vesuvius |> # count(year)# A tibble to compute the mean of earthquakes' latitude and longitudedf1 <- vesuvius |>select(year, latitude, longitude, duration_magnitude_md) |>group_by(year) |>drop_na() |>summarise(latitude =weighted.mean(latitude, w = duration_magnitude_md, na.rm =TRUE),longitude =weighted.mean(longitude, w = duration_magnitude_md, na.rm =TRUE),duration_magnitude_md =mean(duration_magnitude_md, na.rm =TRUE) ) |>filter(year >2012) |>mutate(id =row_number() )# Same tibble without an year column, to help plot in every facetdf2 <- df1 |>rename(year1 = year)
# Saving a thumbnaillibrary(magick)# Saving a thumbnail for the webpageimage_read(here::here("data_vizs", "tidy_mount_vesuvius.png")) |>image_resize(geometry ="x400") |>image_write( here::here("data_vizs", "thumbnails", "tidy_mount_vesuvius.png" ) )
Session Info
Table 1: R Packages and their versions used in the creation of this page and graphics
Code
pacman::p_load( tidyverse, # All things tidy scales, # Nice Scales for ggplot2 fontawesome, # Icons display in ggplot2 ggtext, # Markdown text support for ggplot2 showtext, # Display fonts in ggplot2 colorspace, # Lighten and Darken colours magick, # Download images and edit them ggimage, # Display images in ggplot2 patchwork # Composing Plots)# Load Geospatial Mapping packagespacman::p_load(ggmap, sf, terra, tidyterra)sessioninfo::session_info()$packages |>as_tibble() |> dplyr::select(package, version = loadedversion, date, source) |> dplyr::arrange(package) |> janitor::clean_names(case ="title" ) |> gt::gt() |> gt::opt_interactive(use_search =TRUE ) |> gtExtras::gt_theme_espn()