12.07.2015 Views

MATLAB Function Reference (Volume 2: Graphics)

MATLAB Function Reference (Volume 2: Graphics)

MATLAB Function Reference (Volume 2: Graphics)

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

caxismap them to an entry in the colormap (whose length is m, and whose row indexis referred to as index below).index = fix((C–cmin)/(cmax–cmin)∗m)+1ExamplesCreate (X,Y,Z) data for a sphere and view the data as a surface.[X,Y,Z] = sphere;C = Z;surf(X,Y,Z,C)Values of C have the range [−1 1]. Values of C near −1 are assigned the lowestvalues in the colormap; values of C near 1 are assigned the highest values inthe colormap.To map the top half of the surface to the highest value in the color table, usecaxis([−1 0])To use only the bottom half of the color table, entercaxis([−1 3])which maps the lowest CData values to the bottom of the colormap, and thehighest values to the middle of the colormap (by specifying a cmax whose valueis equal to cmin plus twice the range of the CData).The commandcaxis autoresets axis scaling back to auto-ranging and you see all the colors in thesurface. In this case, enteringcaxisreturns[–1 1]Adjusting the color axis can be useful when using images with scaled colordata. For example, load the image data and colormap for Cape Code,Massachusetts.load cape2-73

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!