# NOT RUN {
library(oce)
data(coastlineWorld)
data(topoWorld)
## 1. topography
par(mfrow=c(2, 1), mar=c(2, 2, 1, 1))
lonlim <- c(-70, -50)
latlim <- c(40, 50)
topo <- decimate(topoWorld, by=2) # coarse to illustrate filled contours
topo <- subset(topo, latlim[1] < latitude & latitude < latlim[2])
topo <- subset(topo, lonlim[1] < longitude & longitude < lonlim[2])
mapPlot(coastlineWorld, type='l',
longitudelim=lonlim, latitudelim=latlim,
projection="+proj=lcc +lat_1=40 +lat_2=50 +lon_0=-60")
breaks <- seq(-5000, 1000, 500)
mapImage(topo, col=oce.colorsGebco, breaks=breaks)
mapLines(coastlineWorld)
box()
mapPlot(coastlineWorld, type='l',
longitudelim=lonlim, latitudelim=latlim,
projection="+proj=lcc +lat_1=40 +lat_2=50 +lon_0=-60")
mapImage(topo, filledContour=TRUE, col=oce.colorsGebco, breaks=breaks)
box()
mapLines(coastlineWorld)
## 2. Northern polar region, with color-coded bathymetry
par(mfrow=c(1,1))
drawPalette(c(-5000, 0), zlim=c(-5000, 0), col=oce.colorsJet)
mapPlot(coastlineWorld, projection="+proj=stere +lat_0=90",
longitudelim=c(-180,180), latitudelim=c(60,120))
mapImage(topoWorld, zlim=c(-5000, 0), col=oce.colorsJet)
mapLines(coastlineWorld[['longitude']], coastlineWorld[['latitude']])
## 3. Levitus SST
par(mfrow=c(1,1))
data(levitus, package='ocedata')
lon <- levitus$longitude
lat <- levitus$latitude
SST <- levitus$SST
par(mar=rep(1, 4))
Tlim <- c(-2, 30)
drawPalette(Tlim, col=oce.colorsJet)
mapPlot(coastlineWorld, projection="+proj=moll", grid=FALSE)
mapImage(lon, lat, SST, col=oce.colorsJet, zlim=Tlim)
mapPolygon(coastlineWorld, col='gray')
## 4. Topography without drawing a coastline first
data(topoWorld)
cm <- colormap(topoWorld[['z']], name='gmt_relief')
drawPalette(colormap=cm)
mapPlot(c(-180,180), c(-90,90), type="n") # defaults to moll projection
mapImage(topoWorld, colormap=cm)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab