Visualizing the Magnitude of Earthquakes in New Zealand
I wanted to test out a few packages in R and explore some data visualization techniques so I decided to write this script. The power and versatility of ggplot2 continually amazes me.
“datasets” gives me access to the ‘quakes’ dataset which gives the locations and magnitudes of 1000 seismic events near Fiji. Since the ‘maps’ package does not include a map of Fiji, I used a map of New Zealand to display the locations.
I called a map of New Zealand and then plotted the latitudes and longitudes of the seismic events. The ‘maps’ package is very easy to use and has plenty of helpful documentation.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
ggplot2 really shines here since I can scale the size, opaqueness, and color of the location points based on magnitude with a few simple commands.