| 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 |
usamap state
usamap(state)
usamap 'conus'
usamap('conus')
usamap
usamap(latlim, lonlim)
usamap(Z, R)
h = usamap(...)
h = usamap('all')
h = usamap('allequal')
usamap state or usamap(state) constructs an empty map axes with a Lambert Conformal Conic projection and map limits covering a U.S. state or group of states specified by input state. state may be a string or a cell array of strings, where each string contains the name of a state or 'District of Columbia'. Alternatively, state may be a standard two-letter U.S. Postal Service abbreviation. The map axes is created in the current axes and the axis limits are set tight around the map frame.
usamap 'conus' or usamap('conus') constructs an empty map axes for the conterminous 48 states (i.e. excluding Alaska and Hawaii).
usamap with no arguments asks you to choose from a menu of state names plus 'District of Columbia', 'conus', 'all', and 'allequal'.
usamap(latlim, lonlim) constructs an empty Lambert Conformal map axes for a region of the U.S. defined by its latitude and longitude limits in degrees. latlim and lonlim are two-element vectors of the form [southern_limit northern_limit] and [western_limit eastern_limit], respectively.
usamap(Z, R) derives the map limits from the extent of a regular data grid georeferenced by R. R is either a 1-by-3 vector containing elements:
[cells/degree northern_latitude_limit western_longitude_limit]
or a 3-by-2 referencing matrix that transforms raster row and column indices to/from geographic coordinates according to:
[lon lat] = [row col 1] * R
If R is a referencing matrix, it must define a (non-rotational, non-skewed) relationship in which each column of the data grid falls along a meridian and each row falls along a parallel.
h = usamap(...) returns the handle of the map axes.
h = usamap('all') constructs three empty axes, inset within a single figure, for the conterminous states, Alaska, and Hawaii, respectively, using projection parameters suggested by the U.S. Geological Survey. The handles for the three map axes are returned in h. h(1) is for the conterminous states, h(2) is for Alaska, and h(3) is for Hawaii.
h = usamap('allequal') constructs the map axes with Alaska and Hawaii at the same scale as the conterminous states.
usamap uses tightmap set the axis limits tight around the map. If you change the projection, or just want more white space around the map frame, use tightmap again or axis auto.
axes(h(n)), where n = 1, 2, or 3, makes the desired axes current.
set(h,'Visible','on') makes the axes visible.
set(h,'ButtonDownFcn','selectmoveresize') allows interactive repositioning of the axes. set(h,'ButtonDownFcn','uimaptbx') restores the Mapping Toolbox interfaces.
axesscale(h(1)) resizes the axes containing Alaska and Hawaii to the same scale as the conterminous states.
Make a map of Alabama only:
usamap('Alabama')
alabamahi = shaperead('usastatehi', 'UseGeoCoords', true,...
'Selector',{@(name) strcmpi(name,'Alabama'), 'Name'});
geoshow(alabamahi, 'FaceColor', [0.3 1.0, 0.675])
textm(alabamahi.LabelLat, alabamahi.LabelLon, alabamahi.Name,...
'HorizontalAlignment', 'center')

Map a region extending from California to Montana:
figure; ax = usamap({'CA','MT'});
set(ax, 'Visible', 'off')
latlim = getm(ax, 'MapLatLimit');
lonlim = getm(ax, 'MapLonLimit');
states = shaperead('usastatehi',...
'UseGeoCoords', true, 'BoundingBox', [lonlim', latlim']);
geoshow(ax, states, 'FaceColor', [0.5 0.5 1])
lat = [states.LabelLat];
lon = [states.LabelLon];
tf = ingeoquad(lat, lon, latlim, lonlim);
textm(lat(tf), lon(tf), {states(tf).Name}, ...
'HorizontalAlignment', 'center')

Map the Conterminous United States with a different fill color for each state:
figure; ax = usamap('conus');
states = shaperead('usastatelo', 'UseGeoCoords', true,...
'Selector',...
{@(name) ~any(strcmp(name,{'Alaska','Hawaii'})), 'Name'});
faceColors = makesymbolspec('Polygon',...
{'INDEX', [1 numel(states)], 'FaceColor', ...
polcmap(numel(states))}); %NOTE - colors are random
geoshow(ax, states, 'DisplayType', 'polygon', ...
'SymbolSpec', faceColors)
framem off; gridm off; mlabel off; plabel off

Map of the USA with separate axes for Alaska and Hawaii:
figure; ax = usamap('allequal');
set(ax, 'Visible', 'off')
states = shaperead('usastatelo', 'UseGeoCoords', true);
names = {states.Name};
indexHawaii = strmatch('Hawaii',names);
indexAlaska = strmatch('Alaska',names);
indexConus = 1:numel(states);
indexConus(indexHawaii) = [];
indexConus(indexAlaska) = [];
stateColor = [0.5 1 0.5];
geoshow(ax(1), states(indexConus), 'FaceColor', stateColor)
geoshow(ax(2), states(indexAlaska), 'FaceColor', stateColor)
geoshow(ax(3), states(indexHawaii), 'FaceColor', stateColor)
for k = 1:3
setm(ax(k), 'Frame', 'off', 'Grid', 'off',...
'ParallelLabel', 'off', 'MeridianLabel', 'off')
end

axesm, axesscale, geoshow, paperscale, selectmoveresize, tightmap, worldmap
![]() | updategeostruct | usgs24kdem | ![]() |

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 |