| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Mapping Toolbox |
| Contents | Index |
| Learn more about Mapping Toolbox |
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. As an 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:
figure
h1 = worldmap('south america');

Use shaperead to read the demo world land areas polygon shapefile:
land = shaperead('landareas.shp', 'UseGeoCoords', true);Display the data in the map axes:
geoshow([land.Lat],[land.Lon]) 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'});
usamap('california')
geoshow([CA.Lat],[CA.Lon])

Set the frame fill color and set the labels:
setm(h2,'FFaceColor','w') 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:
axesscale(h1) 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')
ans =
eqdconic
getm(h2, 'mapprojection')
ans =
lambert
setm(h1, 'mapprojection', getm(h2, 'mapprojection'))

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

![]() | Customizing and Printing Maps | Graphic Scales | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |