Main Content


Display regular data grid as image


h = grid2image(...)


grid2image(Z,R) displays a regular data grid Z as an image. The image is displayed in unprojected form, with longitude as x and latitude as y, producing considerable distortion away from the Equator. Z can be M-by-N or M-by-N-by-3, and can contain double, uint8, or uint16 data. The grid is georeferenced to latitude-longitude by R, which can be a geographic raster reference object, a referencing vector, or a referencing matrix.

If R is a geographic raster reference object, its RasterSize property must be consistent with size(Z) and its RasterInterpretation must be 'cells'.

If R is a referencing vector, it must be a 1-by-3 with elements:

[cells/degree northern_latitude_limit western_longitude_limit]

If R is a referencing matrix, it must be 3-by-2 and transform raster row and column indices to/from geographic coordinates according to:

[lon lat] = [row col 1] * R

If R is a referencing matrix, it must define a (non-rotational, non-skewed) relationship in which each column of the data grid falls along a meridian and each row falls along a parallel.

grid2image(Z,R,PropertyName,PropertyValue,...) uses the specified image properties to display the map. See the image function reference page for a list of properties that can be changed.

h = grid2image(...) returns the handle of the image object displayed.


Load elevation raster data and a geographic cells reference object. Then, display the data as an image.

load topo60c

Introduced before R2006a