Description Usage Arguments Details Author(s) References See Also Examples
Plot an image on an existing map.
1 2 3 4 
longitude 
vector of longitudes corresponding to 
latitude 
vector of latitudes corresponding to 
z 
matrix to be represented as an image. 
zlim 
limit for z (colour). 
zclip 
A logical value, 
breaks 
The z values for breaks in the colour scheme. If this is of
length 1, the value indicates the desired number of breaks, which is
supplied to 
col 
Either a vector of colours corresponding to the breaks, of length
1 plus the number of breaks, or a function specifying colours,
e.g. 
colormap 
optional colormap, as created by 
border 
Colour used for borders of patches (passed to

lwd 
line width, used if borders are drawn. 
lty 
line type, used if borders are drawn. 
missingColor 
a colour to be used to indicate missing data, or

filledContour 
either a logical value indicating whether to use
filled contours to plot the image, or a numerical value indicating the
resampling rate to be used in interpolating from lonlat coordinates to
xy coordinates. See “Details” for how this interacts with

gridder 
Name of gridding function used if 
debug 
A flag that turns on debugging. Set to 1 to get a moderate amount of debugging information, or to 2 to get more. 
Adds an image to an existing map, by analogy to image
.
The data are on a regular grid in lonlat space, but not in the projected
xy space. This means that image
cannot be used. Instead,
there are two approaches, depending on the value of filledContour
.
If filledContour
is FALSE
, the image “pixels” are with
polygon
, which can be prohibitively slow for fine grids.
However, if filledContour
is TRUE
or a numerical value, then the
“pixels” are remapped into a regular grid and then displayed with
.filled.contour
. The remapping starts by converting the
regular lonlat grid to an irregular xy grid using
lonlat2map
. This irregular grid is then interpolated onto a
regular xy grid with binMean2D
or with
interp
from the akima
package, as determined by
the gridder
argument. If filledContour
is TRUE
, the
dimensions of the regular xy grid is the same as that of the original
lonlat grid; otherwise, the number of rows and columns are multiplied by
the numerical value of filledContour
, e.g. the value 2 means to make
the grid twice as fine.
Filling contours can produce aestheticallypleasing results, but the method involves interpolation, so the data are not represented exactly and analysts are advised to compare the results from the two methods (and perhaps various grid refinement values) to guard against misinterpretation.
If a png
device is to be used, it is advised to supply
arguments type="cairo"
and antialias="none"
; see [1].
Dan Kelley
1. http://codedocean.wordpress.com/2014/02/03/antialiasingandimageplots/
A map must first have been created with mapPlot
.
Other functions related to maps: lonlat2map
,
lonlat2utm
, map2lonlat
,
mapArrows
, mapAxis
,
mapContour
,
mapDirectionField
, mapGrid
,
mapLines
, mapLocator
,
mapLongitudeLatitudeXY
,
mapPlot
, mapPoints
,
mapPolygon
, mapScalebar
,
mapText
, mapTissot
,
oceCRS
, shiftLongitude
,
utm2lonlat
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47  ## Not run:
library(oce)
data(coastlineWorld)
data(topoWorld)
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)
## Northern polar region, with colourcoded 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']])
# 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')
## End(Not run)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.