# NOT RUN {
# load NW Atlantic data and convert to class bathy
data(nw.atlantic)
atl <- as.bathy(nw.atlantic)
# basic plot
# }
# NOT RUN {
library("ggplot2")
autoplot(atl)
# plot images
autoplot(atl, geom=c("tile"))
autoplot(atl, geom=c("raster")) # faster but not resolution independant
# plot both!
autoplot(atl, geom=c("raster", "contour"))
# geom names can be abbreviated
autoplot(atl, geom=c("r", "c"))
# do not highlight the coastline
autoplot(atl, coast=FALSE)
# better colour scale
autoplot(atl, geom=c("r", "c")) +
scale_fill_gradient2(low="dodgerblue4", mid="gainsboro", high="darkgreen")
# set aesthetics
autoplot(atl, geom=c("r", "c"), colour="white", size=0.1)
# topographical colour scale, see ?scale_fill_etopo
autoplot(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(atl, geom="contour", mapping=aes(colour=..level..))
# }
Run the code above in your browser using DataLab