GeographicScalebar Properties

Control appearance and behavior of scale bar in geographic axes

GeographicScalebar properties control the appearance and behavior of the scale bar included in a GeographicAxes object.

Access the GeographicScalebar object through the Scalebar property of the GeographicAxes object. Use dot notation to refer to the GeographicScalebar properties.

% Create a Geographic Axes.
gx = geoaxes;

% Get the GeographicScalebar object.
sb = gx.Scalebar;

% Set a GeographicScalebar object property.
gx.Scalebar.Visible = 'off';

Appearance

expand all

Transparency of scale bar background, specified as a scalar between 0 and 1, inclusive. A value of 1 means the scale bar background is fully opaque and 0 means it is completely transparent (invisible).

Example: gx.Scalebar.BackgroundAlpha = 0.2;

Background color of scale bar, 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'

Example: gx.Scalebar.BackgroundColor = [0 0 1];

Example: gx.Scalebar.BackgroundColor = 'b';

Example: gx.Scalebar.BackgroundColor = 'none';

Example: gx.Scalebar.BackgroundColor = '#0000FF';

Color of lines in scale bar, 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 geographic axes sets the EdgeColor property for the scale bar to the same value. Conversely, setting the scale bar property does not set the AxisColor property. To prevent the axis property value from overriding the scale bar property value, set the axis value first, and then set the scale bar property value.

Example: gx.Scalebar.EdgeColor = 'b';

Example: gx.Scalebar.EdgeColor = 'blue';

Example: gx.Scalebar.EdgeColor = [0 0 1];

Example: gx.Scalebar.EdgeColor = '#0000FF';

Width of lines in scale bar, specified as a positive value in point units. One point equals 1/72 inch.

Example: gx.Scalebar.LineWidth = 2;

Note

Setting the LineWidth property for the parent geographic axes sets the LineWidth property for the scale bar to the same value. Conversely, setting the scale bar property does not set the axes property. To prevent the axes property value from overriding the scale bar property value, set the axes value first, and then set the scale bar property value.

Visibility of scale bar, specified as one of these values:

  • 'on' — Display the scale bar.

  • 'off' — Hide the scale bar without deleting it. You can still access properties of an invisible scale bar by using the GeographicScalebar object.

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

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 works well 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 geographic axes sets the FontName property for the scale bar to the same value. Conversely, setting the scale bar property does not set the axes property. To prevent the axes property value from overriding the scale bar property value, set the axes value first, and then set the scale bar property value.

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

Font size, specified as a scalar numeric value.

Note

Setting the FontSize property for the parent geographic axes sets the FontSize property for the scale bar object. Conversely, setting the scale bar property does not set the parent axes property. To prevent the axes property value from overriding the scale bar property value, set the axes value first, and then set the scale bar property value.

When using the font size specified by the parent geographic axes, the scale bar scales the font size to 80% of the parent font size.

Example: gx.Scalebar.FontSize = 12;

Character thickness, specified as one of these values:

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

  • 'bold' — Thicker character outlines than default weight

MATLAB uses the FontWeight property to select a font from those 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 geographic axes sets the FontWeight property for the scale bar to the same value. Conversely, setting the scale bar property does not set the parent axes property. To prevent the axes property value from overriding the scale bar property value, set the axes value first, and then set the scale bar property value.

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

Font color, 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 geographic axes sets the FontColor property for the scale bar to the same value. Conversely, setting the scale bar property does not set the parent axes property. To prevent the parent axes property value from overriding the scale bar property value, set the axes value first, and then set the scale bar property value.

Example: gx.Scalebar.FontColor = 'b';

Example: gx.Scalebar.FontColor = 'blue';

Example: gx.Scalebar.FontColor = [0 0 1];

Example: gx.Scalebar.FontColor = '#0000FF';

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 geographic axes sets the FontAngle property for the scale bar to the same value. Conversely, setting the scale bar property does not set the parent axes property. To prevent the parent axes property value from overriding the scale bar property value, set the axes value first, and then set the scale bar property value.

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

Character smoothing, specified as one of these values:

  • 'on' — Enable text antialiasing, or character smoothing, 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 appears blurry.

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

Parent/Child

expand all

This property is read-only.

Scale bar parent, specified as a GeographicAxes object.

Note

Scale bar objects are not listed in the Children property of the parent GeographicAxes object.

This property is read-only.

Scale bar children, specified as an empty GraphicsPlaceholder array. The scale bar has no children.

Introduced in R2019a