packages <- c("tidyverse", "marmap", "oceanmap", "ggnewscale", "RColorBrewer")
packages <- lapply(packages, FUN = function(x) {
if(!require(x, character.only = TRUE)) {install.packages(x)
library(x, character.only = TRUE)}})
bathymetric.map <- getNOAA.bathy(-90,-70,-20,-2, res=4, keep=TRUE)
bathymetric.map <- getNOAA.bathy(lon1 = -95, lon2 = -83, lat1 = 23, lat2 = 13, resolution = 1)
summary(bathymetric.map)
png("~/Desktop/bathymetric-map.png",width=1000, height=1000)
plot(bathymetric.map, image = TRUE)
scaleBathy(bathymetric.map, deg = 2, x = "bottomleft", inset = 5)
blues <- colorRampPalette(c("red","purple","blue", "cadetblue1","white"))
plot(bathymetric.map, image = TRUE, bpal = blues(100))
plot(bathymetric.map, image = TRUE, bpal = blues(100), deep = c(-9000, -3000, 0),
shallow = c(-3000, -10, 0),
step = c(1000, 1000, 0),
lwd = c(0.8, 0.8, 1), lty = c(1, 1, 1), col = c("lightgrey", "darkgrey", "black"), drawlabel = c(FALSE, FALSE, FALSE))
autoplot(bathymetric.map, geom = c("raster", "contour"), size=0.1) + scale_fill_etopo() +
labs(x="Longitude",y="Latitude",fill="Depth") + ggtitle("Bathymetric Map")
# dev.off()