The Map Axes
When you create a map, you can use one of the Mapping Toolbox™ built-in user interfaces (UIs), or you can build the graphic with
MATLAB® and Mapping Toolbox functions. Many MATLAB graphics are built using the axes
function:
axes axes('PropertyName',PropertyValue,...) axes(h) h = axes(...)
Mapping Toolbox functions include an extended version of axes
, called
axesm
. Axes created with axesm
share all
properties associated with regular axes, and they includes information about the current
coordinate system (map projection), as well as data to define the map grid and its
labeling, the map frame and its limits, scale, and other properties. For complete
descriptions of all map axes properties, see the axesm
reference page.
The syntax of axesm
is similar to that of
axes
:
axesm axesm(PropertyName,PropertyValue,...) axesm(ProjectionFcn,PropertyName,PropertyValue,...)
The axesm
function without arguments brings up a UI that lists
all supported projections and assists in defining their parameters. You can also summon
this UI with the axesmui
function once you have created a map
axes.
The figure window created using axesm
contains the same set of
tools and menus as any MATLAB figure. By default, the figure window is blank, even if there is map data
in your workspace. You can toggle certain properties, such as grids, frames, and axis
labels, by right-clicking in the figure window to obtain a pop-up menu.
Tips to Working with Map Axes
You can list all the names, classes, and IDs of Mapping Toolbox map projections with the
maps
function.You can place many types of objects in a map axes, such as lines, patches, markers, scale rulers, north arrows, grids, and text. You can use the
handlem
function and its associated UI to list these objects. See thehandlem
reference page for a list of the objects that can occupy a map axes and how to query for them.You can define multiple independent figures containing map axes, but only one can be active at any one time. Use
axes(obj)
to activate an existing map axes object.Map axes objects created by
axesm
contain projection information in a structure. For an example of what these properties are, typeh = axesm('MapProjection','mercator')
and then use the
getm
function to retrieve all the map axes properties:p = getm(h)