image.SpatialGridDataFrame {sp}R Documentation

image gridded spatial data, or convert to format for image

Description

Convert gridded data in SpatialGridDataFrame to image format; call image on data in SpatialGridDataFrame format

Usage

image.SpatialGridDataFrame(x, attr = 1, xcol = 1, ycol = 2, asp = 1, axes = FALSE, ...)
as.image.SpatialGridDataFrame(x, xcol = 1, ycol = 2)

Arguments

x object of class SpatialGridDataFrame
attr column number of attribute variable; this may be the column name in the data.frame of data (as.data.frame(data)), or a column number
xcol column number of x-coordinate, in the coordinate matrix
ycol column number of y-coordinate, in the coordinate matrix
asp aspect ratio of unit x and unit y axis
axes logical; should coordinate axes be drawn?
... arguments passed to image, see examples

Value

as.image.SpatialGridDataFrame returns the list with elements x and y, containing the coordinates of the cell centres of a matrix z, containing the attribute values in matrix form as needed by image.

Note

Providing xcol and ycol attributes seems obsolete, and it is for 2D data, but it may provide opportunities for plotting certain slices in 3D data. I haven't given this much thought yet.

filled.contour seems to misinterpret the coordinate values, if we take the image.default manual page as the reference.

Author(s)

Edzer J. Pebesma

References

See Also

image.default, SpatialGridDataFrame-class, levelplot in package lattice

Examples

data(meuse.grid)
coordinates(meuse.grid) = c("x", "y") # promote to SpatialPointsDataFrame
gridded(meuse.grid) = TRUE            # promote to SpatialGridDataFrame
image(meuse.grid["dist"], main = "Distance to river Meuse")
data(meuse)
coordinates(meuse) = c("x", "y")
points(coordinates(meuse), pch = "+")

[Package sp version 0.7-12 Index]