Learn R Programming

matlab (version 1.0.2)

imagesc: MATLAB imagesc function

Description

Scales image data to the full range of the current palette and displays the image.

Usage

imagesc(x=seq(ncol(C)), y=seq(nrow(C)), C, col=jet.colors(12), ...)

Arguments

x,y
locations of grid lines at which the values in C are measured. These must be finite, non-missing and in (strictly) ascending order. By default, the dimensions of C are used.
C
numeric matrix representing data to be plotted. Note that x can be used instead of C for convenience.
col
vector of colors used to display image data
...
graphical parameters for image may also be passed as arguments to this method

Details

Each element of C corresponds to a rectangular area in the image. The values of the elements of C are indices into the current palette that determine the color of each patch.

The method interprets the matrix data as a table of f(x[i], y[j]) values, so that the x axis corresponds to column number and the y axis to row number, with row 1 at the top, i.e., the same as the conventional printed layout of a matrix.

See Also

image, jet.colors, par

Examples

Run this code
values <- matrix(c(seq(1,  5, by=1),
                   seq(2, 10, by=2),
                   seq(3, 15, by=3)), nrow=3, byrow=TRUE)
imagesc(values, xlab="cols", ylab="rows", col=jet.colors(16))

Run the code above in your browser using DataLab