Map with bay locations

# Read library
require(PBSmapping)
## Loading required package: PBSmapping
## Warning: package 'PBSmapping' was built under R version 3.5.2
## 
## -----------------------------------------------------------
## PBS Mapping 2.72.1 -- Copyright (C) 2003-2020 Fisheries and Oceans Canada
## 
## PBS Mapping comes with ABSOLUTELY NO WARRANTY;
## for details see the file COPYING.
## This is free software, and you are welcome to redistribute
## it under certain conditions, as outlined in the above file.
## 
## A complete user guide 'PBSmapping-UG.pdf' is located at 
## /Library/Frameworks/R.framework/Versions/3.5/Resources/library/PBSmapping/doc/PBSmapping-UG.pdf
## 
## Packaged on 2019-03-14
## Pacific Biological Station, Nanaimo
## 
## All available PBS packages can be found at
## https://github.com/pbs-software
## 
## To see demos, type '.PBSfigs()'.
## -----------------------------------------------------------
require(here)
## Loading required package: here
## here() starts at /Users/laura/Documents/roberts-lab/paper-oly-mbdbs-gen
data(nepacLLhigh) #Load set of polygons for the NE Pacific Ocean in high resolution from PBSmapping
data(nepacLL) #Load set of polygons for the NE Pacific Ocean in high resolution from PBSmapping

#lat/lon from wa state in the maps package
#organized by hand 

WA <- matrix(c(
  -122.7104, 48.98789,
  -122.0916, 48.99362,
  -117.0209, 48.99362,
  -117.0209, 48.99362,
  -117.0266, 46.53563,
  -117.0266, 46.42677,
  -117.0324, 46.38666,
  -116.9235, 46.16894,
  -116.9292, 45.99705,
  -118.9575, 45.99705,
  -119.2497, 45.92830,
  -119.3185, 45.93402,
  -119.5935, 45.91684,
  -119.6966, 45.85381,
  -120.4472, 45.68765,
  -120.6535, 45.72776,
  -120.9629, 45.64182,
  -121.0545, 45.64755,
  -121.1634, 45.60171,
  -121.3696, 45.69339,
  -121.7765, 45.69339,
  -122.3208, 45.53296,
  -122.7619, 45.64182,
  -122.7906, 45.87673,
  -122.9109, 46.07153,
  -123.1172, 46.16894,
  -123.3693, 46.14029,
  -123.4323, 46.22623)
  ,ncol=2,dimnames=list(NULL,c("x","y")),byrow=T)                 

WAInlandPBS <- as.PolySet(data.frame(PID=c(rep(4,nrow(WA))),
                                           SID=c(rep(4,nrow(WA))),
                                           POS=c(1:nrow(WA)),
                                           X=c(WA[,"x"]),
                                           Y=c(WA[,"y"])),projection="LL")

# Import collection latitude and longitude data
locationCords <- read.csv(file = here::here("data", "population-origin-coordinates.csv"), header = T, stringsAsFactors = F) #Import outplant coordinate information
## Warning in read.table(file = file, header = header, sep = sep, quote = quote, :
## incomplete final line found by readTableHeader on '/Users/laura/Documents/
## roberts-lab/paper-oly-mbdbs-gen/data/population-origin-coordinates.csv'
par(fig = c(0,1,0,1))
plotMap(nepacLL, xlim=c(-124.9, -121.5), ylim=c(46.8, 48.5),col="white",bg="gray95", cex.lab=1.3, cex.axis=1.1, mgp=c(2,0.5,0))
#Add sampling location  as points to map 
for (i in 1:2) {
  points(x = locationCords$Long.dec[i], y = locationCords$Lat.dec[i], pch=22 ,  bg="black", lwd=1, cex=2.3)
}

Save map to file

pdf(file = here::here("data", "sample-sites-map.pdf"), height = 5.5, width = 5.5) 
# Create state map 
par(fig = c(0,1,0,1))
plotMap(nepacLL, xlim=c(-124.9, -121.5), ylim=c(46.8, 48.5),col="white",bg="gray95", cex.lab=1.3, cex.axis=1.1, mgp=c(2,0.5,0))
#Add sampling location  as points to map 
for (i in 1:2) {
  points(x = locationCords$Long.dec[i], y = locationCords$Lat.dec[i], pch=22 ,  bg="black", lwd=1, cex=2.3)
}
dev.off()
## quartz_off_screen 
##                 2