GeographicRuler Properties

Control appearance and behavior of axis with geographic values

GeographicRuler properties control the appearance and behavior of the latitude axis and the longitude axis in a GeographicAxes. Each individual axis is a GeographicRuler object. By changing property values of the ruler, you can modify certain aspects of a specific axis.

For certain ruler properties, you can customize the appearance of both rulers (latitude axis and longitude axis) by setting properties on the geographic axes instead of setting properties of each individual ruler. For example, using the GeographicRuler properties, you can specify a different color for each ruler. Typically, it's preferable, and simpler, to specify the color of both rulers using the GeographicAxes property, and keep the rulers consistent in appearance.

Use dot notation to refer to a ruler property. Access the ruler object through the LatitudeAxis or LongitudeAxis property of the GeographicAxes object.

% Create a GeographicAxes. 
gx = geoaxes;

% View GeographicRuler object.
latruler = gx.LatitudeAxis

latruler = 

  GeographicRuler with properties:

             Limits: [-85.0511 85.0511]
         TickValues: [-75 -45 0 45 75]
    TickLabelFormat: 'dms'

  Show all properties

Appearance

expand all

Minimum and maximum axis limits, specified as a two-element vector of the form [min max]. Limits is a read-only property.

To set the limits of a GeographicAxes, use the geolimits function.

Note

The Limits property for the latitude and longitude GeographicRuler objects always has the same value as the LatitudeLimits property and the Longitudelimits properties of the parent GeographicAxes object, respectively.

Example: latlim = gx.LatitudeAxis.Limits;

Color of the axis line and labels, specified as an RGB triplet, a hexadecimal color code, a color name, or a short color name.

For a custom color, specify an RGB triplet or a hexadecimal color code.

  • An RGB triplet is a three-element row vector whose elements specify the intensities of the red, green, and blue components of the color. The intensities must be in the range [0,1]; for example, [0.4 0.6 0.7].

  • A hexadecimal color code is a character vector or a string scalar that starts with a hash symbol (#) followed by three or six hexadecimal digits, which can range from 0 to F. The values are not case sensitive. Thus, the color codes '#FF8800', '#ff8800', '#F80', and '#f80' are equivalent.

Alternatively, you can specify some common colors by name. This table lists the named color options, the equivalent RGB triplets, and hexadecimal color codes.

Color NameShort NameRGB TripletHexadecimal Color CodeAppearance
'red''r'[1 0 0]'#FF0000'

'green''g'[0 1 0]'#00FF00'

'blue''b'[0 0 1]'#0000FF'

'cyan' 'c'[0 1 1]'#00FFFF'

'magenta''m'[1 0 1]'#FF00FF'

'yellow''y'[1 1 0]'#FFFF00'

'black''k'[0 0 0]'#000000'

'white''w'[1 1 1]'#FFFFFF'

'none'Not applicableNot applicableNot applicableNo color

Here are the RGB triplets and hexadecimal color codes for the default colors MATLAB® uses in many types of plots.

RGB TripletHexadecimal Color CodeAppearance
[0 0.4470 0.7410]'#0072BD'

[0.8500 0.3250 0.0980]'#D95319'

[0.9290 0.6940 0.1250]'#EDB120'

[0.4940 0.1840 0.5560]'#7E2F8E'

[0.4660 0.6740 0.1880]'#77AC30'

[0.3010 0.7450 0.9330]'#4DBEEE'

[0.6350 0.0780 0.1840]'#A2142F'

Note

Setting the AxisColor property for the parent GeographicAxes sets the Color property for the GeographicRuler objects to the same value. These ruler objects are associated with the LatitudeAxis and LongitudeAxis properties of the GeographicAxes. Conversely, setting these GeographicRuler properties does not set the GeographicAxes property. To prevent the axes property value from overriding the ruler property value, set the axes value first, and then set the ruler value.

Example: gx.LatitudeAxis.Color = 'b'

Example: gx.LatitudeAxis.Color = 'blue'

Example: gx.LatitudeAxis.Color = [0.1 0.7 0.8];

Example: gx.LatitudeAxis.Color = '#0000FF';

Width of axis line and tick marks, specified as a positive value in point units. One point equals 1/72 inch.

Note

Setting the LineWidth property for the parent GeographicAxes sets the LineWidth property for the GeographicRuler objects to the same value. These ruler objects are associated with the LatitudeAxis and LongitudeAxis properties of the GeographicAxes. Conversely, setting a ruler property does not set the axes property. To prevent the axes property value from overriding the ruler property value, set the axes value first, and then set the ruler value.

Example: gx.LatitudeAxis.LineWidth = 2;

Axis label, specified as a Text object.

To change existing text, set the String property of the Text object. Use other Text object properties to change the text appearance, such as the font style or color.

gx.LatitudeAxis.Label.String = 'Latitude Axis';
gx.LatitudeAxis.Label.FontSize = 16;

For a full list of options, see the Text Properties object property reference page.

Note

The Text object is not a child of the ruler object and, thus, it does not appear in the list of objects returned by findobj. This Text object does not use default Text property values.

Axis ruler visibility, specified as one of these values:

  • 'on' — Display the axis ruler.

  • 'off' — Hide the axis ruler without deleting it. You still can access properties of an invisible axis ruler using the ruler object.

Example: gx.LatitudeAxis.Visible = 'off';

Tick Values and Labels

expand all

Tick mark locations along the axis, specified as a vector of increasing values.

If you assign a value to this property, MATLAB sets the TickValuesMode property to 'manual'.

Example: gx.LatitudeAxis.TickValues = [-15 -10 0 10 15];

Example: gx.LongitudeAxis.TickValues = 0:10:100;

Selection mode for the TickValues property, specified as one of these values:

  • 'auto' — Automatically select the tick values based on the limits of the map and the position (size) of the axes.

  • 'manual' — Use tick values that you specify. To specify the values, set the TickValues property.

Tick mark labels, specified as a cell array of character vectors or a string array. If you do not specify enough labels for all of the tick values, then the labels repeat. The labels support TeX and LaTeX markup. See the TickLabelInterpreter property for more information.

Example: gx.TickValues = [-66.5 -23.5 0 23.5 66.5];gx.LatitudeAxis.TickLabels = {'Antarctic Circle','Tropic of Capricorn','Equator','Tropic of Cancer','Artic Circle'};

If you set this property, MATLAB sets the TickLabelsMode property to 'manual'.

Data Types: char | string

Selection mode for the TickLabels property, specified as one of these values:

  • 'auto' — Automatically select the tick labels.

  • 'manual' — Use tick labels that you specify. To specify the labels, set the TickLabels property.

Interpretation of tick label characters, specified as one of these values:

  • 'tex' — Interpret characters using a subset of TeX markup.

  • 'latex' — Interpret characters using LaTeX markup.

  • 'none' — Display literal characters.

For more information about these interpreters, see the Interpreter property on the Text Properties reference page.

Example: gx.LatitudeAxis.TickLabelInterpreter = 'latex';

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

FormatDescriptionExample
'dd'Decimal degrees plus compass direction
23°N
'dm'Degrees and (decimal) minutes plus compass direction
18°30'W
'dms'Degrees, minutes, and (decimal) seconds plus compass direction
110°06'18.5"E
'-dd'Decimal degrees with minus sign (-) to indicate south and west.
-115.25°
'-dm'Degrees and (decimal) minutes with minus sign (-) to indicate south and west.
-5°45.5'
'-dms'Degrees, minutes, and (decimal) seconds with minus sign (-) to indicate south and west.
-3°21'05"

You can also specify the tick label format using the geotickformat function.

Note

Setting the TickLabelFormat property for the parent GeographicAxes sets the TickLabelFormat property for the GeographicRuler objects to the same value. These ruler objects are associated with the LatitudeAxis and LongitudeAxis properties of the GeographicAxes. Conversely, setting either of the ruler properties does not set the axes property. To prevent the axes property value from overriding the ruler property value, set the axes value first, and then set the ruler value.

Example: gx.LatitudeAxis.TickLabelFormat = 'dd';

Rotation of tick labels, specified as a scalar value in degrees. Positive values give counterclockwise rotation. Negative values give clockwise rotation. For example, specify gx.LatitudeAxis.TickLabelRotation = 45; to rotate the tick labels 45 degrees in a counterclockwise direction,

If you assign a value to this property, then MATLAB sets the TickLabelRotation property to 'manual'.

Example: gx.LatitudeAxis.TickLabelRotation = -45;

Selection mode for the TickLabelRotation property, specified as one of these values:

  • 'auto' — Object automatically selects the tick label rotation.

  • 'manual' — Use a tick label rotation that you specify. To specify the rotation, set the TickLabelRotation property.

Tick mark direction, specified as one of these values:

ValueDescriptionExample
'in'Direct the tick marks inward from the axis lines.

'out'Direct the tick marks outward from the axis lines.

'both'Center the tick marks over the axis lines.

If you assign a value to this property, MATLAB sets the TickDirectionMode property to 'manual'.

Note

Setting the TickDir property for the parent GeographicAxes sets the TickDirection property for the GeographicRuler object to the same value. The GeographicRuler object is associated with the LatitudeAxis and LongitudeAxis properties of the GeographicAxes. Conversely, setting one of the ruler properties does not set the axes property. To prevent the axes property value from overriding the ruler property value, set the axes value first, and then set the ruler value.

Example: gx.LatitudeAxis.TickDirection = 'out';

Selection mode for the TickDirection property, specified as one of these values:

  • 'auto' — Automatically select the tick direction.

  • 'manual' — Use a tick direction that you specify. To specify the tick direction, set the TickDirection property.

Tick mark length, specified as a two-element vector of the form [length unused]. (The GeographicRuler object uses a two-element vector to be consistent with the value of this property in other ruler objects.) The first element is the tick mark length. Specify the values in units normalized relative to the longest axes dimension.

Note

Setting the TickLength property for the parent GeographicAxes sets the TickLength property for the GeographicRuler objects to the same value. The GeographicRuler objects are associated with the LatitudeAxis and LongitudeAxis. Conversely, setting the ruler property does not set the axes property. To prevent the axes property value from overriding the ruler property value, set the axes value first, and then set the ruler value.

Example: gx.LatitudeAxis.TickLength = [0.04 0];

Font

expand all

Font name, specified as a system supported font name or 'FixedWidth'. The default font depends on the specific system and locale. To use a fixed-width font that looks good in any locale, specify 'FixedWidth'. The actual fixed-width font used depends on the FixedWidthFontName property of the root object.

Note

Setting the FontName property for the parent axes sets the FontName property for the GeographicRuler objects to the same value. The GeographicRuler objects are associated with LatitudeAxis and LongitudeAxis. Conversely, setting the ruler property does not set the axes property. To prevent the axes property value from overriding the ruler property value, set the axes value first, and then set the ruler value.

Example: gx.LatitudeAxis.FontName = 'Cambria';

Font size, specified as a scalar numeric value. The default font size depends on the specific operating system and locale.

Note

Setting the FontSize property for the parent axes sets the FontSize property for the GeographicRuler objects to the same value. The GeographicRuler objects are associated with LatitudeAxis and LongitudeAxis properties. Conversely, setting the ruler properties does not set the axes property. To prevent the axes property value from overriding the value of the ruler properties, set the axes value first, and then set the ruler value.

Example: gx.LatitudeAxis.FontSize = 12;

Thickness of the text characters, specified as one of these values:

  • 'normal' — Default weight as defined by the particular font.

  • 'bold' — Thicker character outlines than normal.

MATLAB uses the FontWeight property to select a font from the fonts available on your system. Not all fonts have a bold font weight. Therefore, specifying a bold font weight still can result in the normal font weight.

Note

Setting the FontWeight property for the parent axes sets the FontWeight property for the GeographicRuler objects to the same value. The GeographicRuler objects are associated with the LatitudeAxis and LongitudeAxis properties. Conversely, setting the ruler properties does not set the axes property. To prevent the axes property value from overriding the ruler property values, set the axes value first, and then set the ruler value.

Example: gx.LatitudeAxis.FontWeight = 'bold';

Character slant, specified as 'normal' or 'italic'. Not all fonts have both font styles. Therefore, the italic font can look the same as the normal font.

Note

Setting the FontAngle property for the parent axes sets the FontAngle property for the GeographicRuler objects for both the LatitudeAxis and LongitudeAxis to the same value. Conversely, setting the ruler property does not set the axes property. To prevent the axes property value from overriding the ruler property values, set the axes value first, and then set the ruler value.

Example: gx.LatitudeAxis.FontAngle = 'italic';

Text smoothing, specified as one of these values:

  • 'on' — Enable text antialiasing to reduce the jagged appearance of text characters and make the text easier to read. In certain cases, smoothed text blends against the background color and can make the text appear blurry.

  • 'off' — Disable text antialiasing. Use this setting if the text seems blurry.

Example: gx.LatitudeAxis.FontSmoothing = 'off';

Parent/Child

expand all

Ruler parent, specified as an Axes object.

Note

Ruler objects are not listed in the Children property of the parent Axes object.

The ruler has no children. You cannot set this property.

Introduced in R2019a