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
Limits
— Minimum and maximum axis limits[min max]
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
— Color of axis line and labels[0.15 0.15 0.15]
(default) | RGB triplet | hexadecimal color code | color name | short color nameColor 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 Name | Short Name | RGB Triplet | Hexadecimal Color Code | Appearance |
---|---|---|---|---|
'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 applicable | Not applicable | Not applicable | No color |
Here are the RGB triplets and hexadecimal color codes for the default colors MATLAB® uses in many types of plots.
RGB Triplet | Hexadecimal Color Code | Appearance |
---|---|---|
[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';
LineWidth
— Width of axis line and tick marks0.5
(default) | positive valueWidth 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;
Label
— Axis labelText
objectAxis label, specified as a Text
object.
To change existing text, set the String
property of the
Text
object. To change the label appearance, such as the font size
or color, set other properties. For a complete list, see Text Properties.
For example, create a geographic axes object. Set the string property of the
latitude axis label to 'Latitude Axis'
and the font size of the
longitude axis label to 16
.
gx = geoaxes;
gx.LatitudeAxis.Label.String = 'Latitude Axis';
gx.LongitudeAxis.Label.FontSize = 16;
Note
The Text
object is not a child of the ruler object, cannot be
returned by findobj
, and does not use default values
defined for Text
objects.
LabelHorizontalAlignment
— Axis label horizontal alignment'center'
(default) | 'left'
| 'right'
Axis label horizontal alignment, specified as one of the values from the table.
LabelHorizontalAlignment Value | Description | Appearance |
---|---|---|
'center' | For a horizontal axis, the label is centered between the left and right edges of the plot box. For a vertical axis, the label is centered between the top and bottom edges of the plot box. |
|
'left' | For a horizontal axis, the label is aligned with the left edge of the plot box. For a vertical axis, the label is aligned with the bottom edge of the plot box. |
|
'right' | For a horizontal axis, the label is aligned with the right edge of the plot box. For a vertical axis, the label is aligned with the top edge of the plot box. |
|
Visible
— Axis ruler visibility'on'
(default) | on/off logical valueAxis ruler visibility, specified as 'on'
or
'off'
, or as numeric or logical 1
(true
) or 0
(false
). A value
of 'on'
is equivalent to true
, and
'off'
is equivalent to false
. Thus, you can use
the value of this property as a logical value. The value is stored as an on/off logical
value of type matlab.lang.OnOffSwitchState
.
'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';
TickValues
— Tick mark locations along the axisTick 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;
TickValuesMode
— Selection mode for TickValues
property'auto'
(default) | 'manual'
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.
TickLabels
— Tick mark labelsTick 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
TickLabelsMode
— Selection mode for TickLabels
property'auto'
(default) | 'manual'
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.
TickLabelInterpreter
— Interpretation of tick label characters'tex'
(default) | 'latex'
| 'none'
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';
TickLabelFormat
— Tick label format'dms'
(default) | 'dd'
| 'dm'
| -'dd'
| '-dm'
| '-dms'
Tick label format, specified as one of the following values.
Format | Description | Example |
---|---|---|
'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';
TickLabelRotation
— Rotation of tick labelsRotation 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;
TickLabelRotationMode
— Selection mode for TickLabelRotation
property'auto'
(default) | 'manual'
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.
TickDirection
— Tick mark direction'in'
(default) | 'out'
| 'both'
Tick mark direction, specified as one of these values:
Value | Description | Example |
---|---|---|
'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';
TickDirectionMode
— Selection mode for TickDirection
property'auto'
(default) | 'manual'
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.
TickLength
— Tick mark lengthTick 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];
FontName
— Font name'FixedWidth'
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';
FontSize
— Font sizeFont 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;
FontWeight
— Thickness of text characters'normal'
(default) | 'bold'
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';
FontAngle
— Text character slant'normal'
(default) | 'italic'
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';
FontSmoothing
— Character smoothing'on'
(default) | on/off logical valueCharacter smoothing, specified as 'on'
or
'off'
, or as numeric or logical 1
(true
) or 0
(false
). A value
of 'on'
is equivalent to true
, and
'off'
is equivalent to false
. Thus, you can use
the value of this property as a logical value. The value is stored as an on/off logical
value of type matlab.lang.OnOffSwitchState
.
'on'
— Use 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'
— Do not use antialiasing. Use this setting if
the text seems blurry.
Example: gx.LatitudeAxis.FontSmoothing = 'off';
Parent
— Ruler parentAxes
objectRuler parent, specified as an Axes
object.
Note
Ruler objects are not listed in the Children
property of the
parent Axes
object.
Children
— Ruler childrenGraphicsPlaceholder
arrayThe ruler has no children. You cannot set this property.