GeographicRuler Properties
Control axis with geographic values
GeographicRuler
properties control the appearance
and behavior of the latitude axis and longitude axis in a GeographicAxes
object. Each individual axis has its own ruler object. By changing property values of the
ruler, you can modify certain aspects of a specific axis.
You can customize some aspects of the rulers by setting properties of the geographic axes
instead of setting properties of the rulers. For example, you can specify a different color
for each ruler by setting the Color
property of each
GeographicRuler
object. However, by setting the
AxisColor
property of the GeographicAxes
object, you
can keep the appearance of the rulers consistent.
Use dot notation to refer to a particular ruler and property. Access the ruler objects
through the LatitudeAxis
or LongitudeAxis
properties
of the GeographicAxes
object.
geoplot(1:10,1:10) gx = gca; co = gx.LatitudeAxis.Color; gx.LatitudeAxis.Color = "blue";
Appearance
Limits
— Minimum and maximum axis limits
two-element vector of the form [min max]
This property is read-only.
Minimum and maximum axis limits, returned as a two-element vector of the form
[min max]
.
To set the limits of a GeographicAxes
object, use the geolimits
function.
Note
The values of the Limits
properties for the latitude and
longitude axes match the values of the LatitudeLimits
and
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 name
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 string scalar or character vector that starts with a hash symbol (
#
) followed by three or six hexadecimal digits, which can range from0
toF
. The values are not case sensitive. Therefore, 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 axes sets the
Color
properties for the ruler objects to the same value.
However, setting properties of the rulers does not affect the parent axes. To
prevent the axes property value from overriding the ruler property values, set the
axes value first, and then set the ruler values.
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 marks
0.5
(default) | positive value
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 axes sets the
LineWidth
properties for the ruler objects to the same value.
However, setting properties of the rulers does not affect the parent axes. To
prevent the axes property value from overriding the ruler property values, set the
axes value first, and then set the ruler values.
Example: gx.LatitudeAxis.LineWidth = 2;
Label
— Axis label
Text
object
Axis label, specified as a Text
object.
To change existing text, set the String
property of the
Text
object. Use other properties to change the text appearance, such
as the font size or color.
This code shows how to change the text 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;
For a full list of options, see Text Properties.
Note
The text object is not a child of the ruler object, so it cannot be returned by
findobj
and it does not use default text property values.The text object stored in this property is the same as the text object stored in the parent object's label property. Thus, you can modify the text object using either the ruler or the parent object's property. For example, setting the font size on a text object stored in a latitude axis ruler's
Label
property is the same as setting the font size on the text object stored in theLatitudeLabel
property of the parent axes.
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 value
Axis 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";
Tick Values and Labels
TickValues
— Tick mark locations along the axis
vector of increasing values
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;
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 theTickValues
property.
TickLabels
— Tick mark labels
cell array of character vectors | string array
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];
Example: gx.LatitudeAxis.TickLabels = {'Antarctic Circle','Tropic of
Capricorn','Equator','Tropic of Cancer','Arctic 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 theTickLabels
property.
TickLabelColor
— Tick label color
[0.15 0.15 0.15]
(default) | RGB triplet | hexadecimal color code | 'r'
| 'g'
| 'b'
| ...
Tick label color, specified as an RGB triplet, a hexadecimal color code, a color name, or a short 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 string scalar or character vector that starts with a hash symbol (
#
) followed by three or six hexadecimal digits, which can range from0
toF
. The values are not case sensitive. Therefore, 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 ruler’s Color
property also sets the
TickLabelColor
property to the same value. However, setting
the TickLabelColor
property does not change the
Color
property. To prevent the Color
property value from overriding the TickLabelColor
property
value, set the Color
property first, and then set the
TickLabelColor
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" (default) | Degrees, minutes, and decimal seconds plus compass direction | 110°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" |
You can also specify the tick label format using the geotickformat
function.
Note
Setting the TickLabelFormat
property for the parent axes
sets the TickLabelFormat
properties for the ruler objects to
the same value. However, setting properties of the rulers does not affect the parent
axes. To prevent the axes property value from overriding the ruler property values,
set the axes value first, and then set the ruler values.
Example: gx.LatitudeAxis.TickLabelFormat = "dd";
TickLabelRotation
— Rotation of tick labels
scalar value in degrees
Rotation of the tick labels, specified as a scalar value in degrees. Positive values give counterclockwise rotation. Negative values give clockwise rotation.
If you assign a value to this property, then MATLAB sets the TickLabelRotation
property to
'manual'
.
Example: gx.LatitudeAxis.TickLabelRotation = -45;
Example: gx.LongitudeAxis.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 theTickLabelRotation
property.
TickDirection
— Tick mark direction
'in'
(default) | 'out'
| 'both'
| 'none'
Tick mark direction, specified as one of these values:
'in'
— Direct the tick marks inward from the axis lines. This is the default for 2-D views.'out'
— Direct the tick marks outward from the axis lines. This is the default for 3-D views.'both'
— Center the tick marks over the axis lines.'none'
— Do not display any tick marks.
If you assign a value to this property, then MATLAB sets
the TickDirectionMode
property to 'manual'
.
Note
Setting the TickDir
property for the parent
axes sets the TickDirection
property for the ruler
to the same value. However, 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.
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 theTickDirection
property.
TickLength
— Tick mark length
two-element vector
Tick mark length, specified as a two-element vector of the form [length
unused]
. The first element is the tick mark length. The second element is
unused by the geographic ruler, but is included for consistency with other ruler
objects. Specify the values in units normalized relative to the longest axes
dimension.
Note
Setting the TickLength
property for the parent axes sets
the TickLength
properties for the ruler objects to the same
value. However, setting properties of the rulers does not affect the parent axes. To
prevent the axes property value from overriding the ruler property values, set the
axes value first, and then set the ruler values.
Example: gx.LatitudeAxis.TickLength = [0.04 0];
Font
FontName
— Font name
system supported 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
properties for the ruler objects to the same value.
However, setting properties of the rulers does not affect the parent axes. To
prevent the axes property value from overriding the ruler property values, set the
axes value first, and then set the ruler values.
Example: gx.LatitudeAxis.FontName = "Cambria";
FontSize
— Font size
scalar numeric value
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 theFontSize
properties for the rulers to the same value. However, 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 values.Setting the
FontSize
property on the ruler changes the size of the tick labels. MATLAB also updates the font size of the corresponding axes label using theLabelFontSizeMultiplier
of the parent axes. For example, setting the font size of a latitude axis ruler to 12 sets the font size for theLatitudeLabel
property of the parent axes to 12 times the value of theLabelFontSizeMultiplier
property.
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
properties for the ruler objects to the same
value. However, setting properties of the rulers does not affect the parent axes. To
prevent the axes property value from overriding the ruler property values, set the
axes value first, and then set the ruler values.
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
properties for the ruler objects to the same value.
However, setting properties of the rulers does not affect the parent axes. To
prevent the axes property value from overriding the ruler property values, set the
axes value first, and then set the ruler values.
Example: gx.LatitudeAxis.FontAngle = "italic";
FontSmoothing
— Character smoothing
'on'
(default) | on/off logical value
Character 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";
Note
The FontSmoothing
property will have no effect in a future
release. Font smoothing will be enabled regardless of the value of the
property.
Callbacks
LimitsChangedFcn
— Axis limits changed callback
''
(default) | function handle | cell array | character vector
Axis limits changed callback, specified as one of these values:
A function handle.
A cell array in which the first element is a function handle. Subsequent elements in the cell array are the arguments to pass to the callback function.
A character vector containing a valid MATLAB expression (not recommended). MATLAB evaluates this expression in the base workspace.
This callback executes after the axis limits have changed, either programmatically or using an interaction such as panning within the axes. It can also execute if MATLAB changes the axis limits to encompass the range of your data when you call a plotting function.
This callback function can access specific information about the axis limits. MATLAB passes this information in a LimitsChanged
object as the second argument to your callback function. If
you are developing an app in App Designer, the argument is called
event
. You can query the object properties using dot notation.
For example, event.NewLimits
returns the new axis limits. The
LimitsChanged
object is not available to callback
functions specified as character vectors.
The following table lists the properties of the LimitsChanged
object.
Property | Description |
---|---|
Source | Ruler object that executes the callback |
EventName |
|
OldLimits | Two-element vector containing the previous axis limits |
NewLimits | Two-element vector containing the new axis limits |
For more information about writing callbacks in apps, see Callbacks in App Designer.
Parent/Child
Parent
— Ruler parent
GeographicAxes
object
Ruler parent, specified as a GeographicAxes
object.
Note
Ruler objects are not listed in the Children
property of the
parent GeographicAxes
object.
Children
— Ruler children
empty GraphicsPlaceholder
array
The ruler has no children. You cannot set this property.
Version History
Introduced in R2019aR2022a: The FontSmoothing
property will have no effect in a future release
The FontSmoothing
property will have no effect in a future release. Font
smoothing will be enabled regardless of the value of the property.
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)