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.

Inset Maps

Inset maps are often used to display widely separated areas, generally at the same scale, or to place a map in context by including overviews at smaller scales. You can create inset maps by nesting multiple axes in a figure and defining appropriate map projections for each. To ensure that the scale of each of the maps is the same, use axesscale to resize them. In this example, create an inset map of California at the same scale as the map of South America, to relate the size of that continent to a more familiar region.

Begin by defining a map frame for South America using worldmap.

h1 = worldmap('south america');

Use shaperead to read the world land areas polygon shapefile.

land = shaperead('landareas.shp', 'UseGeoCoords', true);

Display the data in the map axes.

setm(h1,'FFaceColor','w') % set the frame fill to white

Place axes for an inset in the lower middle of the map frame, and project a line map of California:

h2 = axes('pos',[.5 .2 .1 .1]);
CA = shaperead('usastatehi', 'UseGeoCoords', true, ...
   'Selector', {@(name) isequal(name,'California'), 'Name'});

Set the frame fill color and set the labels.

mlabel; plabel; gridm % toggle off

Make the scale of the inset axes, h2 (California), match the scale of the original axes, h1 (South America). Hide the map border.

set([h1 h2], 'Visible', 'off')

Note that the toolbox software chose a different projection and appropriate parameters for each region based on its location and shape. You can override these choices to make the two projections the same.

Find out what map projections are used, and then make South America's projection the same as California's.

getm(h1, 'mapprojection')
getm(h2, 'mapprojection')
setm(h1, 'mapprojection', getm(h2, 'mapprojection'))
ans =


ans =


Note that the parameters for South America defaulted properly (those appropriate for California were not used).

Finally, experiment with changing properties of the inset, such as its color.

setm(h2, 'ffacecolor', 'y')

Was this topic helpful?