This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Colormaps appropriate to political regions


cmap = polcmap(...)


polcmap applies a random muted colormap to the current figure. The size of the colormap is the same as the existing colormap.

polcmap(ncolors) creates a colormap with the specified number of colors.

polcmap(ncolors,maxsat) controls the maximum saturation of the colors. Larger maximum saturation values produce brighter, more saturated colors. If omitted, the default is 0.5.

polcmap(ncolors,huelimits,saturationlimits,valuelimits) controls the colors. Hue, saturation, and value are randomly selected values within the limit vectors. These are two-element vectors of the form [min max]. Valid values range from 0 to 1. As the hue varies from 0 to 1, the resulting color varies from red, through yellow, green, cyan, blue, and magenta, back to red. When the saturation is 0, the colors are unsaturated; they are simply shades of gray. When the saturation is 1, the colors are fully saturated; they contain no white component. As the value varies from 0 to 1, the brightness increases.

cmap = polcmap(...) returns the colormap without applying it to the figure.


Draw a map of Texas and surrounding states. Color the patches with a symbolspec constructed using polcmap:

figure; usamap('texas')
states = shaperead('usastatelo.shp','UseGeoCoords',true);
faceColors = makesymbolspec('Polygon',...
     {'INDEX', [1 numel(states)], 'FaceColor', ...
geoshow(states, 'DisplayType', 'polygon', ...
       'SymbolSpec', faceColors)

Note that the colors you obtain for this example can vary from what you see above because polcmap computes them randomly.

More About

collapse all


You cannot use polcmap to alter the colors of displayed patches drawn by geoshow or mapshow. The patches must have been rendered by displaym. However, you can color patches using polcmap when you call geoshow or mapshow, as shown below.

See Also


Introduced before R2006a

Was this topic helpful?