Main Content


Project 3-D lines and points on axesm-based map


h = plot3m(lat,lon,z)
h = plot3m(lat,lon,LineSpec)
h = plot3m(lat,lon,PropertyName,PropertyValue,...)


h = plot3m(lat,lon,z) displays projected line objects on the current axesm-based map. lat and lon are the latitude and longitude coordinates, respectively, of the line object to be projected. Note that this ordering is conceptually reversed from the MATLAB® line function, because the vertical (y) coordinate comes first. However, the ordering latitude, then longitude, is standard geographic usage. lat and lon must be the same size, and in the AngleUnits of the axesm-based map. z is the altitude data associated with each point in lat and lon. The object handle for the displayed line can be returned in h.

The units of z are arbitrary, except when using the globe projection. In the case of globe, z should have the same units as the radius of the earth or semimajor axis specified in the 'geoid' (reference ellipsoid) property of the axesm-based map. This implies that when the reference ellipsoid is a unit sphere, the units of z are earth radii.

h = plot3m(lat,lon,LineSpec) specifies the line style, marker, and color.

h = plot3m(lat,lon,PropertyName,PropertyValue,...) allows the specification of any number of property name/property value pairs for any properties recognized by the MATLAB line function except for XData, YData, and ZData.


axesm sinusoid; framem; view(3)
[lats,longs] = interpm([45 -45 -45 45 45 -45]',...
                       [-100 -100 100 100 -100 -100]',1);
z = (1:671)'/100;

More About

collapse all

Line Style, Marker, and Color

Specify the line style, marker, and color as a character vector or string containing symbols. The symbols can appear in any order. You do not need to specify all three characteristics (line style, marker, and color). For example, specify a red dashed line using '--r'.

Line StyleDescriptionResulting Line
"-"Solid line

Sample of solid line

"--"Dashed line

Sample of dashed line

":"Dotted line

Sample of dotted line

"-."Dash-dotted line

Sample of dash-dotted line, with alternating dashes and dots

MarkerDescriptionResulting Marker

Sample of circle marker

"+"Plus sign

Sample of plus sign marker


Sample of asterisk marker


Sample of point marker


Sample of cross marker

"_"Horizontal line

Sample of horizontal line marker

"|"Vertical line

Sample of vertical line marker


Sample of square marker


Sample of diamond line marker

"^"Upward-pointing triangle

Sample of upward-pointing triangle marker

"v"Downward-pointing triangle

Sample of downward-pointing triangle marker

">"Right-pointing triangle

Sample of right-pointing triangle marker

"<"Left-pointing triangle

Sample of left-pointing triangle marker


Sample of pentagram marker


Sample of hexagram marker

Color NameShort NameRGB TripletAppearance
"red""r"[1 0 0]

Sample of the color red

"green""g"[0 1 0]

Sample of the color green

"blue""b"[0 0 1]

Sample of the color blue

"cyan" "c"[0 1 1]

Sample of the color cyan

"magenta""m"[1 0 1]

Sample of the color magenta

"yellow""y"[1 1 0]

Sample of the color yellow

"black""k"[0 0 0]

Sample of the color black

"white""w"[1 1 1]

Sample of the color white


plot3m is the mapping equivalent of the MATLAB plot3 function.

See Also

| |