n: number of colors to get from the scale. Those are evenly spaced within the scale.
...: passed to scale_fill_gradientn or scale_color_gradientn
Details
etopo.colors is equivalent to other color scales in R (e.g. grDevices::heat.colors, grDevices::cm.colors).
scale_fill/color_etopo are meant to be used with ggplot2. They allow consistent plots in various subregions by setting the limits of the scale explicitly.
Author(s)
Jean-Olivier Irisson
See Also
autoplot.bathy, palette.bathy
Examples
# load NW Atlantic data and convert to class bathydata(nw.atlantic)atl <- as.bathy(nw.atlantic)# plot with base graphicsplot(atl, image=TRUE)# using the etopo color scaleetopo_cols <- rev(etopo.colors(8))plot(atl, image=TRUE, bpal=list( c(min(atl),0, etopo_cols[1:2]), c(0, max(atl), etopo_cols[3:8])))# plot using ggplot2; in which case the limits of the scale are automaticlibrary("ggplot2")ggplot(atl, aes(x=x, y=y))+ coord_quickmap()+# background geom_raster(aes(fill=z))+ scale_fill_etopo()+# countours geom_contour(aes(z=z), breaks=c(0,-100,-200,-500,-1000,-2000,-4000), colour="black", size=0.2)+ scale_x_continuous(expand=c(0,0))+ scale_y_continuous(expand=c(0,0))