Documentation

polcmap

Colormaps appropriate to political regions

Syntax

polcmap
polcmap(ncolors)
polcmap(ncolors,maxsat)
polcmap(ncolors,huelimits,saturationlimits,valuelimits)
cmap = polcmap(...)

Description

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.

Examples

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', ...
      polcmap(numel(states))});
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

expand all

Tips

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

|

Was this topic helpful?