GeographicAxes - Geographic axes appearance and behavior - MATLAB (original) (raw)

GeographicAxes Properties

Geographic axes appearance and behavior

GeographicAxes properties control the appearance and behavior of a GeographicAxes object. By changing property values, you can modify certain aspects of the geographic axes. Set axes properties after plotting since some graphics functions reset axes properties.

Some graphics functions create geographic axes when plotting. Usegca to access the newly created axes. To create a geographic axes with default values for all properties, use the geoaxes function.

Maps

expand all

Map on which to plot data, specified as one of the values listed in the table. Six of the basemaps are tiled data sets created using Natural Earth. Five of the basemaps are high-zoom-level maps hosted by Esri®.

'streets-light' basemap 'streets-light' (default)Map designed to provide geographic context while highlighting user data on a light background.Hosted by Esri. 'streets-dark' basemap 'streets-dark'Map designed to provide geographic context while highlighting user data on a dark background.Hosted by Esri.
'streets' basemap 'streets'General-purpose road map that emphasizes accurate, legible styling of roads and transit networks.Hosted by Esri. 'satellite' basemap 'satellite'Full global basemap composed of high-resolution satellite imagery.Hosted by Esri.
'topographic' basemap 'topographic'General-purpose map with styling to depict topographic features.Hosted by Esri. 'landcover' basemap 'landcover'Map that combines satellite-derived land cover data, shaded relief, and ocean-bottom relief. The light, natural palette is suitable for thematic and reference maps.Created using Natural Earth.
'colorterrain' basemap 'colorterrain'Shaded relief map blended with a land cover palette. Humid lowlands are green and arid lowlands are brown.Created using Natural Earth. 'grayterrain' basemap 'grayterrain'Terrain map in shades of gray. Shaded relief emphasizes both high mountains and micro-terrain found in lowlands. Created usingNatural Earth.
'bluegreen' basemap 'bluegreen'Two-tone, land-ocean map with light green land areas and light blue water areas.Created using Natural Earth. 'grayland' basemap 'grayland'Two-tone, land-ocean map with gray land areas and white water areas.Created using Natural Earth.
'darkwater' basemap 'darkwater'Two-tone, land-ocean map with light gray land areas and dark gray water areas. This basemap is installed with MATLAB®.Created using Natural Earth. 'none'Blank background that plots your data with a latitude-longitude grid, ticks, and labels.

All basemaps except 'darkwater' require Internet access. The'darkwater' basemap is included with MATLAB.

If you do not have consistent access to the Internet, you can download the basemaps created using Natural Earth onto your local system by using the Add-On Explorer. The five high-zoom-level maps are not available for download. For more about downloading basemaps and changing the default basemap on your local system, see Access Basemaps for Geographic Axes and Charts.

The basemaps hosted by Esri update periodically. As a result, you might see differences in your visualizations over time.

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

Data Types: char | string

This property is read-only.

Latitude limits of the map, returned as a two-element vector of the form[latmin latmax]. Each element is in the range [–90, 90] degrees.

Change the latitude limits by using the geolimits function.

The latitude limits do not change when you resize the axes by resizing the figure window, except to adapt to changes in the aspect ratio of the map.

Example: [-85 85]

This property is read-only.

Longitude limits of map, returned as a two-element vector of the form[lonmin lonmax].

Change the longitude limits by using the geolimits function.

The longitude limits do not change when you resize the axes by resizing the figure window, except to adapt to changes in the aspect ratio of the map.

Example: [-100 100]

Center point of map in latitude and longitude, specified as a two-element vector of real, finite values of the form [center_latitude center_longitude].

Example: [38.6292 -95.2520]

Selection mode for the map center, specified as one of these values:

Example: gx.MapCenterMode = 'auto'

Magnification level of map, specified as a real, finite, numeric scalar from 0 through 25, inclusive. The value is a base 2 logarithmic map scale. Increasing the ZoomLevel value by one doubles the map scale.

Selection mode for zoom level, specified as one of these values:

Example: gx.ZoomLevelMode = 'manual'

This property is read-only.

Scale bar, returned as a GeographicScalebar object. The scale bar shows proportional distances on the map.

Change the appearance and behavior of the scale bar by setting properties of the GeographicScalebar object. For example, this code shows how to hide the scale bar.

geoplot(1:10,1:10) gx = gca; gx.Scalebar.Visible = "off";

For more information about the properties ofGeographicScalebar objects, see GeographicScalebar Properties.

Font

expand all

Font size, specified as a numeric scalar. The font size affects the title, tick labels, and scale bar, as well as any legends or color bars associated with the axes. The default font size depends on the specific operating system and locale. By default, the axes object measures the font size in points. To change the units, set theFontUnits property.

MATLAB automatically scales some of the text to a percentage of the axes font size.

Selection mode for the font size, specified as one of these values:

Scale factor for the label font size, specified as a numeric value greater than 0. The scale factor is applied to the value of theFontSize property to determine the font size for the label.

Example: gx.LabelFontSizeMultiplier = 1.75

Scale factor for the title font size, specified as a numeric value greater than 0. The scale factor is applied to the value of the FontSize property to determine the font size for the title.

Subtitle character thickness, specified as one of these values:

Ticks

expand all

Tick mark direction, specified as one of these values:

Selection mode for tick mark direction set by theTickDir property, specified as one of these values.

Example: gx.TickDirMode = 'auto';

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

Note

Setting the TickLength property automatically sets the TickLength property in theGeographicRuler objects associated with theLatitudeAxis and LongitudeAxis properties to the same value. Conversely, setting theTickLength property in theGeographicRuler objects does not automatically set the same property in the axes object. To prevent the axes property value from overriding the ruler property value, set the axes property value first, and then set the ruler property value.

Example: gx.TickLength = [0.02 0.0];

Tick label format, specified as one of these options:

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"

The default tick label format includes degrees, minutes, and seconds. However, the axes displays minutes and seconds only when the ZoomLevel property is greater than or equal to14.

Rulers

expand all

Latitude ruler, specified as a GeographicRuler object. Use properties of the GeographicRuler object to control the appearance and behavior of the axis ruler. For more information, seeGeographicRuler Properties.

This image shows the latitude axis line in red.

Example: latruler = gx.LatitudeAxis;

Example: gx.LatitudeAxis.TickLabelRotation = 45;

Longitude ruler, specified as a GeographicRuler object. Use properties of the GeographicRuler object to control the appearance and behavior of the axis ruler. For more information, seeGeographicRuler Properties.

This image shows the longitude axis line in red.

Example: lonruler = gx.LongitudeAxis;

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

Color of axis lines, tick values, and labels, specified as an RGB triplet, hexadecimal color code, color name, or short color name.

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

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

Color Name Short Name RGB Triplet Hexadecimal Color Code Appearance
"red" "r" [1 0 0] "#FF0000" Sample of the color red
"green" "g" [0 1 0] "#00FF00" Sample of the color green
"blue" "b" [0 0 1] "#0000FF" Sample of the color blue
"cyan" "c" [0 1 1] "#00FFFF" Sample of the color cyan
"magenta" "m" [1 0 1] "#FF00FF" Sample of the color magenta
"yellow" "y" [1 1 0] "#FFFF00" Sample of the color yellow
"black" "k" [0 0 0] "#000000" Sample of the color black
"white" "w" [1 1 1] "#FFFFFF" Sample of the color white
"none" Not applicable Not applicable Not applicable No color

This table lists the default color palettes for plots in the light and dark themes.

Palette Palette Colors
"gem" — Light theme default_Before R2025a: Most plots use these colors by default._ Sample of the "gem" color palette
"glow" — Dark theme default Sample of the "glow" color palette

You can get the RGB triplets and hexadecimal color codes for these palettes using the orderedcolors and rgb2hex functions. For example, get the RGB triplets for the "gem" palette and convert them to hexadecimal color codes.

RGB = orderedcolors("gem"); H = rgb2hex(RGB);

Before R2023b: Get the RGB triplets using RGB = get(groot,"FactoryAxesColorOrder").

Before R2024a: Get the hexadecimal color codes using H = compose("#%02X%02X%02X",round(RGB*255)).

Note

Setting the AxisColor property automatically sets the Color property in theGeographicRuler andGeographicScalebar objects to the same value. TheGeographicRuler object controls the behavior and appearance of the rulers in the geographic axes. TheGeographicScalebar object controls the scale bar in the geographic axes. Conversely, setting the Color property in the GeographicRuler orGeographicScalebar object does not automatically set the AxisColor property in the axes object. To prevent the axes property value from overriding the ruler or scale bar property value, set the axes property value first, and then set the ruler or scale bar property value.

Example: gx.AxisColor = [0 0 1];

Example: gx.AxisColor = 'b';

Example: gx.AxisColor = 'blue';

Example: gx.AxisColor = '#0000FF';

Grids

expand all

Visibility of the grid lines, 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.

Example: gx.Grid = 'off';

Line style for grid lines, specified as one of the line styles in this table.

Line Style Description Resulting Line
'-' Solid line Sample of solid line
'--' Dashed line Sample of dashed line
':' Dotted line Sample of dotted line
'-.' Dash-dotted line Sample of dash-dotted line, with alternating dashes and dots
'none' No line No line

To display the grid lines, use the grid on command or set the Grid property to'on'.

Example: gx.GridLineStyle = '--'

Color of grid lines, 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.

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

Color Name Short Name RGB Triplet Hexadecimal Color Code Appearance
"red" "r" [1 0 0] "#FF0000" Sample of the color red
"green" "g" [0 1 0] "#00FF00" Sample of the color green
"blue" "b" [0 0 1] "#0000FF" Sample of the color blue
"cyan" "c" [0 1 1] "#00FFFF" Sample of the color cyan
"magenta" "m" [1 0 1] "#FF00FF" Sample of the color magenta
"yellow" "y" [1 1 0] "#FFFF00" Sample of the color yellow
"black" "k" [0 0 0] "#000000" Sample of the color black
"white" "w" [1 1 1] "#FFFFFF" Sample of the color white
"none" Not applicable Not applicable Not applicable No color

This table lists the default color palettes for plots in the light and dark themes.

Palette Palette Colors
"gem" — Light theme default_Before R2025a: Most plots use these colors by default._ Sample of the "gem" color palette
"glow" — Dark theme default Sample of the "glow" color palette

You can get the RGB triplets and hexadecimal color codes for these palettes using the orderedcolors and rgb2hex functions. For example, get the RGB triplets for the "gem" palette and convert them to hexadecimal color codes.

RGB = orderedcolors("gem"); H = rgb2hex(RGB);

Before R2023b: Get the RGB triplets using RGB = get(groot,"FactoryAxesColorOrder").

Before R2024a: Get the hexadecimal color codes using H = compose("#%02X%02X%02X",round(RGB*255)).

For example, create a geographic axis object with red grid lines. Set theGridAlpha property to 0.5 to increase visibility.

gx = geoaxes; gx.GridColor = 'r'; gx.GridAlpha = 0.5;

Geographic axes with red grid lines

Example: gx.GridColor = [0 0 1];

Example: gx.GridColor = 'b';

Example: gx.GridColor = 'blue';

Example: gx.GridColor = '#0000FF';

Property for setting the grid color, specified as one of these values:

Grid-line transparency, specified as a value in the range[0,1]. A value of 1 means opaque and a value of 0 means completely transparent.

Example: gx.GridAlpha = 0.5

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

Example: gx.GridAlphaMode = 'auto'

Labels

expand all

Text object for the axes title. To add a title, set the String property of the text object. To change the title appearance, such as the font style or color, set other properties. For a complete list, see Text Properties.

ax = gca; ax.Title.String = 'My Title'; ax.Title.FontWeight = 'normal';

Alternatively, use the title function to add a title and control the appearance.

title('My Title','FontWeight','normal')

Note

This text object is not contained in the axes Children property, cannot be returned by findobj, and does not use default values defined for text objects.

Text object for the axes subtitle. To add a subtitle, set the String property of the text object. To change its appearance, such as the font angle, set other properties. For a complete list, see Text Properties.

ax = gca; ax.Subtitle.String = 'An Insightful Subtitle'; ax.Subtitle.FontAngle = 'italic';

Alternatively, use the subtitle function to add a subtitle and control the appearance.

subtitle('An Insightful Subtitle','FontAngle','italic')

Or use the title function, and specify two character vector input arguments and two output arguments. Then set properties on the second text object returned by the function.

[t,s] = title('Clever Title','An Insightful Subtitle'); s.FontAngle = 'italic';

Note

This text object is not contained in the axes Children property, cannot be returned by findobj, and does not use default values defined for text objects.

Title and subtitle horizontal alignment with the plot box, specified as one of the values from the table.

TitleHorizontalAlignment Value Description Appearance
'center' The title and subtitle are centered over the plot box. Title and subtitle centered over the plot box.
'left' The title and subtitle are aligned with the left side of the plot box. Title and subtitle aligned with left edge of the plot box.
'right' The title and subtitle are aligned with the right side of the plot box. Title and subtitle aligned with right edge of the plot box.

Latitude axis label, specified as a Text object. To specify a label, set the String property of theText object. To change the label appearance, such as the font style or color, set other Text object properties. For a complete list of properties, see Text Properties.

Example: gx.LatitudeLabel.String = 'My Latitude'

Longitude axis label, specified as a Text object. To specify a label, set the String property of the text object. To change the label appearance, such as the font style or color, set other Text object properties. For a complete list of properties, see Text Properties.

Example: gx.LongitudeLabel.String = 'My Longitude'

This property is read-only.

Legend associated with a geographic axes, specified as aLegend object. To add a legend to the geographic axes, use the legend function. Then, you can use this property to modify the legend. For a complete list of properties, see Legend Properties.

geoplot(rand(3)) legend({'Line 1','Line 2','Line 3'},'FontSize',12) gx = gca; gx.Legend.TextColor = 'red';

You also can use this property to determine if the geographic axes has a legend.

gx = gca; lgd = gx.Legend if ~isempty(lgd) disp('Legend Exists') end

Multiple Plots

expand all

Since R2023a

How to cycle through the line styles when there are multiple lines in the axes, specified as one of the values from this table.

The examples in this table were created using the default colors in theColorOrder property and three line styles (["-","-o","--"]) in the LineStyleOrder property.

Value Description Example
"aftercolor" Cycle through the line styles of the LineStyleOrder after the colors of the ColorOrder. Six lines that use the "aftercolor" line style cycling method. Each line is a different color with the same line style.
"beforecolor" Cycle through the line styles of theLineStyleOrder before the colors of theColorOrder. Six lines that use the "beforecolor" line style cycling method. The first three lines use all three line styles with the first color. The last three lines repeat the line styles with the second color.
"withcolor" Cycle through the line styles of theLineStyleOrder with the colors of theColorOrder. Six lines that use the "withcolor" line style cycling method. The first three lines use all three line styles with the first three colors. The last three lines repeat the line styles with the next three colors.

This property is read-only.

SeriesIndex value for the next plot object added to the axes, returned as a whole number greater than or equal to 0. This property is useful when you want to track how the objects cycle through the colors and line styles. This property maintains a count of the objects in the axes that have a numericSeriesIndex property value. MATLAB uses it to assign a SeriesIndex value to each new object. The count starts at 1 when you create the axes, and it increases by 1 for each additional object. Thus, the count is typically n+1, where n is the number of objects in the axes.

If you manually change the ColorOrderIndex orLineStyleOrderIndex property on the axes, the value of theNextSeriesIndex property changes to 0. As a consequence, objects that have a SeriesIndex property no longer update automatically when you change the ColorOrder orLineStyleOrder properties on the axes.

Properties to reset when adding a new plot to the axes, specified as one of these values:

Figures also have a NextPlot property. Alternatively, you can use the newplot function to prepare figures and axes for subsequent graphics commands.

Color and Transparency Maps

expand all

Color map, specified as an m-by-3 array of RGB (red, green, blue) triplets that define m individual colors.

Example: ax.Colormap = [1 0 1; 0 0 1; 1 1 0] sets the color map to three colors: magenta, blue, and yellow.

MATLAB accesses these colors by their row number.

Alternatively, use the colormap function to change the color map.

Scale for color mapping, specified as one of these values:

Color limits for the colormap, specified as a two-element vector of the form [cmin cmax].

If the associated mode property is set to 'auto', then MATLAB chooses the color limits. If you assign a value to this property, then MATLAB sets the mode to 'manual' and does not automatically choose the color limits.

Transparency map, specified as an array of finite alpha values that progress linearly from0 to 1. The size of the array can be_m_-by-1 or 1-by-m. MATLAB accesses alpha values by their index in the array. An alphamap can be any length.

Scale for transparency mapping, specified as one of these values:

Alpha limits for alphamap, specified as a two-element vector of the form[amin amax].

If the associated mode property is set to 'auto', then MATLAB chooses the alpha limits. If you set this property, then MATLAB sets the mode to 'manual' and does not automatically choose the alpha limits.

Box Styling

expand all

Background color, specified as an RGB triplet, a hexadecimal color code, a color name, or a color short name. The background color is only visible when the Basemap property is set to'none'.

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

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

Color Name Short Name RGB Triplet Hexadecimal Color Code Appearance
"red" "r" [1 0 0] "#FF0000" Sample of the color red
"green" "g" [0 1 0] "#00FF00" Sample of the color green
"blue" "b" [0 0 1] "#0000FF" Sample of the color blue
"cyan" "c" [0 1 1] "#00FFFF" Sample of the color cyan
"magenta" "m" [1 0 1] "#FF00FF" Sample of the color magenta
"yellow" "y" [1 1 0] "#FFFF00" Sample of the color yellow
"black" "k" [0 0 0] "#000000" Sample of the color black
"white" "w" [1 1 1] "#FFFFFF" Sample of the color white
"none" Not applicable Not applicable Not applicable No color

This table lists the default color palettes for plots in the light and dark themes.

Palette Palette Colors
"gem" — Light theme default_Before R2025a: Most plots use these colors by default._ Sample of the "gem" color palette
"glow" — Dark theme default Sample of the "glow" color palette

You can get the RGB triplets and hexadecimal color codes for these palettes using the orderedcolors and rgb2hex functions. For example, get the RGB triplets for the "gem" palette and convert them to hexadecimal color codes.

RGB = orderedcolors("gem"); H = rgb2hex(RGB);

Before R2023b: Get the RGB triplets using RGB = get(groot,"FactoryAxesColorOrder").

Before R2024a: Get the hexadecimal color codes using H = compose("#%02X%02X%02X",round(RGB*255)).

Example: gx.Color = [0 0 1];

Example: gx.Color = 'b';

Example: gx.Color = 'blue';

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

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

Example: gx.LineWidth = 1.5

Outline around the geographic axes, 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.

This image shows a geographic axes object with theBox property set to 'off'. Note there is no outline along the top or right border of the axes.

Example: gx.Box = 'off'

Position

expand all

Size and location, including the labels and a margin, specified as a four-element vector of the form [left bottom width height]. By default, MATLAB measures the values in units normalized to the container. To change the units, set the Units property. The default value of [0 0 1 1] includes the whole interior of the container.

This figure shows the areas defined by the OuterPosition values (blue) and the Position values (red).

Geographic axes with a title. The inner position is outlined in red. The outer position is outlined in blue.

Note

Setting this property has no effect when the parent container is aTiledChartLayout object.

Inner size and location, specified as a four-element vector of the form[left bottom width height]. This property is equivalent to the Position property.

Note

Setting this property has no effect when the parent container is aTiledChartLayout object.

Size and location, excluding a margin for the labels, specified as a four-element vector of the form [left bottom width height]. By default, MATLAB measures the values in units normalized to the container. To change the units, set the Units property.

If you want to specify the position and account for the text around the axes, then set the OuterPosition property instead. This figure shows the areas defined by the OuterPosition values (blue) and thePosition values (red).

Geographic axes with a title. The inner position is outlined in red. The outer position is outlined in blue.

Note

Setting this property has no effect when the parent container is aTiledChartLayout object.

This property is read-only.

Margins for the text labels, returned as a four-element vector of the form[left bottom right top]. This property is read-only.

The elements define the distances between the bounds of thePosition property and the extent of the geographic axes text labels and title. By default, the values are measured in units normalized to the figure or uipanel that contains the geographic axes. To change the units, set the Units property.

The Position property and theTightInset property define the tightest bounding box that encloses the geographic axes and its labels and title.

Position property to hold constant when adding, removing, or changing decorations, specified as one of the following values:

Note

Setting this property has no effect when the parent container is aTiledChartLayout object.

Position units, specified as one of these values.

Units Description
"normalized" (default) Normalized with respect to the container, which is typically the figure or a panel. The lower-left corner of the container maps to(0,0) and the upper-right corner maps to(1,1).
"inches" Inches.
"centimeters" Centimeters.
"characters" Based on the default UIControl font of the graphics root object: Character width = width of letterx.Character height = distance between the baselines of two lines of text.
"points" Typography points. One point equals 1/72 of an inch.
"pixels" Pixels.On Windows and Macintosh systems, the size of a pixel is 1/96th of an inch. This size is independent of your system resolution.On Linux systems, the size of a pixel is determined by your system resolution.

When specifying the units using a name-value argument during object creation, you must set the Units property before specifying the properties that you want to use these units, such as Position.

Layout options, specified as a TiledChartLayoutOptions or aGridLayoutOptions object. This property is useful when the axes object is either in a tiled chart layout or a grid layout.

To position the axes within the grid of a tiled chart layout, set theTile and TileSpan properties on theTiledChartLayoutOptions object. For example, consider a 3-by-3 tiled chart layout. The layout has a grid of tiles in the center, and four tiles along the outer edges. In practice, the grid is invisible and the outer tiles do not take up space until you populate them with axes or charts.

Diagram of a 3-by-3 tiled chart layout.

This code places the axes ax in the third tile of the grid.

To make the axes span multiple tiles, specify the TileSpan property as a two-element vector. For example, this axes spans 2 rows and 3 columns of tiles.

ax.Layout.TileSpan = [2 3];

To place the axes in one of the surrounding tiles, specify theTile property as 'north','south', 'east', or 'west'. For example, setting the value to 'east' places the axes in the tile to the right of the grid.

To place the axes into a layout within an app, specify this property as aGridLayoutOptions object. For more information about working with grid layouts in apps, see uigridlayout.

If the axes is not a child of either a tiled chart layout or a grid layout (for example, if it is a child of a figure or panel) then this property is empty and has no effect.

Interactivity

expand all

Since R2024a

Options to customize interaction behavior, specified as aGeographicAxesInteractionOptions object. Use the properties of the GeographicAxesInteractionOptions object to customize the behavior of interactions with the geographic axes. For a complete list of properties, see GeographicAxesInteractionOptions Properties.

The options set by the GeographicAxesInteractionOptions object apply to these interactions on the associated geographic axes:

Example: gx.InteractionOptions.ZoomSupported = "off" disables the zoom interaction.

Data exploration toolbar, specified as an AxesToolbar object. The toolbar appears at the top-right corner of the geographic axes when you hover over it. The toolbar provides quick access to data exploration tools, such as zooming, restore view, and data tips.

If you do not want the toolbar to appear when you hover over the geographic axes, set the Visible property of theAxesToolbar object to 'off'. For more information about the properties of an AxesToolbar object, see AxesToolbar Properties.

Example: gx.Toolbar.Visible = 'off'

Interactions, specified as an array of PanInteraction, ZoomInteraction, or DataTipInteraction objects or as an empty array. The interactions you specify are available within your chart through gestures. You do not have to select any axes toolbar buttons to use them. For example, a PanInteraction object enables dragging to pan within a chart. For a list of interaction objects, see Control Chart Interactivity.

By default, charts within geographic axes have pan, zoom, and data tip interactions. You can replace the default set with a new set of interactions, but you cannot access or modify any of the interactions in the default set. For example, this code replaces the default set of interactions with the PanInteraction andZoomInteraction objects.

gx = gca; gx.Interactions = [panInteraction zoomInteraction];

To disable the current set of interactions, call the disableDefaultInteractivity function. You can reenable them by calling the enableDefaultInteractivity function. To remove all mouse interactions from the axes, set this property to an empty array.

State of 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.

Note

When the Visible property is 'off', the axes object is invisible, but child objects such as lines remain visible.

This property is read-only.

Location of mouse pointer, specified as a 2-by-3 array of the form:

The CurrentPoint property contains the latitude (lat) and longitude (lon) coordinates of the mouse pointer with respect to the geographic axes. The(lat,lon) points indicate the location of the last mouse click. However, if the figure has aWindowButtonMotionFcn callback defined, then the(lat,lon) points indicate the last location of the mouse pointer.

The format of the return value is consistent with the return value of theCurrentPoint property of the Axes object. For geographic axes, the third column of the return value is always zero. The latitude and longitude values in the second row are duplicates of the values in the first row.

Example: [52.1411 -125.1167 0; 52.1411 -125.1167 0]

Callbacks

Callback Execution Control

expand all

This property is read-only.

Parent/Child

expand all

Parent container, specified as a Figure,Panel, Tab,TiledChartLayout, or GridLayout object.

Identifiers

expand all

This property is read-only.

Type of graphics object, returned as 'geoaxes'.

Object identifier, specified as a character vector or string scalar. You can specify a unique Tag value to serve as an identifier for an object. When you need access to the object elsewhere in your code, you can use the findobj function to search for the object based on the Tag value.

Version History

Introduced in R2018b

expand all

The default ColorOrder and AxisColor property values in the light theme have changed slightly. This table lists the changes.

Property R2024b Color R2025a Color
ColorOrder RGB TripletSample[0.0000 0.4470 0.7410] Sample of dark blue color (R2024b)[0.8500 0.3250 0.0980] Sample of dark orange color (R2024b)[0.9290 0.6940 0.1250] Sample of dark yellow color (R2024b)[0.4940 0.1840 0.5560] Sample of dark purple color (R2024b)[0.4660 0.6740 0.1880] Sample of medium green color (R2024b)[0.3010 0.7450 0.9330] Sample of light blue color (R2024b)[0.6350 0.0780 0.1840] Sample of dark red color (R2024b) RGB TripletSample[0.0660 0.4430 0.7450] Sample of dark blue color (R2025a)[0.8660 0.3290 0.0000] Sample of dark orange color (R2025a)[0.9290 0.6940 0.1250] Sample of dark yellow color (R2025a)[0.5210 0.0860 0.8190] Sample of dark purple color (R2025a)[0.2310 0.6660 0.1960] Sample of medium green color (R2025a)[0.1840 0.7450 0.9370] Sample of light blue color (R2025a)[0.8190 0.0150 0.5450] Sample of dark magenta color (R2025a)
AxisColor [0.15 0.15 0.15] [0.1294 0.1294 0.1294]

For geoaxes objects created in App Designer or in figures created using the uifigure function, you can customize the behavior of axes interactions. Customize the behavior of data tips, panning, and zooming, as well as how to restore views, by using theInteractionOptions property.

The "streets-light", "streets-dark", "streets", and "topographic" basemaps hosted by Esri have an improved visual appearance at high zoom levels. For example, this image compares a basemap at zoom level 21 in R2023a with the same basemap and zoom level in R2023b.

Comparison of basemaps in R2023a and R2023b. The basemap in R2023b shows crisper lines than the basemap in R2023a.

The basemaps can also have different appearances at other zoom levels. For example, this image compares a basemap at zoom level 15 in R2023a with the same basemap and zoom level in R2023b.

Comparison of basemaps in R2023a and R2023b. The basemap in R2023b shows fewer street names than the basemap in R2023a.

When the value of the NextPlot property is'replace', adding new plots does not reset theBasemap property. As a result, when you plot into geographic axes by using functions such as geoplot and geoscatter, MATLAB does not reset the basemap. In R2022a and earlier releases, the basemap resets when you add new plots.

As a result, you can specify a basemap and then visualize data without using thehold function between commands. For example, this code creates a map using the streets basemap. Then it displays a plot over the basemap. In R2022b, the basemap does not reset. In R2022a and earlier releases, the basemap resets to the default streets-light.

lat = [35 -22 51 39 37 42 47 -33]; lon = [139 -43 0 116 23 -71 -122 18];

figure geobasemap streets geoplot(lat,lon,"m*")

Two geographic plots. The first plot was created in R2022b, and it displays the specified streets basemap. The second plot was created in R2022a, and it displays the streets-light basemap.

This change does not affect existing code that sets the hold state to "on" between commands.

To reset the basemap when you add a new plot, use the cla reset syntax of the cla function before you create the plot. For example, to update the preceding code, use cla reset between the calls to geobasemap andgeoplot.

lat = [35 -22 51 39 37 42 47 -33]; lon = [139 -43 0 116 23 -71 -122 18];

figure geobasemap streets cla reset geoplot(lat,lon,"m*")

Alternatively, you can change the basemap to the defaultstreets-light by using the geobasemap function. For more information about changing the basemap of geographic axes, see Access Basemaps for Geographic Axes and Charts.

Setting or getting ActivePositionProperty is not recommended. Use thePositionConstraint property instead.

There are no plans to remove ActivePositionProperty, but the property is no longer listed when you call the set, get, orproperties functions on the axes.

To update your code, make these changes:

Starting in R2020a, using the UIContextMenu property to assign a context menu to a graphics object or UI component is not recommended. Use the ContextMenu property instead. The property values are the same.

There are no plans to remove support for the UIContextMenu property at this time. However, the UIContextMenu property no longer appears in the list returned by calling the get function on a graphics object or UI component.

If you change the axes ColorOrder orLineStyleOrder properties after plotting into the axes, the colors and line styles in your plot update immediately. In R2019a and previous releases, the new colors and line styles affect only subsequent plots, not the existing plots.

To preserve the original behavior, set the axes ColorOrderIndex orLineStyleOrderIndex property to any value (such as its current value) before changing the ColorOrder orLineStyleOrder property.

There is a new indexing scheme that enables you to change the colors and line styles of existing plots by setting the ColorOrder orLineStyleOrder properties. MATLAB applies this indexing scheme to all objects that have aColorMode, FaceColorMode,MarkerFaceColorMode, or CDataMode. As a result, your code might produce plots that cycle though the colors and line styles differently than in previous releases.

In R2019a and earlier releases, MATLAB uses a different indexing scheme which does not allow you to change the colors of existing plots.

To preserve the way your plots cycle through colors and line styles, set the axesColorOrderIndex or LineStyleOrderIndex property to any value (such as its current value) before plotting into the axes.