Today’s “data in motion” post is a visualization of earthquakes over time. I’ll use seismic data from the National Science Foundation. Keeping with the theme, I’ll use F# and FFmpeg to convert the raw data into a video of the data over time.
The above video represents earthquakes from the last 20 years. The magnitude of seismic events are represented using bubble size and color. Lower magnitude events are smaller and blue/green. Higher magnitudes are larger and red. The static data is brought together using a combination of tools. The primary one being F#, along with the libraries Deedle and Plotly.NET for data manipulation and chart creation (respectively). The last step uses FFmpeg to transform a series of images into a final video.
Source Data: Incorporated Research Institutions for Seismology https://service.iris.edu/fdsnws/event/1/
For posterity sake, here are the package versions. Plotly.NET has made a lot of great progress lately.
1 | dotnet add package Deedle --version 2.5.0 |
And here is the code. As you can imagine, it is similar to the other posts in this series. The differences from previous posts are mostly a result of different data formats and using the BubbleGeo chart type for plotting data. The largest difference is the generation of intermediate charts combined into date-specific charts. This extra step is required because the current version of the BubbleGeo chart doesn’t support multiple marker colors for a single chart. To implement different colors, I create a single chart for each magnitude with it’s specific color. Then I use Plotly’s Chart.combine
to combine them into a single chart image.
1 | open System |