Main Content


Project 2-D lines and points on map axes


plotm is the mapping equivalent of the MATLAB® plot function.

plotm(lat,lon) displays projected line objects on the current map axes. lat and lon are the latitude and longitude coordinates, respectively, of the line object to be projected. This ordering of latitude then longitude is standard geographic usage. However, this ordering is conceptually reversed from the MATLAB line function, in which the horizontal (x) coordinate comes first.

plotm([lat lon]) allows the latitude and longitude coordinates to be packed into a single two-column matrix.


plotm(lat,lon,linetype) specifies the line style, linetype.

plotm(lat,lon,Name,Value) uses name-value pair arguments to specify any number of Line Properties except for XData, YData, and ZData. Name is the property name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN. Property names can be abbreviated, and case does not matter.

h = plotm(___) returns a handle to the displayed line.


collapse all

First, load coastline data into the workspace and create a set of map axes. Then, plot the data. The plotm function uses the NaN values in coastlat and coastlon to break the data into separate lines.

load coastlines
ax = axesm('sinusoid','Frame','on');

Input Arguments

collapse all

Latitude or longitude vector, specified as a numeric vector. Specify values in units that match the AngleUnits property of the map axes. lat and lon must be the same size.

Create breaks in lines or polygons using NaN values. For example, this code plots the first three elements, skips the fourth element, and draws another line using the last three elements.

lat = [0 1 2 NaN 4 5 6];
lon = [0 1 2 NaN 3 4 5];

Line specification that controls the style of the line, specified as a LineSpec.

Output Arguments

collapse all

Handle to the displayed line, returned as a handle to a MATLAB graphics object.

See Also

| |

Introduced before R2006a