Geom_point(aes(x=longitude,y=latitude,size=mag, color=mag),data=mycatalog)+ #Adds the earthquake points, with the size and color according to "mag" variable (magnitude).Ĭoord_fixed(ylim = c(-82.5, 87.5), xlim = c(-185, 185))+ Background color is black so the world map now appears (white on the black background). Theme(axis.line = element_blank(), axis.text = element_blank(),axis.ticks = element_blank(),plot.margin=unit(c(3, 0, 0, 0),"mm"),legend.text = element_text(size = 6),legend.title = element_text(size = 8, face = "plain"),panel.background = element_rect(fill='black'))+ #sets the theme. Geom_polygon(data = world.map, aes(x = long, y = lat, group = group),fill = "white",alpha=0.2)+ The size of the dots and their color are according to magnitude of earthquake # Plot world map with dots for earthquakes. Now we can create a global earthquake map, with earthquake magnitude highlighted with color and size of the points. Data was obtained from USGS website: Ĭatalog EQ_min_year),] # Only Earthquakes since 1950 Let’s start with the earthquake data set: #Load earthquake data. The grid package is only used for the “unit()” function to set the margin in the plot. These are both great data sets to play around with though! Lots of cool things to do. Like the earthquake data, the reliability of the data depends on the year (older = less reliable), location, etc. The data set of hurricane tracks was obtained from the NOAA website: This is simply a reflection of increased detection/recording of earthquakes, not their occurrence. Plotting the number of earthquakes over time also suggests an significant increase in seismic activity over time.
Similarly, quality of data is uneven depending on country/region. For example, the magnitude and location of old earthquakes is very uncertain, since these are not instrumental recordings. Make sure to read the documentation to understand the data set. csv files for all earthquakes recorded since 1900, filtered by magnitude, location, date or other attribute. The data set of earthquakes was obtained from the USGS website:
#Grads plot hurricane track eah point free
I’ve only included earthquakes and hurricanes but feel free to point me to data-sets for other natural hazards that I can add. It is quite simple, and demonstrates some of the neat data visualizations possible with R.
#Grads plot hurricane track eah point code
I created this code in order to do a visualization of natural hazards globally, to use as a graphic for a new initiative at Stanford on “urban resilience.” You can check out the group here: