Learn R Programming

marmap (version 0.9.4)

etopo: Etopo colours

Description

Various ways to access the colours or on the etopo colour scale

Usage

etopo.colors(n)

scale_fill_etopo(...) scale_colour_etopo(...)

Arguments

n
number of colours to get from the scale. Those are evenly spaced within the scale.
...
passed to scale_fill_gradientn or scale_colour_gradientn

Details

etopo.colors is equivalent to all usual colours in R (heat.colors, cm.colors).

scale_fill/contour_etopo are meant to be used with ggplot2. They allow consistent plots in various subregions by setting the limits of the scale explicitly.

See Also

autoplot.bathy, palette.bathy

Examples

Run this code
# load NW Atlantic data and convert to class bathy
	data(nw.atlantic)
	atl <- as.bathy(nw.atlantic)

  library("ggplot2")
  head(fortify(atl))

  # one can now use bathy objects with ggplot directly
  ggplot(atl) + geom_contour(aes(x=x, y=y, z=z))
  
  # which allows complete plot configuration
  atl.df <- fortify(atl)
  ggplot(atl.df, aes(x=x, y=y)) +
    geom_raster(aes(fill=z), data=atl.df[atl.df$z <= 0,]) +
    geom_contour(aes(z=z),
      breaks=c(-100, -200, -500, -1000, -2000, -4000),
      colour="white", size=0.1
    )

Run the code above in your browser using DataLab