MapAxes Properties
MapAxes properties control the appearance and behavior of a
        MapAxes object. By changing property values, you can modify certain aspects
      of the map axes. Use dot notation to query and set properties.
p = projcrs(26919); newmap(p) mx = gca; c = mx.OutlineColor; mx.OutlineColor = "blue";
Map
Projected coordinate reference system (CRS), specified as a projcrs
            object. MapAxes objects use the projection method and projection
            parameters stored in the projected CRS to transform geographic (latitude-longitude)
            coordinates to projected (xy) coordinates.
When you change the projected CRS, MATLAB® automatically updates the map axes to use the new projected CRS.
To change the projection parameters of the CRS, access the underlying ProjectionParameters property of the projcrs object.
p = projcrs(26919); newmap(p) mx = gca; mx.ProjectionParameters.LongitudeOfNaturalOrigin = -75;
For examples of how to customize the projection used by map axes, see Change Projection and Projection Parameters.
By default, map axes objects use the World Geodetic System of 1984 (WGS 84) / Equal
            Earth Greenwich projected CRS, which has the EPSG code 8857.
The projected CRS must have a forward and inverse projection implementation. Most projected CRSs have a forward and inverse projection implementation.
This property is read-only.
Scale bar, stored 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.
newmap
mx = gca;
mx.Scalebar.Visible = "off";For more information about the properties of GeographicScalebar
            objects, see GeographicScalebar Properties.
Font
Text color for the title, the tick labels, and the scale bar, 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 from- 0to- F. 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 the 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 | 
This table lists the default color palettes for plots in the light and dark themes.
| Palette | Palette Colors | 
|---|---|
| 
 Before R2025a: Most plots use these colors by default. | 
 | 
| 
 | 
 | 
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)).
To use a different text color for the title than for the tick labels and scale bar,
            set the Color property of the title, such as
              mx.Title.Color = "blue".
To use a different text color for the scale bar than for the title and tick labels,
            set the FontColor property of the scale bar, such as
              mx.Scalebar.FontColor = "blue".
Example: mx.FontColor = [0 0 1];
Example: mx.FontColor = "b";
Example: mx.FontColor = "blue";
Example: mx.FontColor = "#0000FF";
Font name, specified as a supported font name or "FixedWidth". To
            display and print text properly, you must choose a font that your system supports. The
            default font depends on your operating system and locale.
To use a fixed-width font that looks good in any locale, specify
              "FixedWidth". The fixed-width font relies on the root FixedWidthFontName
            property. Setting the root FixedWidthFontName property causes the
            display to immediately update to use the new font.
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 the
                FontUnits property. 
MATLAB automatically scales some of the text to a percentage of the axes font size.
- Titles — 110% of the axes font size by default. To control title scaling, use the - TitleFontSizeMultiplierand- LabelFontSizeMultiplierproperties.
- Legends and color bars — 90% of the axes font size by default. To specify a different font size, set the - FontSizeproperty for the- Legendor- ColorBarobject instead.
- Scale bar — 80% of the axes font size by default. To specify a different font size, set the - FontSizeproperty for the- GeographicScalebarobject instead.
Selection mode for the font size, specified as one of these values:
- 'auto'— Font size specified by MATLAB. If you resize the axes to be smaller than the default size, the font size might scale down to improve readability and layout.
- 'manual'— Font size specified manually. Do not scale the font size as the axes size changes. To specify the font size, set the- FontSizeproperty.
Character thickness, specified as "normal" or
              "bold".
MATLAB uses the FontWeight property to select a font from
            those available on your system. Not all fonts have a bold weight. Therefore, specifying
            a bold font weight can still result in the normal font weight.
Character slant, specified as "normal" or
              "italic".
Not all fonts have both font styles. Therefore, the italic font might look the same as the normal font.
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.
Title character thickness, specified as one of these values:
- 'normal'— Default weight as defined by the particular font
- 'bold'— Thicker characters than normal
Subtitle character thickness, specified as one of these values:
- 'normal'— Default weight as defined by the particular font
- 'bold'— Thicker characters than normal
Font size units, specified as one of these values.
| Units | Description | 
|---|---|
| 'points' | Points. One point equals 1/72 inch. | 
| 'inches' | Inches. | 
| 'centimeters' | Centimeters. | 
| 'normalized' | Interpret font size as a fraction of the axes height. If you
                                resize the axes, the font size modifies accordingly. For example, if
                                the FontSizeis0.1in
                                normalized units, then the text is 1/10 of the height value stored
                                in the axesPositionproperty. | 
| '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. | 
To set both the font size and the font units in a single function call, you first must set the
                FontUnits property so that the Axes object
            correctly interprets the specified font size.
Ticks
Tick mark direction, specified as one of these values:
- "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.
- "none"— Do not display any tick marks.
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" | 
Graticule
Color of the graticule lines, 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 from- 0to- F. 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 the 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 | 
This table lists the default color palettes for plots in the light and dark themes.
| Palette | Palette Colors | 
|---|---|
| 
 Before R2025a: Most plots use these colors by default. | 
 | 
| 
 | 
 | 
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)).
To set the outline color of the axes, use the OutlineColor
            property.
Line style for graticule lines, specified as one of the line styles in this table.
| Line Style | Description | Resulting Line | 
|---|---|---|
| "-" | Solid line | 
 | 
| "--" | Dashed line | 
 | 
| ":" | Dotted line | 
 | 
| "-." | Dash-dotted line | 
 | 
| "none" | No line | No line | 
Width of the graticule lines, specified as a positive scalar in point units. One point equals 1/72 of an inch.
When the GraticuleLineWidthMode property has a value of
              "auto", the value of GraticuleLineWidth
            matches the value of LineWidth.
Selection mode for the GraticuleLineWidth property, specified
            as one of these values:
- "auto"— Automatically select the width of graticule lines based on the value of the- LineWidthproperty.
- "manual"— Manually specify the width of graticule lines. To specify the value, set the- GraticuleLineWidthproperty.
Transparency of the graticule lines, specified as a value in the range [0, 1]. A
            value of 1 means opaque and a value of 0 means
            completely transparent.
Labels
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, specified as one of these values:
- "center"— Center the title and subtitle over the map axes.
- "left"— Align the title and subtitle with the left edge of an invisible box that circumscribes the map axes.
- "right"— Align the title and subtitle with the right edge of an invisible box that circumscribes the map axes.
This property is read-only.
Legend associated with the axes, stored as a Legend object. To add
            a legend to the axes, use the legend function. Then, you can use this
            property to modify the legend. For a complete list of properties, see Legend Properties.
newmap geoplot(1:10,1:10) hold on geoplot(5:14,1:10) legend(["Line 1" "Line 2"],FontSize=12) mx = gca; mx.Legend.TextColor = "red";
You also can use this property to determine if the axes has a legend.
newmap mx = gca; lgd = mx.Legend if ~isempty(lgd) disp("Legend Exists") end
Multiple Plots
Color order, specified as a three-column matrix of RGB triplets. This property
            defines the palette of colors MATLAB uses to create plot objects such as Lineand
              Scatter objects. Each row of the matrix is an RGB triplet. An RGB
            triplet is a three-element vector whose elements specify the intensities of the red,
            green, and blue components of a color. The intensities must be in the range [0, 1]. This
            table lists the default colors.
This table lists the default color palettes for plots in the light and dark themes.
| Palette | Palette Colors | 
|---|---|
| 
 Before R2025a: Most plots use these colors by default. | 
 | 
| 
 | 
 | 
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)).
MATLAB assigns colors to objects according to their order of creation. For example, when plotting lines, the first line uses the first color, the second line uses the second color, and so on. If there are more lines than colors, then the cycle repeats.
Changing the Color Order Before or After Plotting
You can change the color order in either of these ways:
- Call the - colororderfunction to change the color order for all the axes in a figure. The colors of existing plots in the figure update immediately. If you place additional axes into the figure, those axes also use the new color order. If you continue to call plotting commands, those commands also use the new colors.
- Set the - ColorOrderproperty on the axes, call the- holdfunction to set the axes hold state to- "on", and then call the desired plotting functions. Unlike the- colororderfunction, this process sets the color order for the specific axes rather than the entire figure. You must set the- holdstate to- "on"to ensure that subsequent plotting commands do not reset the axes to use the default color order.
Line style order, specified as a character vector, a cell array of character
            vectors, or a string array. This property lists the line styles that MATLAB uses to display multiple plot lines in the axes. MATLAB assigns styles to lines according to their order of creation. By default,
            it changes to the next line style only after cycling through all the colors in the
              ColorOrder
            property with the current line style. Set the LineStyleCyclingMethod property to "withcolor" to cycle
            through both together, or "beforecolor" to cycle through the line
            styles first. The default LineStyleOrder has only one line style,
              "-".
To customize the line style order, create a cell array of character vectors or a
            string array. Specify each element of the array as a line specifier or marker specifier
            from these tables. You can combine a line and a marker specifier into a single element,
            such as '-*'.
| Line Specifier | Description | 
|---|---|
| "-"(default) | Solid line | 
| "--" | Dashed line | 
| ":" | Dotted line | 
| "-." | Dash-dotted line | 
| Marker Specifier | Description | 
|---|---|
| "+" | Plus sign markers | 
| "o" | Circle markers | 
| "*" | Star markers | 
| "." | Point markers | 
| "x" | Cross markers | 
| "s" | Square markers | 
| "d" | Diamond markers | 
| "^" | Upward-pointing triangle markers | 
| "v" | Downward-pointing triangle markers | 
| ">" | Right-pointing triangle markers | 
| "<" | Left-pointing triangle markers | 
| "p" | Five-pointed star (pentagram) markers | 
| "h" | Six-pointed star (hexagram) markers | 
Changing Line Style Order Before or After Plotting
You can change the line style order before or after plotting into the axes. When
              you set the LineStyleOrder property to a new value, MATLAB updates the styles of any lines that are in the axes. If you continue
              plotting into the axes, your plotting commands continue using the line styles from the
              updated list.
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 the
                ColorOrder property and three line styles
                (["-","-o","--"]) in the LineStyleOrder
            property.
| Value | Description | Example | 
|---|---|---|
| 
 | Cycle through the line styles of the  | 
 
 
 | 
| "beforecolor" | Cycle through the line styles of the
                                         | 
 
 
 | 
| "withcolor" | Cycle through the line styles of the
                                         | 
 
 
 | 
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 numeric
                SeriesIndex 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 or
                LineStyleOrderIndex property on the axes, the value of the
                NextSeriesIndex property changes to 0. As a
            consequence, objects that have a SeriesIndex property no longer
            update automatically when you change the ColorOrder or
                LineStyleOrder properties on the axes.
Properties to reset when adding a new plot to the axes, specified as one of these values:
- "add"— Add new plots to the existing axes. Do not delete existing plots or reset axes properties before displaying the new plot.
- "replacechildren"— Delete existing plots before displaying the new plot. Reset the- ColorOrderIndexand- LineStyleOrderIndexproperties to- 1, but do not reset other axes properties. The next plot added to the axes uses the first color and line style based on the- ColorOrderand- LineStyleOrderproperties. This value is similar to using- clabefore every new plot.
- "replace"— Delete existing plots and reset axes properties, except- ProjectedCRS,- Position, and- Units, to their default values before displaying the new plot.
- "replaceall"— Delete existing plots and reset axes properties, except- Positionand- Units, to their default values before displaying the new plot. This value is similar to using- cla resetbefore every new plot.
Figures also have a NextPlot property.
            Alternatively, you can use the newmap
            function to prepare figures and axes for subsequent graphics commands.
Order for rendering objects, specified as one of these values:
- 'depth'— Draw objects in back-to-front order based on the current view. Use this value to ensure that objects in front of other objects are drawn correctly.
- 'childorder'— Draw objects in the order in which they are created by graphics functions, without considering the relationship of the objects in three dimensions. This value can result in faster rendering, particularly if the figure is very large, but also can result in improper depth sorting of the objects displayed.
Color order index, specified as a positive integer. This property specifies the next
            color MATLAB selects from the axes ColorOrder property when it creates
            the next plot object, such as a Line or Scatter
            object. For example, if the color order index value is 1, then the
            next object added to the axes uses the first color in the
              ColorOrder matrix. If the index value exceeds the number of
            colors in the ColorOrder matrix, then the index value modulo of the
            number of colors in the ColorOrder matrix determines the color of
            the next object.
When the NextPlot property of the axes is set to
              'add', then the color order index value increases every time you
            add a new plot to the axes. To start again with first color, set the
              ColorOrderIndex property to 1.
Line style order index, specified as a positive integer. This property specifies the
            next line style MATLAB selects from the axes LineStyleOrder
            property to create the next plot line. For example, if this property is set to
              1, then the next plot line you add to the axes uses the first item
            in the LineStyleOrder property. If the index value exceeds the
            number of line styles in the LineStyleOrder array, then the index
            value modulo of the number of elements in the LineStyleOrder array
            determines the style of the next line.
When the NextPlot property of the axes is set to
              "add", MATLAB increments the index value after cycling through all the colors in the
              ColorOrder property with the current
            line style. To start again with first line style, set the
              LineStyleOrderIndex property to 1.
Color and Transparency Maps
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:
- 'linear'— Linear scale. The tick values along the colorbar also use a linear scale.
- 'log'— Log scale. The tick values along the colorbar also use a log scale.
Color limits for objects in axes that use the colormap, specified as a two-element
            vector of the form [cmin cmax]. This property determines how data
            values map to the colors in the colormap where:
- cminspecifies the data value that maps to the first color in the colormap.
- cmaxspecifies the data value that maps to the last color in the colormap.
The axes object interpolates data values between cmin
            and cmax across the colormap. Values outside this range use either
            the first or last color, whichever is closest. 
Selection mode for the CLim property, specified
as one of these values:
- 'auto'— Automatically select the limits based on the color data of the graphics objects contained in the axes.
- 'manual'— Manually specify the values. To specify the values, set the- CLimproperty. The values do not change when the limits of the axes children change.
Transparency map, specified as an array of finite alpha values that progress linearly from
                0 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:
- 'linear'— Linear scale
- 'log'— Log scale
Alpha limits, specified as a two-element vector of the form [amin
              amax]. This property affects the AlphaData values of
            graphics objects, such as scatter and bubble chart objects. This property determines how
            the AlphaData values map to the figure alphamap, where:
- aminspecifies the data value that maps to the first alpha value in the figure alphamap.
- amaxspecifies the data value that maps to the last alpha value in the figure alphamap.
The MapAxes object interpolates data values between
              amin and amax across the figure alphamap. Values
            outside this range use either the first or last alphamap value, whichever is
            closest.
The Alphamap property of the figure
            contains the alphamap. For more information, see the alpha function.
Selection mode for the ALim property, specified
as one of these values:
- 'auto'— Automatically select the limits based on the- AlphaDatavalues of the graphics objects contained in the axes.
- 'manual'— Manually specify the alpha limits. To specify the alpha limits, set the- ALimproperty.
Map Styling
Background 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 from- 0to- F. 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 the 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 | 
This table lists the default color palettes for plots in the light and dark themes.
| Palette | Palette Colors | 
|---|---|
| 
 Before R2025a: Most plots use these colors by default. | 
 | 
| 
 | 
 | 
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: mx.Color = [0 0 1];
Example: mx.Color = "b";
Example: mx.Color = "blue";
Example: mx.Color = "#0000FF";
Color of the map outline, the ticks, and the edge of the scale bar, 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 from- 0to- F. 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 the 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 | 
This table lists the default color palettes for plots in the light and dark themes.
| Palette | Palette Colors | 
|---|---|
| 
 Before R2025a: Most plots use these colors by default. | 
 | 
| 
 | 
 | 
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)).
To use a different color for the edge of the scale bar than for the map outline and
            ticks, set the EdgeColor property of the scale bar, such as
              mx.Scalebar.EdgeColor = "blue".
Example: mx.OutlineColor = [0 0 1];
Example: mx.OutlineColor = "b";
Example: mx.OutlineColor = "blue";
Example: mx.OutlineColor = "#0000FF";
Line width of the axes outline, the tick marks, the graticule lines, and the edge of the scale bar, specified as a positive scalar in point units. One point equals 1/72 inch.
You can use a different line width for the graticule lines than for the axes outline
            and tick marks by setting the GraticuleLineWidth property. The
              LineWidth property controls the width of the graticule lines only
            when the value of the GraticuleLineWidthMode property is
              "auto".
To use a different line width for the edge of the scale bar than for the axes
            outline, the tick marks, and the graticule lines, set the LineWidth
            property of the scale bar, such as mx.Scalebar.LineWidth = 2.
Map layout, specified as one of these options:
- "normal"— Display data within the box specified by- Position. For many projected CRSs, this box includes the quadrangle defined by- CartographicLatitudeLimitsand- CartographicLongitudeLimitsand some areas surrounding the quadrangle. The axes does not display data where the projection has undefined numeric results or extreme map distortion.
- "cartographic"— Display only the data within the quadrangle defined by the- CartographicLatitudeLimitsand- CartographicLongitudeLimitsproperties.
The "normal" option is appropriate for most data visualization
            and exploration workflows. The "cartographic" option is useful when
            creating static maps or when preparing maps for publication. For more information about
            creating maps using the "cartographic" option, see Create Map of Quadrangle Using Cartographic Map Layout.
This table compares the "normal" and
              "cartographic" options for several projected CRSs. The figures
            within the table show the box specified by Position in red.
| Projected CRS | "normal" | "cartographic" | 
|---|---|---|
| A projected CRS for a temperate region. This row shows
                        maps created from a  | 
 
 
 | 
 
 
 | 
| A projected CRS for a polar region. This row shows maps
                        created from a  | 
 
 
 | 
 
 
 | 
| A projected CRS for a global region. This row shows
                        maps created from a  In this case, the map layouts
                        for the  | 
 
 
 | 
 
 
 | 
Latitude limits for the quadrangle used by MapLayout, specified
            as a two-element vector of the form [latmin latmax], where
              latmax is greater than latmin. 
By default, MATLAB sets this property using the area of use for
            the projected CRS. When a projected CRS does not indicate the area of use, MATLAB sets this property to [-90 90].
Changing the value of this property does not change the value of
              ProjectedCRS.
Panning or zooming within the map does not change the value of this property.
To change the geographic limits of a map that is in the default layout
              (MapLayout is "normal"), use the geolimits
            function instead of the CartographicLatitudeLimits and
              CartographicLongitudeLimits properties.
Longitude limits for the quadrangle used by MapLayout,
            specified as a two-element vector of the form [lonmin lonmax]. In
            most cases, lonmax is greater than lonmin.
By default, MATLAB sets this property using the area of use for
            the projected CRS. When a projected CRS does not indicate the area of use, MATLAB sets this property to [-180 180].
Changing the value of this property does not change the value of
              ProjectedCRS.
Panning or zooming within the map does not change the value of this property.
To change the geographic limits of a map that is in the default layout
              (MapLayout is "normal"), use the geolimits
            function instead of the CartographicLatitudeLimits and
              CartographicLongitudeLimits properties.
Position
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.
- The - leftand- bottomelements define the distance from the lower-left corner of the container (typically a figure, panel, or tab) to the lower-left corner of the outer position boundary.
- The - widthand- heightelements are the outer position boundary dimensions.
This figure shows the areas defined by the OuterPosition values (blue) and the Position values (red). 

Note
Setting this property has no effect when the parent container is a
            TiledChartLayout 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 a
                  TiledChartLayout 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.
- The - leftand- bottomelements define the distance from the lower-left corner of the container (typically a figure, panel, or tab) to the lower-left corner of the position boundary.
- The - widthand- heightelements are the position boundary dimensions.
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 the
                Position values (red). 

Note
Setting this property has no effect when the parent container is a
                        TiledChartLayout object.
Position property to hold constant when adding, removing, or changing decorations, specified as one of the following values:
- "outerposition"— The- OuterPositionproperty remains constant when you add, remove, or change decorations such as a title or an axis label. If any positional adjustments are needed, MATLAB adjusts the- InnerPositionproperty.
- "innerposition"— The- InnerPositionproperty remains constant when you add, remove, or change decorations such as a title or an axis label. If any positional adjustments are needed, MATLAB adjusts the- OuterPositionproperty.
Note
Setting this property has no effect when the parent container is a
            TiledChartLayout 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  
 
 | 
| "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 a
                GridLayoutOptions 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 the
                Tile and TileSpan properties on the
                TiledChartLayoutOptions 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.

This code places the axes ax in the third tile of the
            grid.
ax.Layout.Tile = 3;
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 the
                Tile 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.
ax.Layout.Tile = 'east';To place the axes into a layout within an app, specify this property as a
                GridLayoutOptions 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
Data exploration toolbar, specified as an AxesToolbar object. The
            toolbar appears at the top-right corner of the axes when you hover over it.

By default, the toolbar includes buttons for exporting content, zooming into the map
            center, zooming out of the map center, and restoring the original view. You can
            customize the toolbar buttons using the axtoolbar
            and axtoolbarbtn functions.
If you do not want the toolbar to appear when you hover over the axes, set the
              Visible property of the AxesToolbar object to
              "off".
            
newmap
mx = gca;
mx.Toolbar.Visible = "off";For more information, see AxesToolbar Properties.
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 you to pan within a chart by dragging. For a list of interaction objects, see
              Control Chart Interactivity.
By default, charts within map 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 and
              ZoomInteraction objects.
newmap mx = gca; mx.Interactions = [panInteraction zoomInteraction];
To remove all interactions from the axes, set this property to an empty array. To
            temporarily disable the current set of interactions, call the disableDefaultInteractivity function. You can reenable them by calling the
              enableDefaultInteractivity function.
Since R2024a
Options to customize interaction behavior for apps, specified as a
              MapAxesInteractionOptions object. Use the properties of the
              MapAxesInteractionOptions object to customize the behavior of
            interactions for map axes objects in apps. For a complete list of properties, see
              MapAxesInteractionOptions Properties.
The options set by the MapAxesInteractionOptions object apply to
            the built-in interactions specified by the Interactions property of the map axes object and to interactions enabled
            using the axes toolbar.
To use this property, you must create the map axes object in App
              Designer, or in a figure created using the uifigure function. 
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.
- 'on'— Display the axes and its children.
- 'off'— Hide the axes without deleting it. You still can access the properties of an invisible axes object.
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 the mouse pointer, stored as a two-element vector of the form
              [lat lon]. The elements of the vector indicate the location of the
            last click within the axes. lat is the latitude in degrees, and
              lon is the longitude in degrees.
If the figure has a defined WindowButtonMotionFcn callback,
            then the value indicates the last location of the pointer. The figure also has a
                CurrentPoint property.
Context menu, specified as a ContextMenu object. Use this property
            to display a context menu when you right-click the object. Create the context menu using
            the uicontextmenu function.
Note
If the PickableParts property is set to
                    'none' or if the HitTest property is set
                to 'off', then the context menu does not appear.
Selection state, 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'— Selected. If you click the object when in plot edit mode, then MATLAB sets its- Selectedproperty to- 'on'. If the- SelectionHighlightproperty also is set to- 'on', then MATLAB displays selection handles around the object.
- 'off'— Not selected.
Display of selection handles when selected, 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 selection handles when the- Selectedproperty is set to- 'on'.
- 'off'— Never display selection handles, even when the- Selectedproperty is set to- 'on'.
Callbacks
Mouse-click callback, specified as one of these values:
- Function handle 
- Cell array containing a function handle and additional arguments 
- Character vector that is a valid MATLAB command or function, which is evaluated in the base workspace (not recommended) 
Use this property to execute code when you click the object. If you specify this property using a function handle, then MATLAB passes two arguments to the callback function when executing the callback:
- Clicked object — Access properties of the clicked object from within the callback function. 
- Event data — Empty argument. Replace it with the tilde character ( - ~) in the function definition to indicate that this argument is not used.
For more information on how to use function handles to define callback functions, see Create Callbacks for Graphics Objects.
Note
If the PickableParts property is set to
                    'none' or if the HitTest property is set
                to 'off', then this callback does not execute. 
Object creation function, specified as one of these values:
- Function handle. 
- 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. 
- Character vector containing a valid MATLAB expression (not recommended). MATLAB evaluates this expression in the base workspace. 
For more information about specifying a callback as a function handle, cell array, or character vector, see Create Callbacks for Graphics Objects.
This property specifies a callback function to execute when MATLAB creates the object. MATLAB initializes all property values before executing the CreateFcn callback. If you do not specify the CreateFcn property, then MATLAB executes a default creation function.
Setting the CreateFcn property on an existing component has no effect.
If you specify this property as a function handle or cell array, you can access the object that is being created using the first argument of the callback function. Otherwise, use the gcbo function to access the object.
Object deletion function, specified as one of these values:
- Function handle. 
- 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. 
- Character vector containing a valid MATLAB expression (not recommended). MATLAB evaluates this expression in the base workspace. 
For more information about specifying a callback as a function handle, cell array, or character vector, see Create Callbacks for Graphics Objects.
This property specifies a callback function to execute when MATLAB deletes the object. MATLAB executes the DeleteFcn callback before destroying the
            properties of the object. If you do not specify the DeleteFcn
            property, then MATLAB executes a default deletion function.
If you specify this property as a function handle or cell array, you can access the object that is being deleted using the first argument of the callback function. Otherwise, use the gcbo function to access the object.
Callback Execution Control
Callback interruption, 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 property determines if a running callback can be interrupted. There are two callback states to consider:
- The running callback is the currently executing callback. 
- The interrupting callback is a callback that tries to interrupt the running callback. 
MATLAB determines callback interruption behavior whenever it executes a command that
            processes the callback queue. These commands include drawnow, figure, uifigure, getframe, waitfor, and pause.
If the running callback does not contain one of these commands, then no interruption occurs. MATLAB first finishes executing the running callback, and later executes the interrupting callback.
If the running callback does contain one of these commands, then the
                Interruptible property of the object that owns the running
            callback determines if the interruption occurs:
- If the value of - Interruptibleis- 'off', then no interruption occurs. Instead, the- BusyActionproperty of the object that owns the interrupting callback determines if the interrupting callback is discarded or added to the callback queue.
- If the value of - Interruptibleis- 'on', then the interruption occurs. The next time MATLAB processes the callback queue, it stops the execution of the running callback and executes the interrupting callback. After the interrupting callback completes, MATLAB then resumes executing the running callback.
Note
Callback interruption and execution behave differently in these situations:
- If the interrupting callback is a - DeleteFcn,- CloseRequestFcn, or- SizeChangedFcncallback, then the interruption occurs regardless of the- Interruptibleproperty value.
- If the running callback is currently executing the - waitforfunction, then the interruption occurs regardless of the- Interruptibleproperty value.
- If the interrupting callback is owned by a - Timerobject, then the callback executes according to schedule regardless of the- Interruptibleproperty value.
Callback queuing, specified as 'queue' or 'cancel'. The BusyAction property determines how MATLAB handles the execution of interrupting callbacks. There are two callback states to consider:
- The running callback is the currently executing callback. 
- The interrupting callback is a callback that tries to interrupt the running callback. 
The BusyAction property determines callback queuing behavior only
            when both of these conditions are met:
Under these conditions, the BusyAction property of the
            object that owns the interrupting callback determines how MATLAB handles the interrupting callback. These are possible values of the
                BusyAction property:
- 'queue'— Puts the interrupting callback in a queue to be processed after the running callback finishes execution.
- 'cancel'— Does not execute the interrupting callback.
Ability to capture mouse clicks, specified as one of these values:
- "visible"— Capture mouse clicks only when visible. The- Visibleproperty must be set to- "on". The- HitTestproperty determines if the- MapAxesobject responds to the click or if an ancestor does.
- "all"— Capture mouse clicks regardless of visibility. The- Visibleproperty can be set to- "on"or- "off". The- HitTestproperty determines if the- MapAxesobject responds to the click or if an ancestor does.
- "none"— Cannot capture mouse clicks. Clicking the- MapAxesobject passes the click to the object below it in the current view of the figure window, which is typically the axes or the figure. The- HitTestproperty has no effect.
If you want an object to be clickable when it is underneath other objects that you
            do not want to be clickable, then set the PickableParts property of
            the other objects to "none" so that the click passes through
            them.
Response to captured mouse clicks, 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'— Trigger the- ButtonDownFcncallback of the- MapAxesobject. If you have defined the- ContextMenuproperty, then invoke the context menu.
- 'off'— Trigger the callbacks for the nearest ancestor of the- MapAxesobject that has one of these:- HitTestproperty set to- 'on'
- PickablePartsproperty set to a value that enables the ancestor to capture mouse clicks
 
Note
The PickableParts property determines if the MapAxes object can capture mouse
                clicks. If it cannot, then the HitTest property has no
                effect.
This property is read-only.
Deletion status, returned as an on/off logical value of type matlab.lang.OnOffSwitchState.
MATLAB sets the BeingDeleted property to
                'on' when the DeleteFcn callback begins
            execution. The BeingDeleted property remains set to
                'on' until the component object no longer exists.
Check the value of the BeingDeleted property to verify that the object is not about to be deleted before querying or modifying it.
Parent/Child
Parent container, specified as a Figure,
                                                  Panel, Tab,
                                                  TiledChartLayout, or GridLayout object.
Children, returned as an array of graphics objects. Use this property to view a list of the children or to reorder the children by setting the property to a permutation of itself.
You cannot add or remove children using the Children property. To
            add a child to this list, set the Parent property of the child
            graphics object to the MapAxes
            object.
Visibility of the object handle in the Children property of the
                  parent, specified as one of these values:
- 'on'— Object handle is always visible.
- 'off'— Object handle is invisible at all times. This option is useful for preventing unintended changes by another function. Set the- HandleVisibilityto- 'off'to temporarily hide the handle during the execution of that function.
- 'callback'— Object handle is visible from within callbacks or functions invoked by callbacks, but not from within functions invoked from the command line. This option blocks access to the object at the command line, but permits callback functions to access it.
If the object is not listed in the Children property of the
                  parent, then functions that obtain object handles by searching the object
                  hierarchy or querying handle properties cannot return it. Examples of such
                  functions include the get, findobj, gca, gcf, gco, newplot, cla, clf, and close functions.
Hidden object handles are still valid. Set the root
                        ShowHiddenHandles property to 'on'
                  to list all object handles regardless of their
                        HandleVisibility property setting. 
Identifiers
This property is read-only.
Type of graphics object, stored as 'mapaxes'.
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.
User data, specified as any MATLAB array. For example, you can specify a scalar, vector, matrix, cell array, character array, table, or structure. Use this property to store arbitrary data on an object.
If you are working in App Designer, create public or private properties in the app to share data instead of using the UserData property. For more information, see Share Data Within App Designer Apps.
More About
The area of use is the region for which a projected CRS is valid.
Many projcrs objects specify the area of use. To find the area of use
        for a projected CRS, display the well-known text (WKT) string of the CRS and search for the
          BBOX attribute. 
This code shows how to display the WKT string for a projcrs object
        stored in a map axes object by using the wktstring
        function.
newmap
mx = gca;
p = mx.ProjectedCRS;
wktstring(p,Format="Formatted")Version History
Introduced in R2023a
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.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- 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)






















