Draw an image plot with geographical coordinates and coastlines.

# S3 method for class 'map'
image(
  lon,
  lat,
  z,
  zlim = NULL,
  legend = TRUE,
  hires = FALSE,
  add = FALSE,
  nlevel = 1000,
  horizontal = FALSE,
  legend.shrink = 0.9,
  legend.width = 1.2,
  slice = NULL,
  legend.mar = ifelse(horizontal, 3.1, 5.1),
  legend.lab = NULL,
  graphics.reset = FALSE,
  bigplot = NULL,
  smallplot = NULL,
  legend.only = FALSE,
  col = rev(rainbow(nlevel/10, start = 0/6, end = 4/6)),
  lab.breaks = NULL,
  axis.args = NULL,
  legend.args = NULL,
  axes = TRUE,
  midpoint = FALSE,
  border = TRUE,
  lwd = 1,
  land = TRUE,
  land.col = "black",
  labels = TRUE,
  sea.col = "white",
  boundaries.col = "grey",
  grid = FALSE,
  grid.col = "white",
  grid.lwd = 0.5,
  ...
)

Arguments

lon

x-axis coordinates, assumed to be longitude (degrees)

lat

y-axis coordinates, assumed to be latitude (degrees)

z

A matrix of dimension [lon x lat]

zlim

numeric vector of length 2, giving the z matrix plotted range.

legend

Boolean, add color legend? FALSE can be used to construct multiple plots with a common legend.

hires

Boolean, use high resolution coastline?

add

If true add image and a legend strip to the existing plot.

nlevel

Number of color levels used in legend strip

horizontal

If false (default) legend will be a vertical strip on the right side. If true the legend strip will be along the bottom.

legend.shrink

Amount to shrink the size of legend relative to the full height or width of the plot.

legend.width

Width in characters of the legend strip. Default is 1.2, a little bigger that the width of a character.

slice

If z is an 3D array, slice indicates which layer will be used.

legend.mar

Width in characters of legend margin that has the axis. Default is 5.1 for a vertical legend and 3.1 for a horizontal legend.

legend.lab

Label for the axis of the color legend. Default is no label as this is usual evident from the plot title.

graphics.reset

If FALSE (default) the plotting region ( plt in par) will not be reset and one can add more information onto the image plot. (e.g. using functions such as points or lines.) If TRUE will reset plot parameters to the values before entering the function.

bigplot

Plot coordinates for image plot. If not passed these will be determined within the function.

smallplot

Plot coordinates for legend strip. If not passed these will be determined within the function. Be sure to leave room for the axis labels. For example, if the legend is on the right side smallplot= c(.85,.9,0,1) will leave (.1 in plot coordinates) for the axis labels to the right of the color strip. This argument is useful for drawing a plot with the legend that is the same size as the plots without legends.

legend.only

If TRUE just add the legend to a the plot in the plot region defined by the coordinates in smallplot. In the absence of other information the range for the legend is determined from the zlim argument.

col

Color table to use for image, by default rev(rainbow(nlevel/10, start = 0/6, end = 4/6))

lab.breaks

If breaks are supplied these are text string labels to put at each break value. This is intended to label axis on a transformed scale such as logs.

axis.args

Additional arguments for the axis function used to create the legend axis. (See example below adding a log scaling.)

legend.args

Arguments for a complete specification of the legend label, e.g. if you need to the rotate text or other details. This is in the form of list and is just passed to the mtext function and you will need to give both the side and line arguments for positioning. This usually will not be needed. (See example below.)

axes

Boolean, add axes to the plot? Default is TRUE.

midpoint

This option for the case of unequally spaced grids with x and y being matrices of grid point locations. If FALSE (default) the quadralaterals will be extended to surround the z locations as midpoints. If TRUE z values will be averaged to yield a midpoint value and the original grid points be used to define the quadralaterals. (See help on poly.image for details). In most cases midpoint should be FALSE to preserve exact values for z and let the grid polygons be modified.

border

This only works if x and y are matrices – if NA the quadralaterals will have a border color that is the same as the interior color. Otherwise this specifies the color to use.

lwd

Line width of bordering lines around pixels. This might need to be set less than 1.0 to avoid visible rounding of the pixel corners.

land

Boolean, add a polygon over the land? If FALSE, only coastline is added.

land.col

Color of the land, if land is TRUE.

labels

Boolean, add LATITUDE and LONGITUDE labels?

sea.col

Color of the water bodies.

boundaries.col

Color of the country boundaries.

grid

Boolean, add grid lines over the map?

grid.col

Color of the grid.

grid.lwd

Width of the grid lines.

...

Additional parameters passed to plot methods.