Skip to content

Instantly share code, notes, and snippets.

@actuaryactually
Created February 22, 2017 15:19
Show Gist options
  • Save actuaryactually/38f6634b674b05a21256fc265dcc703c to your computer and use it in GitHub Desktop.
Save actuaryactually/38f6634b674b05a21256fc265dcc703c to your computer and use it in GitHub Desktop.
Quake Visualisations (QV)
pacman::p_load(ggmap,fitdistrplus,maps,mapproj,ggrepel)
wellington = c(lon = 174.7762, lat = -41.28646)
wellington.map=get_map(location=wellington,zoom=8,color="bw")
r <- ggmap(wellington.map,extent="panel",maprange=FALSE)%+% mydat + aes(x = long, y = lat)
r <- r + geom_density2d()
r <- r + stat_density2d(aes(fill = ..level.., alpha = ..level..), size = 0.1, bins = 100, geom = 'polygon')
r <- r + scale_fill_gradient(low = "green", high = "red") + scale_alpha(range = c(0.00, 0.25), guide = FALSE)
r <- r + geom_point(data=output.addresses.df, aes(x=long, y=lat),
color="blue",shape=15)
r <- r + labs(
title = "NZ EQ hotspots 1 Jan 2006 - Present Vs Exposure: (i.e. location of Harvey Norman Store Outlets)",
subtitle = "The Blenheim store appears to be closest to an active zone",
caption = "Sources: http://info.geonet.org.nz/ and http://www.harveynorman.co.nz/store-finder.html")
r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment