IMAGESC Image Display Function

Section: Handle-Based Graphics

Usage

The imagesc command has the following general syntax
  handle = imagesc(x,y,C,clim)

where x is a two vector containing the x coordinates of the first and last pixels along a column, and y is a two vector containing the y coordinates of the first and last pixels along a row. The matrix C constitutes the image data. It must either be a scalar matrix, in which case the image is colormapped using the colormap for the current figure. If the matrix is M x N x 3, then C is intepreted as RGB data, and the image is not colormapped. The clim argument is a pairs [low high] that specifies scaling. You can also omit the x and y,

  handle = imagesc(C, clim)

in which case they default to x = [1,size(C,2)] and y = [1,size(C,1)]. Finally, you can use the image function with only formal arguments

  handle = imagesc(properties...)

Example

In this example, we create an image that is 512 x 512 pixels square, and set the background to a noise pattern. We set the central 128 x 256 pixels to be white.
--> x = rand(512);
--> x((-64:63)+256,(-128:127)+256) = 1.0;
--> figure

ans = 
 1 

--> imagesc(x,[0 .5])
Warning: Newly defined variable nargin shadows a function of the same name.  Use clear nargin to recover access to the function
--> colormap(gray)