Main Content

geotickformat

Set or query geographic tick label format

Since R2019a

Description

Set Tick Format

example

geotickformat(fmt) sets the format of the latitude and longitude tick labels for the current geographic axes or map axes. If the current axes is not a geographic or map axes, or if there is no current axes, then the function creates a new geographic axes with the specified tick label format.

You can specify the fmt argument without parentheses. For example, geotickformat dd sets the tick label format to decimal degrees.

geotickformat(ax,fmt) sets the tick label format for the geographic axes or map axes specified by ax.

Query Tick Format

tickLabelFormat = geotickformat returns the tick label format for the current geographic axes or map axes.

tickLabelFormat = geotickformat(ax) returns the tick label format for the axes specified by ax.

Examples

collapse all

Specify the locations and names of three cities in Brazil.

lat = [-23.55 -22.91 -15.79];
lon = [-46.63 -43.2 -47.8828];
n = [" Sao Paulo"," Rio de Janeiro"," Brasilia"];

Display the locations and names using filled markers over the bluegreen basemap.

geoscatter(lat,lon,"filled")
text(lat,lon,n)
geobasemap bluegreen
geolimits([-25 -16],[-54 -38])

Change the tick label format to decimal degrees. The -dd option indicates south and west using a minus sign (–).

geotickformat -dd

Input Arguments

collapse all

Tick label format, specified as one of the following values.

FormatDescriptionExample
"dd"Decimal degrees plus compass direction23°N
"dm"Degrees and decimal minutes plus compass direction18°30'W
"dms" (default)Degrees, minutes, and decimal seconds plus compass direction110°06'18.5"E
"-dd"Decimal degrees with a minus sign (–) to indicate south and west-115.25°
"-dm"Degrees and decimal minutes with a minus sign (–) to indicate south and west-5°45.5'
"-dms"Degrees, minutes, and decimal seconds with a minus sign (–) to indicate south and west-3°21'05"

Data Types: char | string

Target axes, specified as a GeographicAxes object1 or MapAxes (Mapping Toolbox™) object.

If you do not specify this argument, then the geotickformat function sets the tick format for the current axes, provided that the current axes is a geographic or map axes object.

Tips

  • The geotickformat function queries the format stored in the TickLabelFormat property of the axes.

  • For geographic axes, if you override the format for an individual axis by setting the TickLabelFormat property of the GeographicRuler object associated with the axes, then the value returned by the geotickformat function does not match the format of the axis or the displayed map. Setting the TickLabelFormat property of an individual axis is not recommended.

Version History

Introduced in R2019a

See Also

Functions

Properties


1 Alignment of boundaries and region labels are a presentation of the feature provided by the data vendors and do not imply endorsement by MathWorks®.