Last active
January 7, 2019 14:47
-
-
Save SwampThingPaul/1edf626a6a4588df62c011f2e98769f4 to your computer and use it in GitHub Desktop.
mapping in rstats
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
hatched.SP=function(x,density=0.001,angle=45,fillOddEven = FALSE){ | |
require(HatchedPolygons) | |
tmp=hatched.SpatialPolygons(x,density=density,angle=angle,fillOddEven = fillOddEven) | |
proj4string(tmp)=proj4string(x) | |
return(tmp) | |
} |
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
map2=base.map+tm_shape(TN.GM)+ | |
tm_symbols(size=0.5,col="Geomean",breaks=c(-Inf,0.5,1,2,Inf),showNA=T,palette=cols.rmp, | |
title.col="Annual Geometric \nMean TN \nConcentration (mg/L)", | |
labels=c("\u003C 0.5","0.5 - 1.0","1.0 - 2.0", "\u003E2.0"), | |
border.lwd=0.5,colorNA = "white")+ | |
tm_compass(type="arrow",position=c("left","bottom"))+ | |
tm_scale_bar(position=c("left","bottom"))+ | |
tm_layout(bg.color=cols[2],fontfamily = "serif",legend.outside=T,scale=1,asp=NA, | |
outer.margins=c(0.005,0.01,0.005,0.01),inner.margins = 0,between.margin=0, | |
legend.text.size=1,legend.title.size=1.25) |
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(maptools) | |
library(classInt) | |
library(GISTools) | |
library(rgdal) | |
library(sp) | |
library(tmap) | |
library(raster) | |
library(spatstat) | |
library(sf) | |
library(HatchedPolygons) | |
library(plyr) |
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
bbox=raster::extent(473714,587635,2748300,2960854);#Bounding box for our Area of Interest (AOI) | |
base.map=tm_shape(shore,bbox=bbox)+tm_polygons(col=cols[1])+ | |
tm_shape(eaa)+tm_fill("olivedrab1")+tm_borders("grey",lwd=1.5,lty=1.75)+ | |
tm_shape(spsample(eaa,"random",n=500,pretty=F))+tm_dots(col="grey80",size=0.005)+ | |
tm_shape(c139)+tm_fill("grey")+ | |
tm_shape(sta)+tm_polygons("skyblue")+ | |
tm_shape(rs.feat)+tm_polygons("steelblue3")+ | |
tm_shape(rs.feat.hatch)+tm_lines(col="grey")+ | |
tm_shape(wma)+tm_borders("grey50",lwd=1.5,lty=2)+tm_fill(cols[3])+ | |
tm_shape(wma.hatch)+tm_lines(col=cols[5],lwd=2)+tm_shape(wma)+tm_borders("grey50",lwd=2,lty=1)+ | |
tm_shape(wca)+tm_fill("white")+ | |
tm_shape(bcnp)+tm_fill(cols[4])+ | |
tm_shape(enp.shore)+tm_fill("white")+tm_borders("dodgerblue3",lwd=1)+ | |
tm_shape(canal)+tm_lines("dodgerblue3",lwd=2)+ | |
tm_shape(canal)+tm_lines(cols[2],lwd=1)+ | |
tm_shape(evpa)+tm_borders(col="red",lwd=1.5); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment