northarrow

Add graphic element pointing to geographic North Pole

Syntax

northarrow
northarrow('property',value,...)

Description

northarrow creates a default north arrow.

northarrow('property',value,...) creates a north arrow using the specified property/value pairs. Valid entries for properties are 'latitude', 'longitude', 'facecolor', 'edgecolor', 'linewidth', and 'scaleratio'. The 'latitude' and 'longitude' properties specify the location of the north arrow. The 'facecolor', 'edgecolor', and 'linewidth' properties control the appearance of the north arrow. The 'scaleratio' property represents the size of the north arrow as a fraction of the size of the axes. A 'scaleratio' value of 0.10 creates a north arrow one-tenth (1/10) the size of the axes. You can change the appearance ('facecolor', 'edgecolor', and 'linewidth') of the north arrow using the set command.

northarrow creates a north arrow symbol at the map origin on the displayed map. You can reposition the north arrow symbol by clicking and dragging its icon. Alternate clicking the icon creates an input dialog box that you can also use to change the location of the north arrow.

Modifying some of the properties of the north arrow results in replacement of the original object. Use HANDLEM('NorthArrow') to get the handles associated with the north arrow.

Examples

Create a map of the South Pole and then add the north arrow in the upper left of the map.

Antarctica = shaperead('landareas', 'UseGeoCoords', true, ...
    'Selector',{@(name) strcmpi(name,{'Antarctica'}), 'Name'});
figure;
worldmap('south pole')
geoshow(Antarctica,'FaceColor',[.9 .9 .9])
northarrow('latitude', -57, 'longitude', 135);

Right-click the north arrow icon to activate the input dialog box. Increase the size of the north arrow symbol by changing the 'ScaleRatio' property.

Create a map of Texas and add the north arrow in the lower left of the map.

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)
northarrow('latitude',25,'longitude',-105,'linewidth',1.5);

Change the 'FaceColor' and 'EdgeColor' properties of the north arrow.

h = handlem('NorthArrow');
set(h,'FaceColor',[1.000 0.8431 0.0000],...
      'EdgeColor',[0.0100 0.0100 0.9000])

Limitations

You can draw multiple north arrows on the map. However, the callbacks will only work with the most recently created north arrow. In addition, since it can be displayed outside the map frame limits, the north arrow is not converted into a “mapped” object. Hence, the location and orientation of the north arrow have to be updated manually if the map origin or projection changes.

See Also

Introduced before R2006a