Main Content

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.

The northarrow function 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. Alternatively, open a dialog box that you can use to change the location of the north arrow by right-clicking or Ctrl-clicking the arrow. The orientation of the north arrow is computed for you, and does not need manual adjustment, no matter where you move the symbol.

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

collapse all

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])

Create a map centered at the South Pole. Add a north arrow at a specified geographic position.

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

Change the appearance of the north arrow.

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

Show that every direction from the South Pole is north by creating three more north arrows. Note that north arrows are objects in the axes with Cartesian coordinates, not mapping objects. As a result, if you create more than one north arrow, any Mapping Toolbox™ function that manipulates a north arrow will affect only the last one drawn.

northarrow('latitude',-57,'longitude', 45);
northarrow('latitude',-57,'longitude',225);
northarrow('latitude',-57,'longitude',315);

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