Main Content


Great circle or rhumb line defined via mouse input


h = trackg(ntrax)
h = trackg(ntrax,npts)
h = trackg(ntrax,LineSpec)
h = trackg(ntrax,PropertyName,PropertyValue,...)
[lat,lon] = trackg(ntrax,npts,...)
h = trackg(track,ntrax,...)


h = trackg(ntrax) brings forward the current map axes and waits for the user to make (2 x ntrax) mouse clicks. The output h is a vector of handles for the ntrax track segments, which are then displayed.

h = trackg(ntrax,npts) specifies the number of plotting points to be used for each track segment. npts is 100 by default.

h = trackg(ntrax,LineSpec) specifies the line style, marker, and color.

h = trackg(ntrax,PropertyName,PropertyValue,...) allows property name/property value pairs to be set, where PropertyName and PropertyValue are recognized by the line function.

[lat,lon] = trackg(ntrax,npts,...) returns the coordinates of the plotted points rather than the handles of the track segments. Successive segments are stored in separate columns of lat and lon.

h = trackg(track,ntrax,...) specifies the logic with which tracks are calculated. If track is 'gc' (the default), a great circle path is used. If track is 'rh', rhumb line logic is used.

This function is used to define great circles or rhumb lines for display using mouse clicks. For each track, two clicks are required, one for each endpoint of the desired track segment. You can modify the track after creation by Shift+clicking it. The track is then in edit mode, during which you can change the length and position by dragging control points, or by entering values into a control panel. Shift+clicking again exits edit mode.

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

See Also

| |

Introduced before R2006a