Main Content

axesm

Create map axes

Description

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(Name,Value) 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, '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(projid,Name,Value) specifies which map projection to use. 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.

Examples

Create Map Axes for Mercator Projection

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.

Input Arguments

collapse all

Map projection ID, specified as a string scalar or character vector. 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.

Note

The names of projection files are case sensitive. The projection files included in Mapping Toolbox software use only lowercase letters and Arabic numerals.

Example: 'eqdcylin'

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: axesm('MapProjection','pcarree','Frame','on') creates a map axes with a Plate Carree projection, and makes the map frame visible.

Note

The properties listed here are only a subset. For a full list, see Map Axes Properties.

Map projection, specified as a string scalar or character vector. MapProjection sets the projection, and hence all transformation calculations, for the map axes object. It must be a member of the recognized projection set, which you can list by typing getm('MapProjection') or maps. For more information on projections, see the Mapping Toolbox User's Guide. Some projections set their own defaults for other properties, such as parallels and trim limits.

Geographic latitude limits of the display area, specified as a two-element vector of the form [southern_limit northern_limit]. This property can be set for many typical projections and geometries, but cannot be used with oblique projections or with globe, for example.

When applicable, the MapLatLimit property may affect the origin latitude if the Origin property is not set explicitly when calling axesm. It may also determine the value used for FLatLimit. See Access and Change Map Axes Properties for a more complete description of the applicability of MapLatLimit and its interaction with the origin, frame limits, and other properties.

Geographic longitude limits of the display area, specified as a two-element vector of the form [western_limit eastern_limit]. This property can be set for many typical projections and geometries, but cannot be used with oblique projections or with globe, for example.

When applicable, the MapLonLimit property may affect the origin longitude if the Origin property is not set explicitly when calling axesm. It may also determine the value used for FLonLimit. See Access and Change Map Axes Properties for a more complete description of the applicability of MapLonLimit and its interaction with the origin, frame limits, and other properties.

Tips

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

Introduced before R2006a