Create map axes
The axesm
function creates a map axes into which both
vector and raster geographic data can be projected using functions such as
plotm
and geoshow
. Properties specific to map
axes can be assigned upon creation with axesm
, and for an existing
map axes they can be queried and changed using getm
and
setm
. Use the standard get
and
set
methods to query and control the standard MATLAB® axes properties of a map axes.
Map axes are standard MATLAB axes with different default settings for some properties and a MATLAB structure for storing projection parameters and other data. The main differences in default settings are:
Axes properties XGrid
, YGrid
,
XTick
, YTick
are set to
'off'
.
The hold
mode is 'on'
.
The map projection structure stores the map axes properties, which, in addition to the special standard axes settings, allow Mapping Toolbox™ functions to recognize an axes or an opened FIG-file as a map axes. See Map Axes Properties for descriptions of the map axes properties.
axesm
with no input arguments, initiates the
axesmui
map axes graphical user interface, which can be used
to set map axes properties. This is detailed on the axesmui
reference page.
axesm(
creates a map axes and
modifies the map axes appearance using name-value pairs to set properties. You can
specify multiple name-value pairs. Enclose each property name in quotes. For
example, Name,Value
)'FontSize',14
sets the font size for the map axes text.
Properties may be specified in any order, but the MapProjection
property must be included. For a full list of properties, see Map Axes Properties.
axesm(
specifies which map projection to use. projid
,Name,Value
)projid
should match one of
the entries in the last column displayed by the maps
function. You can also find these listed in Summary and Guide to Projections.
Create map axes for a Mercator projection, with selected latitude limits:
axesm('MapProjection','mercator','MapLatLimit',[-70 80])
In the preceding example, all properties not explicitly addressed in the call are
set to either fixed or calculated defaults. The file mercator.m
defines a projection function, so the same result could have been achieved with the
function
axesm('mercator','MapLatLimit',[-70 80])
Each projection function includes default values for all properties. Any following property name/property value pairs are treated as overrides.
In either of the above examples, data displayed in the given map axes is in a Mercator projection. Any data falling outside the prescribed limits is not displayed.
In general, after re-opening a saved figure that contains a map axes, you should not attempt to modify the projection properties of that map axes.
When you create a map axes with axesm
and right click in
the axes, a context menu appears. If you do not need the menu or it interferes
with your application, you can disable it by resetting the
'ButtonDownFcn'
property of the axes:
ax = axesm('mercator'); % Right-clicking brings up context menu. set(ax,'ButtonDownFcn',[]) % Context menu has been disabled.
By default, axesm
does not clip graticules or labels that
occur outside the boundaries of the axes. Enable clipping by setting the
'Clipping'
property of these
objects.
objects = [handlem('grid'); handlem('mlabel'); handlem('plabel')]; set(objects,'Clipping','on');