# load NW Atlantic data and convert to class bathy
data(nw.atlantic)
atl <- as.bathy(nw.atlantic)
# basic plot
if (FALSE) {
library("ggplot2")
autoplot.bathy(atl)
# plot images
autoplot.bathy(atl, geom=c("tile"))
autoplot.bathy(atl, geom=c("raster")) # faster but not resolution independant
# plot both!
autoplot.bathy(atl, geom=c("raster", "contour"))
# geom names can be abbreviated
autoplot.bathy(atl, geom=c("r", "c"))
# do not highlight the coastline
autoplot.bathy(atl, coast=FALSE)
# better colour scale
autoplot.bathy(atl, geom=c("r", "c")) +
scale_fill_gradient2(low="dodgerblue4", mid="gainsboro", high="darkgreen")
# set aesthetics
autoplot.bathy(atl, geom=c("r", "c"), colour="white", size=0.1)
# topographical colour scale, see ?scale_fill_etopo
autoplot.bathy(atl, geom=c("r", "c"), colour="white", size=0.1) + scale_fill_etopo()
# add sampling locations
data(metallo)
last_plot() + geom_point(aes(x=lon, y=lat), data=metallo, alpha=0.5)
# an alternative contour map making use of additional mappings
# see ?stat_contour in ggplot2 to understand the ..level.. argument
autoplot.bathy(atl, geom="contour", mapping=aes(colour=..level..))
}
Run the code above in your browser using DataLab