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.


Construct vector layer symbolization specification


symbolspec = makesymbolspec(geometry,rule1,rule2,...ruleN)


symbolspec = makesymbolspec(geometry,rule1,rule2,...ruleN) constructs a symbol specification structure (symbolspec) for symbolizing a (vector) shape layer in the Map Viewer or when using mapshow. geometry is one of 'Point', 'Line', 'PolyLine', 'Polygon', or 'Patch'. Rules, defined in detail below, specify the graphics properties for each feature of the layer. A rule can be a default rule that is applied to all features in the layer or it may limit the symbolization to only those features that have a particular value for a specified attribute. Features that do not match any rules are displayed using the default graphics properties.

To create a rule that applies to all features, a default rule, use the following syntax:


To create a rule that applies only to features that have a particular value or range of values for a specified attribute, use the following syntax:


AttributeValue and ValueN can each be a two-element vector, [low high], specifying a range. If AttributeValue is a range, ValueN might or might not be a range.

The following is a list of allowable values for PropertyN.

  • Points or Multipoints: 'Marker', 'Color', 'MarkerEdgeColor', 'MarkerFaceColor', 'MarkerSize', and 'Visible'

  • Lines or PolyLines: 'Color', 'LineStyle', 'LineWidth', and 'Visible'

  • Polygons: 'FaceColor', 'FaceAlpha', 'LineStyle', 'LineWidth', 'EdgeColor', 'EdgeAlpha', and 'Visible'


The following examples import a shapefile containing road data and symbolize it in several ways using symbol specifications.

Example 1 — Default Color

roads = shaperead('concord_roads.shp');
blueRoads = makesymbolspec('Line',{'Default','Color',[0 0 1]});

Example 2 — Discrete Attribute Based

roads = shaperead('concord_roads.shp');
roadColors = ...

Example 3 — Using a Range of Attribute Values

roads = shaperead('concord_roads.shp');
lineStyle = makesymbolspec('Line',...
 {'CLASS',[1 3], 'LineStyle',':'},...
 {'CLASS',[4 6],'LineStyle','-.'});

Example 4 — Using a Range of Attribute Values and a Range of Property Values

roads = shaperead('concord_roads.shp');
colorRange = makesymbolspec('Line',...
                           {'CLASS',[1 6],'Color',summer(10)});

See Also

| |

Introduced before R2006a

Was this topic helpful?