colormap
using colormaps
Description
A colormap cmap
is defined by a m x 3 matrix of Red, Green and Blue
colors intensities in the [0,1] interval. m is the number of colors defined in the colormap.
The color number i is given in the ith row as a 3-uple cmap(i,1)
,
cmap(i,2)
, cmap(i,3)
. For a given colormap,
this index i identifies the color.
The default factory colormap defines 32 colors. You can
change the colormap of a figure by using f.color_map=cmap
where f
is the handle of the figure.
Each color in the colormap has an index you have to use to specify color in most plot functions. To see the indices, use function getcolor.
A set of functions from autumncolormap(n) to wintercolormap(n) provide swatches that can be set to colormaps. They are illustrated here-below.
The colormap of the current figure can be retrieved with cmap = gcf().color_map
.
The current default colormap can be retrieved with cmap = gdf().color_map
.
The factory default colormap can be retrieved with cmap = sdf().color_map
.
Sample
Examples
n = 64; r = linspace(0,1,n)'; g = linspace(1,0,n)'; b = ones(r); cmap = [r g b]; f = gcf(); f.color_map = cmap; plot3d1() f.color_map = gdf().color_map; // restores to the default colormap
gdf().color_map
--> gdf().color_map ans = 0. 0. 0. 0. 0. 1. 0. 1. 0. 0. 1. 1. 1. 0. 0. 1. 0. 1. 1. 1. 0. 1. 1. 1. 0. 0. 0.5647059 0. 0. 0.6901961 0. 0. 0.8156863 0.5294118 0.8078431 1. 0. 0.5647059 0. 0. 0.6901961 0. 0. 0.8156863 0. 0. 0.5647059 0.5647059 0. 0.6901961 0.6901961 0. 0.8156863 0.8156863 0.5647059 0. 0. 0.6901961 0. 0. 0.8156863 0. 0. 0.5647059 0. 0.5647059 0.6901961 0. 0.6901961 0.8156863 0. 0.8156863 0.5019608 0.1882353 0. 0.627451 0.2509804 0. 0.7529412 0.3764706 0. 1. 0.5019608 0.5019608 1. 0.627451 0.627451 1. 0.7529412 0.7529412 1. 0.8784314 0.8784314 1. 0.8431373 0.
See also
- autumncolormap — red through orange to yellow colormap
- bonecolormap — gray colormap with a light blue tone
- coolcolormap — cyan to magenta colormap
- coppercolormap — black to a light copper tone colormap
- graycolormap — linear gray colormap
- hotcolormap — red to yellow colormap
- hsvcolormap — Hue-saturation-value colormap
- jetcolormap — blue to red colormap
- oceancolormap — linear blue colormap
- parulacolormap — blue to yellow colormap
- pinkcolormap — sepia tone colorization on black and white images
- rainbowcolormap — red through orange, yellow, green,blue to violet colormap
- springcolormap — magenta to yellow colormap
- summercolormap — green to yellow colormap
- whitecolormap — completely white colormap
- wintercolormap — blue to green colormap
- color — returns the color id of a color
- getcolor — opens a dialog to show colors of the current or default colormap
- colordef — Set the color look-and-feel of a given or of all forthcoming graphic figures
Report an issue | ||
<< colorbar | Color management | getcolor >> |