Two-dimensional arrays can be displayed as images, where the array elements determine brightness or color of the images. For example, the statements
load the file
durer.mat, adding three variables to the workspace. The matrix
X is a 648-by-509 matrix and
map is a 128-by-3 matrix that is the colormap for this image.
MAT-files, such as |
The elements of
X are integers between 1 and 128, which serve as indices into the colormap,
reproduces Dürer's etching shown at the beginning of this book. A high resolution scan of the magic square in the upper right corner is available in another file. Type
and then use the up arrow key on your keyboard to reexecute the
axis commands. The statement
adds some twentieth century colorization to the sixteenth century etching. The function
hot generates a colormap containing shades of reds, oranges, and yellows. Typically a given image matrix has a specific colormap associated with it. See the
colormap reference page for a list of other predefined colormaps.
|Mesh and Surface Plots||Printing Graphics|