Created
January 2, 2018 18:53
-
-
Save jebyrnes/80f28e754c51bfdcef958a9684e19692 to your computer and use it in GitHub Desktop.
A brief visualization
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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