Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A brief visualization
library(tidyverse)
library(broom)
library(sp)
library(spdplyr)
library(ggplot2)
library(ggmap)
library(rgdal)
library(raster)
#read in spatialPolygonsDataFrame (shapefile)
#classifications <- readOGR("../agu_data/ff_polys_proj.sqlite", "ff_consensus", stringsAsFactors=FALSE)
classifications <- readRDS("../agu_data/ff_polys_proj.rds")
###quick visualization of Monterey
#make a data frame for use by ggplot2
mont_df <- crop(classifications, extent(-122.0, -121.85, 36.5, 36.65)) %>%
filter(threshold==6) %>% tidy
#get a background map from google
mont_map <- get_map(c(-122.0, 36.5, -121.85, 36.65), zoom=12)
#make a jpeg
jpeg("./mont_example.jpg")
ggmap(mont_map) +
geom_polygon(data = mont_df,
mapping=aes(x=long, y=lat, group=group),
fill="darkgreen") +
xlab("") + ylab("") + theme_void()
dev.off()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment