Control axes appearance and behavior
Axes properties control the appearance and behavior of an axes object. By changing property values, you can modify certain aspects of the axes.
Starting in R2014b, you can use dot notation to query and set properties.
ax = gca; c = ax.Color; ax.Color = 'blue';
If you are using an earlier release, use the get
and set
functions
instead.
Color
— Color of axes back planes[1 1 1]
(default) | RGB triplet | character vector | 'none'
Color of axes back planes, specified as an RGB triplet, a character
vector of a color name, or 'none'
. If you set the
color to 'none'
, then the axes is invisible and
the figure color shows through.
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]
. This table lists the
long and short color name options and the equivalent RGB triplet values.
Long Name | Short Name | RGB Triplet |
---|---|---|
'yellow' | 'y' | [1 1 0] |
'magenta' | 'm' | [1 0 1] |
'cyan' | 'c' | [0 1 1] |
'red' | 'r' | [1 0 0] |
'green' | 'g' | [0 1 0] |
'blue' | 'b' | [0 0 1] |
'white' | 'w' | [1 1 1] |
'black' | 'k' | [0 0 0] |
Example: ax.Color = [0 0 1]
Example: ax.Color = 'b'
Example: ax.Color = 'blue'
Box
— Axes box outline'off'
(default) | 'on'
Axes box outline, specified as one of these values:
'off'
— Do not display the
box outline around the axes.
'on'
— Display the box outline
around the axes. In a 3-D view, the outline appears around the axes
back planes. Use the BoxStyle
property to change
the extent of the outline.
The XColor
, YColor
,
and ZColor
properties control the color of the
outline.
Example: ax.Box = 'on'
BoxStyle
— Style of axes box outline'back'
(default) | 'full'
Style of axes box outline, specified as one of these values:
'back'
— Outline the back
planes of the 3-D box.
'full'
— Outline the entire
3-D box.
The BoxStyle
property affects only 3-D
views.
Example: ax.BoxStyle = 'full'
LineWidth
— Width of axes outline, tick marks, and grid lines0.5
(default) | scalar valueWidth of axes outline, tick marks, and grid lines, specified as a scalar value in point units. One point equals 1/72 inch.
Example: ax.LineWidth = 1.5
XAxis
, YAxis
, ZAxis
— Component that controls appearance and behavior of each axisComponent that controls the appearance and behavior of the x-axis, y-axis, or z-axis, returned as a numeric, datetime, or duration ruler object. The type of ruler that MATLAB® creates for each axis depends on the plotted data.
Modify the appearance and behavior of a particular axis by accessing the associated ruler and setting ruler properties. For a list of options, see:
For example, access the ruler for the x-axis
through the XAxis
property. Then, change the Color
property
of the ruler, and thus the color of the x-axis,
to red. Similarly, change the color of the y-axis
to green.
ax = gca; ax.XAxis.Color = 'r'; ax.YAxis.Color = 'g';
Use the XAxis
, YAxis
,
and ZAxis
properties to access the ruler objects
and set ruler properties. If you want to set axes properties, set
them directly on the axes object. For example, ax.XAxisLocation
= 'top'
sets the XAxisLocation
property
of the axes.
XAxisLocation
— Location of x-axis'bottom'
(default) | 'top'
| 'origin'
Location of the x-axis, specified as one of these values:
'bottom'
— Display the x-axis
at the bottom of the axes.
'top'
— Display the x-axis
at the top of the axes.
'origin'
— Display the x-axis
so that it passes through the origin point (0,0).
This property applies only to 2-D views.
Example: ax.XAxisLocation = 'origin'
YAxisLocation
— Location of y-axis'left'
(default) | 'right'
| 'origin'
Location of y-axis, specified as one of these values:
'left'
— Display the y-axis
on the left side of the axes.
'right'
— Display the y-axis
on the right side of the axes.
'origin'
— Display the y-axis
so that it passes through the origin point (0,0).
This property applies only to 2-D views.
Example: ax.YAxisLocation = 'origin'
XColor
, YColor
, ZColor
— Color of axis line, tick values, and labels[0.15 0.15 0.15]
(default) | RGB triplet | character vector | 'none'
Color of the axis line, tick values, and labels in the x, y,
or z direction, specified as an RGB triplet,
a character vector of a color name, or 'none'
.
If you set the color to 'none'
, then the axes outline
is invisible.
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]
. This table lists the
long and short color name options and the equivalent RGB triplet values.
Long Name | Short Name | RGB Triplet |
---|---|---|
'yellow' | 'y' | [1 1 0] |
'magenta' | 'm' | [1 0 1] |
'cyan' | 'c' | [0 1 1] |
'red' | 'r' | [1 0 0] |
'green' | 'g' | [0 1 0] |
'blue' | 'b' | [0 0 1] |
'white' | 'w' | [1 1 1] |
'black' | 'k' | [0 0 0] |
Setting this property sets the associated mode property to manual.
Setting the XColor
property changes the x-axis
label color, even if you previously specified the label color (for
example, using the xlabel
function).
To prevent the XColor
property from overriding
the label color, set the XColor
property first.
Similarly, the YColor
and ZColor
properties
override previously specified label colors.
Example: ax.XColor = [1 1 0]
Example: ax.YColor = 'y'
Example: ax.ZColor = 'yellow'
XColorMode
, YColorMode
, ZColorMode
— Selection mode for axis line color'auto'
(default) | 'manual'
Selection mode for the axis line color, specified as one of these values:
'auto'
— Use the default
color. For related information about grid-line selection, see the GridColorMode
property.
'manual'
— Use the manually
specified color. To specify the color, set the XColor
, YColor
,
or ZColor
property.
Example: ax.XColorMode = 'auto'
XDir
, YDir
, ZDir
— Direction of increasing values along axis'normal'
(default) | 'reverse'
Direction of increasing values along axis, specified as one of these values:
'normal'
— Normal direction
of increasing values:
x-axis values increase from left to right.
y-axis values increase from bottom to top (2-D view) or front to back (3-D view).
z-axis values increase pointing out of the screen (2-D view) or from bottom to top (3-D view).
'reverse'
— Reverse direction
of increasing values:
x-axis values decrease from left to right.
y-axis values decrease from bottom to top (2-D view) or front to back (3-D view).
z-axis values decrease pointing out of the screen (2-D view) or from bottom to top (3-D view).
Example: ax.XDir = 'normal'
Example: ax.YDir = 'reverse'
XScale
, YScale
, ZScale
— Scale of values along axis'linear'
(default) | 'log'
Scale of values along axis, specified as 'linear'
or 'log'
.
Example: ax.XScale = 'linear'
Example: ax.YScale = 'log'
XLim
, YLim
, ZLim
— Minimum and maximum axis limits[0 1]
(default) | two-element vector of the form [min max]
Minimum and maximum limits, specified as a two-element vector
of the form [min max]
, where max
is
greater than min
. You can specify both limits,
or specify one limit and let the axes automatically calculate the
other.
Use -inf
to set the minimum limit
to the minimum data value; for example, [-inf 0]
.
Use inf
to set the maximum limit
to the maximum data value; for example, [0 inf]
.
Alternatively, use the xlim
, ylim
, and zlim
functions
to set the limits.
Example: ax.XLim = [0 10]
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| datetime
| duration
XLimMode
, YLimMode
, ZLimMode
— Selection mode for axis limits'auto'
(default) | 'manual'
Selection mode for the axis limits, specified as one of these values:
'auto'
— Select axis limits
based on the data plotted, that is, the total span of the XData
, YData
,
or ZData
of all the objects displayed in the
axes.
'manual'
— Use manually
specified axis limits. To specify the axis limits, set the XLim
, YLim
,
or ZLim
property.
Example: ax.XLimMode = 'auto'
XTick
, YTick
, ZTick
— Tick mark locations[]
(default) | vector of increasing valuesTick mark locations, specified as a vector of increasing values.
Example: ax.XTick = [2 4 6 8 10]
Example: ax.YTick = 0:10:100
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| datetime
| duration
XTickMode
, YTickMode
, ZTickMode
— Selection mode for tick mark locations'auto'
(default) | 'manual'
Selection mode for the tick mark locations, specified as one of these values:
'auto'
— Select the tick
mark locations based on the range of data for the axis.
'manual'
— Use manually
specified tick mark locations. To specify the values, set the XTick
, YTick
,
or ZTick
property.
Example: ax.XTickMode = 'auto'
XTickLabel
, YTickLabel
, ZTickLabel
— Tick mark labels''
(default) | cell array of character vectors | string arrayTick mark labels, specified as a cell array of character vectors
or a string array. If you do not specify enough labels for all the
ticks values, then the axes cycles through the specified labels. Tick
labels support TeX and LaTeX markup. See the TickLabelInterpreter
property
for more information.
Example: ax.XTickLabel = {'Jan','Feb','Mar','Apr'}
Data Types: char
| string
XTickLabelMode
, YTickLabelMode
, ZTickLabelMode
— Selection mode for tick mark labels'auto'
(default) | 'manual'
Selection mode for the tick mark labels, specified as one of these values:
'auto'
— Label tick marks
with numeric values that span the range of the plotted data.
'manual'
— Use manually
specified tick mark labels. To specify the labels, set the XTickLabel
, YTickLabel
,
or ZTickLabel
property.
Example: ax.XTickLabelMode = 'auto'
TickLabelInterpreter
— Interpretation of characters in tick labels'tex'
(default) | 'latex'
| 'none'
Interpretation of tick label characters, specified as one of these values:
'tex'
— Interpret labels
using a subset of TeX markup.
'latex'
— Interpret labels
using a subset of LaTeX markup.
'none'
— Display literal
characters
By default, MATLAB supports a subset of TeX markup. Use TeX markup to add superscripts and subscripts, modify the text type and color, and include special characters in the text.
This table lists the supported modifiers when the TickLabelInterpreter
property
is set to 'tex'
, which is the default value. Modifiers
remain in effect until the end of the text, except for superscripts
and subscripts which only modify the next character or the text within
the curly braces {}
.
Modifier | Description | Example |
---|---|---|
^{ } | Superscript | 'text^{superscript}' |
_{ } | Subscript | 'text_{subscript}' |
\bf | Bold font | '\bf text' |
\it | Italic font | '\it text' |
\sl | Oblique font (rarely available) | '\sl text' |
\rm | Normal font | '\rm text' |
\fontname{specifier} | Set specifier as the name of a font family
to change the font style. You can use this in combination with other
modifiers. | '\fontname{Courier} text' |
\fontsize{specifier} | Set specifier as a scalar numeric value
to change the font size. | '\fontsize{15} text' |
\color{specifier} | Set specifer as one of these colors: red , green , yellow , magenta , blue , black , white , gray , darkGreen , orange ,
or lightBlue . | '\color{magenta} text' |
\color[rgb]{specifier} | Set specifier as a three-element RGB triplet
to change the font color. | '\color[rgb]{0,0.5,0.5} text' |
This
table lists the supported special characters with the Interpreter
property
set to 'tex'
.
Character Sequence | Symbol | Character Sequence | Symbol | Character Sequence | Symbol |
---|---|---|---|---|---|
| α |
| υ |
| ~ |
| ∠ |
| Φ |
| ≤ |
|
|
| χ |
| ∞ |
| β |
| ψ |
| ♣ |
| γ |
| ω |
| ♦ |
| δ |
| Γ |
| ♥ |
| ɛ |
| Δ |
| ♠ |
| ζ |
| Θ |
| ↔ |
| η |
| Λ |
| ← |
| Θ |
| Ξ |
| ⇐ |
| ϑ |
| Π |
| ↑ |
| ι |
| Σ |
| → |
| κ |
| ϒ |
| ⇒ |
| λ |
| Φ |
| ↓ |
| µ |
| Ψ |
| º |
| ν |
| Ω |
| ± |
| ξ |
| ∀ |
| ≥ |
| π |
| ∃ |
| ∝ |
| ρ |
| ∍ |
| ∂ |
| σ |
| ≅ |
| • |
| ς |
| ≈ |
| ÷ |
| τ |
| ℜ |
| ≠ |
| ≡ |
| ⊕ |
| ℵ |
| ℑ |
| ∪ |
| ℘ |
| ⊗ |
| ⊆ |
| ∅ |
| ∩ |
| ∈ |
| ⊇ |
| ⊃ |
| ⌈ |
| ⊂ |
| ∫ |
| · |
| ο |
| ⌋ |
| ¬ |
| ∇ |
| ⌊ |
| x |
| ... |
| ⊥ |
| √ |
| ´ |
| ∧ |
| ϖ |
| ∅ |
| ⌉ |
| 〉 |
| | |
| ∨ |
| 〈 |
| © |
To use LaTeX markup, set the TickLabelInterpreter
property
to 'latex'
. The displayed text uses the default
LaTeX font style. The FontName
, FontWeight
,
and FontAngle
properties do not have an effect.
To change the font style, use LaTeX markup within the text.
The maximum size of the text that you can use with the LaTeX interpreter is 1200 characters. For multiline text, this reduces by about 10 characters per line.
For more information about the LaTeX system, see The LaTeX Project website at http://www.latex-project.org/.
XTickLabelRotation
, YTickLabelRotation
, ZTickLabelRotation
— Rotation of tick labels0
(default) | scalar value in degreesRotation of tick labels, specified as a scalar value in degrees. Negative values give clockwise rotation.
Example: ax.XTickLabelRotation = 45
Example: ax.YTickLabelRotation = 90
XMinorTick
, YMinorTick
, ZMinorTick
— Display of minor tick marks'off'
| 'on'
Display of minor tick marks, specified as one of these values:
'off'
— Do not display minor
tick marks. This is the default value for an axis with a linear scale.
'on'
— Display minor tick
marks between the major tick marks on the axis. The space between
the major tick marks determines the number of minor tick marks. This
is the default value for an axis with a log scale.
Example: ax.XMinorTick = 'on'
TickLength
— Tick mark length[0.01 0.025]
(default) | two-element vectorTick mark length, specified as a two-element vector of the form [2Dlength
3Dlength]
. The first element is the tick mark length in
2-D views and the second element is the tick mark length in 3-D views.
Specify the values in units normalized relative to the longest of
the visible x-axis, y-axis,
or z-axis lines.
Example: ax.TickLength = [0.02 0.035]
TickDir
— Tick mark direction'in'
(default) | 'out'
| 'both'
Tick mark direction, specified as one of these values:
'in'
— Direct the tick marks
inward from the axis lines. This is the default for 2-D views.
'out'
— Direct the tick
marks outward from the axis lines. This is the default for 3-D views.
'both'
— Center the tick
marks over the axis lines.
If the associated mode property is set to 'auto'
,
then MATLAB chooses the tick label direction. If you set this
property, then MATLAB sets the mode to 'manual'
and
does not automatically choose the tick label direction.
Example: ax.TickDir = 'out'
TickDirMode
— Selection mode for TickDir
'auto'
(default) | 'manual'
Selection mode for the TickDir
property,
specified as one of these values:
'auto'
— Use default tick
direction.
'manual'
— Use manually
specified tick mark direction. To specify the tick mark direction,
set the TickDir
property.
Example: ax.TickDirMode = 'auto'
XGrid
, YGrid
, ZGrid
— Display of grid lines'off'
(default) | 'on'
Display of grid lines, specified as one of these values:
'off'
— Do not display the
grid lines.
'on'
— Display grid lines
perpendicular to the axis, for example, along lines of constant x, y,
or z values.
Alternatively, use the grid on
or grid
off
command to set all three properties to 'on'
or 'off'
,
respectively. For more information, see grid
.
Example: ax.XGrid = 'on'
XMinorGrid
, YMinorGrid
, ZMinorGrid
— Display of minor grid lines'off'
(default) | 'on'
Display of minor grid lines, specified as one of these values:
'off'
— Do not display grid
lines.
'on'
— Display grid lines
aligned with the minor tick marks of the axis. You do not need to
enable minor ticks to display minor grid lines.
Alternatively, use the grid minor
command
to toggle the visibility of the minor grid lines.
Example: ax.XMinorGrid = 'on'
GridLineStyle
— Line style for grid lines'-'
(default) | '--'
| ':'
| '-.'
| 'none'
Line style used for grid 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 |
To
display the grid lines, use the grid on
command
or set the XGrid
, YGrid
,
or ZGrid
property to 'on'
.
Example: ax.GridLineStyle = '--'
MinorGridLineStyle
— Line style for minor grid lines':'
(default) | '-'
| '--'
| '-.'
| 'none'
Line style used for minor grid lines, specified as one of the line styles shown in this table.
Line Style | Description | Resulting Line |
---|---|---|
'-' | Solid line |
|
'--' | Dashed line |
|
':' | Dotted line |
|
'-.' | Dash-dotted line |
|
'none' | No line | No line |
To display minor grid lines, use the grid minor
command
or set the XGridMinor
, YGridMinor
,
or ZGridMinor
property to 'on'
.
Example: ax.MinorGridLineStyle = '-.'
GridColor
— Color of grid lines[0.15 0.15 0.15]
(default) | RGB triplet | character vector | 'none'
Color of grid lines, specified as an RGB triplet, a character
vector or a color name, or 'none'
.
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]
. This table lists the
long and short color name options and the equivalent RGB triplet values.
Long Name | Short Name | RGB Triplet |
---|---|---|
'yellow' | 'y' | [1 1 0] |
'magenta' | 'm' | [1 0 1] |
'cyan' | 'c' | [0 1 1] |
'red' | 'r' | [1 0 0] |
'green' | 'g' | [0 1 0] |
'blue' | 'b' | [0 0 1] |
'white' | 'w' | [1 1 1] |
'black' | 'k' | [0 0 0] |
To set the colors for the axes box outline, use the XColor
, YColor
,
and ZColor
properties.
Setting this property sets the associated mode property to manual.
Example: ax.GridColor = [0 0 1]
Example: ax.GridColor = 'b'
Example: ax.GridColor = 'blue'
GridColorMode
— Selection mode for GridColor
'auto'
(default) | 'manual'
Selection mode for the GridColor
property,
specified as 'auto'
or 'manual'
.
The color is based on the values of the GridColorMode
, XColorMode
, YColorMode
,
and ZColorMode
properties.
These tables list the grid line colors for different combinations of color modes.
GridColorMode Property | XColorMode Property | x-Axis Grid-Line Color |
---|---|---|
|
| Use GridColor property. |
|
| Use XColor property. |
|
| Use GridColor property. |
|
| Use GridColor property. |
GridColorMode Property | YColorMode Property | y-Axis Grid-Line Color |
---|---|---|
|
| Use GridColor property. |
|
| Use YColor property. |
|
| Use GridColor property. |
|
| Use GridColor property. |
GridColorMode Property | ZColorMode Property | z-Axis Grid-Line Color |
---|---|---|
|
| Use GridColor property. |
|
| Use ZColor property. |
|
| Use GridColor property. |
|
| Use GridColor property. |
Example: ax.GridColorMode = 'auto'
MinorGridColor
— Color of minor grid lines[0.1 0.1 0.1]
(default) | RGB triplet | character vectorColor of minor grid lines, specified as an RGB triplet, a character
vector of a color name, or 'none'
.
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]
. This table lists the
long and short color name options and the equivalent RGB triplet values.
Long Name | Short Name | RGB Triplet |
---|---|---|
'yellow' | 'y' | [1 1 0] |
'magenta' | 'm' | [1 0 1] |
'cyan' | 'c' | [0 1 1] |
'red' | 'r' | [1 0 0] |
'green' | 'g' | [0 1 0] |
'blue' | 'b' | [0 0 1] |
'white' | 'w' | [1 1 1] |
'black' | 'k' | [0 0 0] |
Example: ax.MinorGridColor = [0 0 1]
Example: ax.MinorGridColor = 'b'
Example: ax.MinorGridColor = 'blue'
MinorGridColorMode
— Selection mode for MinorGridColor
'auto'
(default) | 'manual'
Selection mode for the MinorGridColor
property,
specified as 'auto'
or 'manual'
.
The minor grid line color is based on the values of the MinorGridColorMode
, XColorMode
, YColorMode
,
and ZColorMode
properties.
These tables list the minor grid line colors for different combinations of color modes.
MinorGridColorMode Property | XColorMode Property | x-Axis Minor Grid-Line Color |
---|---|---|
|
| Use MinorGridColor property. |
|
| Use XColor property. |
|
| Use MinorGridColor property. |
|
| Use MinorGridColor property. |
MinorGridColorMode Property | YColorMode Property | y-Axis Minor Grid-Line Color |
---|---|---|
|
| Use MinorGridColor property. |
|
| Use YColor property. |
|
| Use MinorGridColor property. |
|
| Use MinorGridColor property. |
MinorGridColorMode Property | ZColorMode Property | z-Axis Minor Grid-Line Color |
---|---|---|
|
| Use MinorGridColor property. |
|
| Use ZColor property. |
|
| Use MinorGridColor property. |
|
| Use MinorGridColor property. |
Example: ax.MinorGridColorMode = 'auto'
GridAlpha
— Grid-line transparency0.15
(default) | value in the range [0,1]
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: ax.GridAlpha = 0.5
GridAlphaMode
— Selection mode for GridAlpha
'auto'
(default) | 'manual'
Selection mode for the GridAlpha
property,
specified as one of these values:
'auto'
— Use default transparency
value of 0.15
.
'manual'
— Use the manually
specified transparency value. To specify the value, set the GridAlpha
property.
Example: ax.GridAlphaMode = 'auto'
MinorGridAlpha
— Minor grid line transparency0.25
(default) | value in the range [0,1]
Minor 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: ax.MinorGridAlpha = 0.5
MinorGridAlphaMode
— Selection mode for MinorGridAlpha
'auto'
(default) | 'manual'
Selection mode for the MinorGridAlpha
property,
specified as one of these values:
'auto'
— Use the default
transparency value of 0.25
.
'manual'
— Use the manually
specified transparency value. To specify the value, set the MinorGridAlpha
property.
Example: ax.MinorGridAlphaMode = 'auto'
Layer
— Placement of grid lines and tick marks in relation to graphic objects'bottom'
(default) | 'top'
Placement of grid lines and tick marks in relation to graphic objects, specified as one of these values:
'bottom'
— Display tick
marks and grid lines under graphics objects.
'top'
— Display tick marks
and grid lines over graphics objects.
This property affects only 2-D views.
Example: ax.Layer = 'top'
FontName
— Font name'FixedWidth'
Font name, specified as the name of the font to use or 'FixedWidth'
.
To display and print properly, the font name must be a font that your
system supports. The default font depends on the specific operating
system and locale.
To use a fixed-width font that looks good in any locale, use 'FixedWidth'
.
The 'FixedWidth'
value relies on the root FixedWidthFontName
property.
Setting the root FixedWidthFontName
property causes
an immediate update of the display to use the new font.
Example: 'Cambria'
FontSize
— Font size10
(default) | scalar numeric valueFont size, specified as a scalar numeric value. The FontSize
, LabelFontSizeMultiplier
,
and TitleFontSizeMultiplier
properties determine
the size of the text used for the axis labels and the title. The FontUnits
property
determines the units used to interpret the font size.
Example: ax.FontSize = 12
TitleFontSizeMultiplier
— Scale factor for title font size1.1
(default) | numeric value greater than 0Scale factor for title font size, specified as a numeric value
greater than 0. The axes applies this scale factor to the value of
the FontSize
property to determine the font size
for the title.
Example: ax.TitleFontSizeMultiplier = 1.75
LabelFontSizeMultiplier
— Scale factor for label font size1.1
(default) | numeric value greater than 0Scale factor for label font size, specified as a numeric value
greater than 0. The axes applies this scale factor to the value of
the FontSize
property to determine the font size
for the x-axis, y-axis,
and z-axis labels.
Example: ax.LabelFontSizeMultiplier = 1.5
FontUnits
— Font size units'points'
(default) | 'inches'
| 'centimeters'
| 'characters'
| 'normalized'
| 'pixels'
Font size units, specified as one of the values in this table.
Units | Description |
---|---|
'points' | Points. One point equals 1/72 inch. |
'inches' | Inches. |
'centimeters' | Centimeters. |
'characters' | Based on the default uicontrol font of the graphics root object:
|
'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 FontSize is 0.1 in normalized
units, then the text is 1/10 of the axes height. |
'pixels' | Pixels. Starting in R2015b, distances in pixels are independent of your system resolution on Windows® and Macintosh systems:
On Linux® systems, the size of a pixel is determined by your system resolution. |
If you set both the font size and the font units in one function
call, you must set the FontUnits
property first
so that the axes correctly interprets the specified font size.
FontAngle
— Character slant'normal'
(default) | 'italic'
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.
Note:
The |
FontWeight
— Thickness of text characters'normal'
(default) | 'bold'
Thickness of the text characters, specified as one of these values:
'normal'
— Default weight
as defined by the particular font
'bold'
— Thicker character
outlines than normal
MATLAB uses the FontWeight
property
to select a font from those available on your system. Not all fonts
have a bold font weight. Therefore, specifying a bold font weight
still can result in the normal font weight.
Note:
The |
TitleFontWeight
— Thickness of title text'bold'
(default) | 'normal'
Thickness of the title text, specified as one of these values:
'bold'
— Thicker characters
outlines than normal.
'normal'
— Default weight
as defined by the particular font.
Example: ax.TitleFontWeight = 'normal'
FontSmoothing
— Text smoothing'on'
(default) | 'off'
Text smoothing, specified as one of these values:
'on'
— Use antialiasing
to make text appear smoother on the screen.
'off'
— Do not use antialiasing.
Use this setting if the text seems blurry. In certain cases, smoothed
text blends against the background color and results in a blurring
effect.
Example: ax.FontSmoothing = 'off'
Title
— Text object for axes titleText object for 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')
XLabel
, YLabel
, ZLabel
— Text object for axis labelText object for axis label. To add an axis label, set the String
property
of the text object. To change the label appearance, such as the font
size, set other properties. For a complete list, see Text Properties.
ax = gca;
ax.YLabel.String = 'My y-Axis Label';
ax.YLabel.FontSize = 12;
Alternatively, use the xlabel
, ylabel
, and zlabel
functions
to add an axis label and control the appearance.
ylabel('My y-Axis Label','FontSize',12)
Legend
— Legend associated with axesempty GraphicsPlaceholder
(default) | legend objectThis property is read only.
Legend associated with the axes, specified as a legend object. You can use this property to determine if the axes has a legend.
ax = gca; lgd = ax.Legend if ~isempty(lgd) disp('Legend Exists') end
You also can use this property to access properties of an existing legend. For a complete list of properties, see Legend Properties.
plot(rand(3)) legend({'Line 1','Line 2','Line 3'},'FontSize',12) ax = gca; ax.Legend.TextColor = 'red';
ColorOrder
— Colors for multiline plotsColors for multiline plots, specified as a three-column matrix of RGB triplets. Each row of the matrix defines one color in the color order. The default color order has seven colors
Default Color Order | Associated RGB Triplets |
---|---|
| [ 0 0.4470 0.7410 0.8500 0.3250 0.0980 0.9290 0.6940 0.1250 0.4940 0.1840 0.5560 0.4660 0.6740 0.1880 0.3010 0.7450 0.9330 0.6350 0.0780 0.1840] |
Some graphics functions reset this property to the default value before plotting. To specify the color order, you can change the default value before plotting. For example, this code changes the default value for all future axes.
co = [1 0 0.4
0.8 0.2 0.5
0.6 0.4 0.6
0.4 0.6 0.7
0.2 0.8 0.8
0 1 0.9];
set(groot,'defaultAxesColorOrder',co)
ColorOrderIndex
— Next color to use in color order1
(default) | positive integerNext color to use in the color order, specified as a positive
integer. For example, if this property is set to 1
,
then the next plot added to the axes uses the first color in the color
order. If the index value exceeds the number of colors in the color
order, then the index value modulo the number of colors determines
the next color used.
If you used a hold on
command or if the NextPlot
property
of the axes is set to 'add'
, then the color order
index value increases every time a new plot is added. Reset the color
order by setting the ColorOrderIndex
property to 1
.
Example: ax.ColorOrderIndex = 5
LineStyleOrder
— Line styles and markers for multiline plots'-'
solid line (default) | cell array of line stylesLine styles and markers for multiline plots, specified as a cell array. You can combine line and marker specifiers in a single entry.
Example: {'-*',':','o'}
MATLAB cycles through the line styles only after using
all the colors contained in the ColorOrder
property. The
default LineStyleOrder
has only one line style.
Specifier | Line Style |
---|---|
'-' (default) | Solid line |
'--' | Dashed line |
':' | Dotted line |
'-.' | Dash-dotted line |
'+' | 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 |
Some graphics functions reset this property to the default value before plotting. To specify the line styles, you can change the default value before plotting. For example, this code changes the default value for all future axes.
set(groot,'defaultAxesLineStyleOrder',{'-*',':','o'})
LineStyleOrderIndex
— Next line style to use in line style order1
(default) | positive integerNext line style to use in the line style order, specified as
a positive integer. For example, if this property is set to 1
,
then the next plot added to the axes uses the first line style in
the line style order. If the index value exceeds the number of line
styles in the line style order, then the index value modulo the number
of line styles determines the next line style used.
If you used a hold on
command or if the NextPlot
property
of the axes is set to 'add'
, then the line style
order index value increases every time a new plot is added. Subsequent
plots cycle through the line style order. Reset the line style order
by setting the LineStyleOrderIndex
property to 1
.
Example: ax.LineStyleOrderIndex = 1
CLim
— Color limits for objects using colormap[0 1]
(default) | two-element vector of the form [cmin cmax]
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:
cmin
specifies the data value that
maps to the first color in the colormap.
cmax
specifies the data value that
maps to the last color in the colormap.
The axes linearly interpolates data values between cmin
and cmax
across
the colormap. Values outside this range use either the first or last
color, whichever is closest.
For information on changing the colormap, see the colormap
function. For information on
color mapping, see the caxis
function.
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.
CLimMode
— Selection mode for CLim
'auto'
(default) | 'manual'
Selection mode for the CLim
property, specified
as one of these values:
'auto'
— Set the CLim
property
to span the CData
limits of the graphics objects
displayed in the axes.
'manual'
— Use the manually
specified values. To specify the values, set the CLim
property.
The axes does not change the values when the limits of the axes children
change.
ALim
— Alpha limits for images, patches, and surfaces with transparency[0 1]
(default) | two-element vector of the form [amin amax]
Alpha limits for images, patches, and surfaces with transparency,
specified as a two-element vector of the form [amin amax]
.
This property determines how values in the AlphaData
properties
of image, patch, and surface objects map to the figure alpha map,
where:
amin
specifies the data value mapped
to the first alpha value in the figure alpha map.
amax
specifies the data value mapped
to the last alpha value in the figure alpha map.
The axes linearly interpolates data values between amin
and amax
across
the figure alpha map. Values outside this range use either the first
or last alpha map value, whichever is closest.
The Alphamap
property of the figure contains
the alpha map. For more information, see the alpha
function.
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.
ALimMode
— Selection mode for ALim
'auto'
(default) | 'manual'
Selection mode for the ALim
property, specified
as one of these values:
'auto'
— Use values that
span the AlphaData
of the axes children contained
in the Children
property.
'manual'
— Use the manually
specified values. To specify the values, set the ALim
property.
AmbientLightColor
— Background light color[1 1 1]
(default) | RGB triplet | character vector | 'none'
Background light color, specified as an RGB triplet, a character
vector of a color name, or 'none'
. The light is
a directionless light that shines uniformly on all objects in the
axes when there is a visible light object in the axes.
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]
. This table lists the
long and short color name options and the equivalent RGB triplet values.
Long Name | Short Name | RGB Triplet |
---|---|---|
'yellow' | 'y' | [1 1 0] |
'magenta' | 'm' | [1 0 1] |
'cyan' | 'c' | [0 1 1] |
'red' | 'r' | [1 0 0] |
'green' | 'g' | [0 1 0] |
'blue' | 'b' | [0 0 1] |
'white' | 'w' | [1 1 1] |
'black' | 'k' | [0 0 0] |
The 'none'
option is equivalent to using
an RGB triplet value of [0 0 0]
.
Example: ax.AmbientLightColor = [1 0 1]
Example: ax.AmbientLightColor = 'm'
Example: ax.AmbientLightColor = 'magenta'
NextPlot
— Properties to reset when adding new plot'replace'
(default) | 'add'
| 'replacechildren'
| 'replaceall'
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 ColorOrderIndex
and LineStyleOrderIndex
properties
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 ColorOrder
and LineStyle
order
properties. This value is similar to using cla
before
every new plot.
'replace'
— Delete existing
plots and reset all axes properties, except Position
and Units
,
to their default values before displaying the new plot.
'replaceall'
— Delete existing
plots and reset all axes properties, except Position
and Units
,
to their default values before displaying the new plot. This value
is similar to using cla reset
before every new
plot.
Note:
For axes with only one y-axis, the |
Figures also have a NextPlot
property. Alternatively,
you can use the newplot
function
to prepare figures and axes for subsequent graphics commands.
SortMethod
— Order for rendering objects'depth'
(default) | 'childorder'
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 can also result in improper depth sorting of the objects
displayed
Visible
— State of visibility'on'
(default) | 'off'
State of visibility, specified as one of these values:
'on'
— Display the axes.
'off'
— Hide the axes without deleting it. You still can access the properties
of an invisible axes object.
Clipping
— Clipping of objects to axes limits'on'
(default) | 'off'
Clipping of objects to the axes limits, specified as either 'on'
or 'off'
.
The clipping behavior of an object within the axes object depends
on both the Clipping
property of the axes object
and the Clipping
property of the individual object.
The property value of the axes has these effects:
'on'
— Allow each individual
object within the axes to control its own clipping behavior based
on the Clipping
property value for the object.
'off'
— Disable clipping
for all objects within the axes, regardless of the Clipping
property
value for the individual objects. Parts of objects can appear outside
of the axes limits. For example, parts can appear outside the limits
if you create a plot, use the hold on
command,
freeze the axis scaling, and then add a plot that is larger than the
original plot.
This table lists the results for different combinations of Clipping
property
values.
Clipping Property for Axes Object | Clipping Property for Individual Object | Result |
---|---|---|
'on' | 'on' | Individual object is clipped. Others might or might not be. |
'on' | 'off' | Individual object is not clipped. Others might or might not be. |
'off' | 'on' | Individual object and other objects are not clipped. |
'off' | 'off' | Individual object and other objects are not clipped. |
Thick lines and markers might display outside the axes limits,
even if clipping is enabled. If a plot contains markers, then as long
as the data point lies within the axes, MATLAB draws the entire
marker. If a plot uses thick lines, then part of the line might appear
outside the limits depending on the value of the ClippingStyle
property
of the axes object.
When the ClippingStyle
property
is set to '3dbox'
(the default), MATLAB draws
the line using the full line width even if part of the line width
is outside the axes.
When the ClippingStyle
property
is set to 'rectangle'
, MATLAB clips the line
width at the limits.
ClippingStyle
— Boundaries used for clipping'3dbox'
(default) | 'rectangle'
Boundaries used for clipping, specified as one of the values in this table.
Value | Descriptions | Illustration of Boundary Region |
---|---|---|
'3dbox' | Clip plotted objects to the six sides of the axes box defined by the axis limits. |
|
'rectangle' | Clip plotted objects to a rectangular boundary enclosing the axes in any given view. |
|
The ClippingStyle
property has no effect
if the Clipping
property is set to 'off'
.
Position
— Size and position of axes within figure or uipanel[0.1300 0.1100 0.7750 0.8150]
(default) | four-element vectorSize and position of the axes within the figure or uipanel that
contains the axes, specified as a four-element vector of the form [left
bottom width height]
. The left
and bottom
elements
define the distance from the lower-left corner of the container to
the lower-left corner of the axes. The width
and height
elements
are the axes dimensions.
By default, the values are measured in units normalized to the
container. To change the units, set the Units
property.
The axes dimensions are the largest possible values that conform
to all other properties and do not extend outside the Position
rectangle.
Other axes properties that affect the axes size and shape include DataAspectRatio
, PlotBoxAspectRatio
,
and CameraViewAngle
.
Example: ax.Position = [0 0 1 1]
TightInset
— Margins for text labels[left bottom right top]
This property is read only.
Margins for the text labels, specified as a four-element vector
of the form [left bottom right top]
. The elements
define the distances between the bounds of the Position
property
and the extent of the axes text labels and title. By default, the
values are measured in units normalized to the figure or uipanel that
contains the axes. To change the units, set the Units
property.
The Position
property and the TightInset
property
define the tightest bounding box that encloses the axes and its labels
and title. The figure shows the region defined by combining the TightInset
values
and the Position
values.
For more information, see Axes Resize to Accommodate Titles and Labels.
OuterPosition
— Size and location of axes, including labels and margins[0 0 1 1]
(default) | four-element vectorSize and location of axes, including the labels and margins,
specified as a four-element vector of the form [left bottom
width height]
. This vector defines the extents of the rectangle
that encloses the outer bounds of the axes. The left
and bottom
elements
define the distance from the lower-left corner of the figure or uipanel
that contains the axes to the lower-left corner of the rectangle.
The width
and height
elements
are the rectangle dimensions.
By default, the values are measured 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 figure shows the region defined by the OuterPosition
enclosed
in the red rectangle. The green rectangle is the region defined by
the Position
property.
For more information, see Axes Resize to Accommodate Titles and Labels.
ActivePositionProperty
— Position property to hold constant during resize operation'outerposition'
(default) | 'position'
Position property to hold constant during resize operation, specified as one of these values:
'outerposition'
— Hold the OuterPosition
property constant. Resizing the figure does not clip any of the text.
'position'
— Hold the Position
property constant.
A figure can change size if you interactively change resize it or during a printing or exporting operation.
Units
— Position units'normalized'
(default) | 'inches'
| 'centimeters'
| 'points'
| 'pixels'
| 'characters'
Position units, specified as one of the values in this table.
Units | Description |
---|---|
'normalized' (default) | Normalized with respect to the container, which is typically
the figure or a uipanel. 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:
|
'points' | Typography points. One point equals 1/72 inch. |
'pixels' | Pixels. Starting in R2015b, distances in pixels are independent of your system resolution on Windows and Macintosh systems:
On Linux systems, the size of a pixel is determined by your system resolution. |
When specifying the units as a Name,Value
pair
during object creation, you must set the Units
property
before specifying the properties that you want to use these units,
such as Position
.
Projection
— Type of projection onto 2-D screen'orthographic'
(default) | 'perspective'
Type of projection onto 2-D screen, specified as one of these values:
'orthographic'
— Maintain
the correct relative dimensions of graphics objects regarding the
distance of a given point from the viewer, and draw lines that are
parallel in the data on the screen.
'perspective'
— Incorporate
foreshortening, which allows you to perceive depth in 2-D representations
of 3-D objects. Perspective projection does not preserve the relative
dimensions of objects. Instead, it displays a distant line segment
smaller than a nearer line segment of the same length. Lines that
are parallel in the data might not appear parallel on screen.
DataAspectRatio
— Relative length of data units along each axis[1 1 1]
(default) | three-element vector of the form [dx dy dz]
Relative length of data units along each axis, specified as
a three-element vector of the form [dx dy dz]
.
This vector defines the relative x, y,
and z data scale factors. For example, specifying
this property as [1 2 1]
sets the length of one
unit of data in the x-direction to be the same
length as two units of data in the y-direction
and one unit of data in the z-direction.
The DataAspectRatio
property interacts
with the PlotBoxAspectRatio
, XLimMode
, YLimMode
,
and ZLimMode
properties
to control how MATLAB scales the x-axis, y-axis,
and z-axis.
Setting a value for the DataAspectRatio
disables
the "stretch-to-fill figure shape" behavior if DataAspectRatioMode
, PlotBoxAspectRatioMode
,
and CameraViewAngleMode
are all set to 'auto'
.
If the associated mode property is set to 'auto'
,
then MATLAB chooses the ratio values. If you set this property,
then MATLAB sets the mode to 'manual'
.
Example: [1 1 1]
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
DataAspectRatioMode
— Selection mode for DataAspectRatio
'auto'
(default) | 'manual'
Selection mode for the DataAspectRatio
property,
specified as one of these values:
'auto'
— Use values that
make best use of the area provided by the figure.
'manual'
— Use the manually
specified values. To specify the values, set the DataAspectRatio
property.
Changing DataAspectRatioMode
to 'manual'
disables
the "stretch-to-fill figure shape" behavior if DataAspectRatioMode
, PlotBoxAspectRatioMode
,
and CameraViewAngleMode
are all 'auto'
.
This table describes the behavior for various combinations of properties when you disable the stretch-to-fill behavior.
XLimitMode, YLimitMode, and ZLimitMode | DataAspectRatioMode | PlotBoxAspectRatioMode | Behavior |
---|---|---|---|
|
|
| MATLAB chooses limits that span the data range in all dimensions. |
|
|
| MATLAB chooses limits that span the data range in
all dimensions, and modifies |
|
|
| MATLAB chooses limits that span the data range in
all dimensions, and modifies |
|
|
| MATLAB chooses limits that completely fit and center
the plot within the specified |
|
|
| MATLAB honors the specified limits and modifies
the |
|
|
| The axes honors the specified limits and |
|
|
| The axes honors the specified limits and |
One set to |
|
| MATLAB selects the limits to honor the specified aspect ratios and specified limits. |
Two set to |
|
| MATLAB ignores the |
PlotBoxAspectRatio
— Relative length of each axis[1 1 1]
(default) | three-element vector of the form [px py pz]
Relative length of each axis, specified as a three-element vector
of the form [px py pz]
defining the relative x-axis, y-axis,
and z-axis scale factors. The plot box is a box
enclosing the axes data region as defined by the axis limits.
The PlotBoxAspectRatio
property interacts
with the DataAspectRatio
, XLimMode
, YLimMode
,
and ZLimMode
properties. Setting the PlotBoxAspectRatio
disables
the "stretch-to-fill figure shape" behavior, if DataAspectRatioMode
, PlotBoxAspectRatioMode
,
and CameraViewAngleMode
are all 'auto'
.
If the associated mode property is set to 'auto'
,
then MATLAB chooses the ratio values. If you set this property,
then MATLAB sets the mode to 'manual'
.
Example: [1,0.75,0.75]
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
PlotBoxAspectRatioMode
— Selection mode for PlotBoxAspectRatio
'auto'
(default) | 'manual'
Selection mode for the PlotBoxAspectRatio
property,
specified as one of these values:
'auto'
— Use values that
make best use of the area provided by the figure.
'manual'
— Use the manually
specified values. To specify the values, set the PlotBoxAspectRatio
property.
Changing PlotBoxAspectRatioMode
to 'manual'
disables
the "stretch-to-fill figure shape" behavior if PlotBoxAspectRatioMode
, DataAspectRatioMode
,
and CameraViewAngleMode
are all 'auto'
.
This table describes the behavior for various combinations of properties when you disable the stretch-to-fill behavior.
XLimitMode, YLimitMode, and ZLimitMode | DataAspectRatioMode | PlotBoxAspectRatioMode | Behavior |
---|---|---|---|
|
|
| MATLAB chooses limits that span the data range in all dimensions. |
|
|
| MATLAB chooses limits that span the data range in
all dimensions, and modifies |
|
|
| MATLAB chooses limits that span the data range in
all dimensions, and modifies |
|
|
| MATLAB chooses limits that completely fit and center
the plot within the specified |
|
|
| MATLAB honors the specified limits and modifies
the |
|
|
| The axes honors the specified limits and |
|
|
| The axes honors the specified limits and |
One set to |
|
| MATLAB selects the limits to honor the specified aspect ratios and specified limits. |
Two set to |
|
| MATLAB ignores the |
CameraPosition
— Location of camera[x y z]
Location of camera, or the viewpoint, specified as a three-element
vector of the form [x y z]
. This vector defines
the axes coordinates of the location. Changing the CameraPosition
property
changes the point from which you view the axes.
The camera is oriented along the view axis, which is a straight line that connects the camera position and the camera target. For an illustration, see Camera Graphics Terminology.
If the Projection
is 'perspective'
,
then as you change the CameraPosition
, the amount
of perspective also changes.
If the associated mode property is set to 'auto'
,
then MATLAB chooses the camera location. If you set this property,
then MATLAB sets the mode to 'manual'
.
Data Types: single
| double
CameraPositionMode
— Selection mode for CameraPosition
'auto'
(default) | 'manual'
Selection mode for the CameraPosition
property,
specified as one of these values:
'auto'
— Calculate the CameraPosition
value
such that the camera lies a fixed distance from the target along the
azimuth and elevation specified by the current view, as returned by
the view
function. Functions
like rotate3d
, zoom
, and pan
,
change this mode to 'auto'
to perform their actions.
'manual'
— Use the manually
specified value. To specify the value, set the CameraPosition
property.
This table summarizes the camera behavior for various combinations
of CameraViewAngleMode
, CameraTargetMode
,
and CameraPositionMode
property values.
CameraViewAngleMode | CameraTargetMode | CameraPositionMode | Behavior |
---|---|---|---|
'auto' | 'auto' | 'auto' | Sets |
'auto' | 'auto' | 'manual' | Sets |
'auto' | 'manual' | 'auto' | Sets |
'auto' | 'manual' | 'manual' | Sets |
'manual' | 'auto' | 'auto' | Sets |
'manual' | 'auto' | 'manual' | Sets |
'manual' | 'manual' | 'auto' | Sets |
'manual' | 'manual' | 'manual' | Uses specified camera values |
CameraTarget
— Point used as camera target[x y z]
Point used as camera target, specified as a three-element vector
of the form [x y z]
. This vector defines the axes
coordinates of the point. The camera is oriented along the view axis,
which is a straight line that connects the camera position and the
camera target. For an illustration, see Camera Graphics Terminology.
If the associated mode property is set to 'auto'
,
then MATLAB chooses the camera target point. If you set this
property, then MATLAB sets the mode to 'manual'
.
Data Types: single
| double
CameraTargetMode
— Selection mode for CameraTarget
'auto'
(default) | 'manual'
Selection mode for the CameraTarget
property,
specified as one of these values:
'auto'
— Position the camera
target at the centroid of the axes plot box.
'manual'
— Use the manually
specified camera target value. To specify a value, set the CameraTarget
property.
This table summarizes the camera behavior for various combinations
of CameraViewAngleMode
, CameraTargetMode
,
and CameraPositionMode
property values.
CameraViewAngleMode | CameraTargetMode | CameraPositionMode | Behavior |
---|---|---|---|
'auto' | 'auto' | 'auto' | Sets |
'auto' | 'auto' | 'manual' | Sets |
'auto' | 'manual' | 'auto' | Sets |
'auto' | 'manual' | 'manual' | Sets |
'manual' | 'auto' | 'auto' | Sets |
'manual' | 'auto' | 'manual' | Sets |
'manual' | 'manual' | 'auto' | Sets |
'manual' | 'manual' | 'manual' | Uses specified camera values |
CameraUpVector
— Vector defining upwards direction[0 1 0]
(default for 2-D view) | [0 0 1]
(default for 3-D view) | three-element direction vector of the form [x y z]
Vector defining upwards direction, specified as a three-element
direction vector of the form [x y z]
. For an illustration,
see Camera Graphics Terminology.
If the associated mode property is set to 'auto'
,
then MATLAB chooses the vector values. If you set this property,
then MATLAB sets the mode to 'manual'
.
Example: [sin(45) cos(45) 1]
CameraUpVectorMode
— Selection mode for CameraUpVector
'auto'
(default) | 'manual'
Selection mode for the CameraUpVector
property,
specified as one of these values:
'auto'
— Use [0
0 1]
for 3-D views so that the positive z-direction
is up. Use [0 1 0]
for 2-D views so that the positive y-direction
is up.
'manual'
— Use the manually
specified vector defining the upwards direction. To specify a value,
set the CameraUpVector
property.
CameraViewAngle
— Field of view6.6086
(default) | scalar angle in range [0,180)Field of view, specified as a scalar angle greater than 0 and less than or equal to 180. Changing the camera view angle affects the size of graphics objects displayed in the axes, but does not affect the degree of perspective distortion. The greater the angle, the larger the field of view and the smaller objects appear in the scene. For an illustration, see Camera Graphics Terminology.
If the associated mode property is set to 'auto'
,
then MATLAB chooses the field of view value. If you set this
property, then MATLAB sets the mode to 'manual'
.
Example: 15
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| logical
CameraViewAngleMode
— Selection mode for CameraViewAngle
'auto'
(default) | 'manual'
Selection mode for the CameraViewAngle
property,
specified as one of these values:
'auto'
— Select the field
of view as the minimum angle that captures the entire scene, up to
180 degrees.
'manual'
— Use the manually
specified field of view. To specify a value, set the CameraViewAngle
property.
This table summarizes the camera behavior for various combinations
of CameraViewAngleMode
, CameraTargetMode
,
and CameraPositionMode
property values.
CameraViewAngleMode | CameraTargetMode | CameraPositionMode | Behavior |
---|---|---|---|
'auto' | 'auto' | 'auto' | Sets |
'auto' | 'auto' | 'manual' | Sets |
'auto' | 'manual' | 'auto' | Sets |
'auto' | 'manual' | 'manual' | Sets |
'manual' | 'auto' | 'auto' | Sets |
'manual' | 'auto' | 'manual' | Sets |
'manual' | 'manual' | 'auto' | Sets |
'manual' | 'manual' | 'manual' | Uses specified camera values |
View
— Azimuth and elevation of view[0 90]
(default) | two-element vector of the form [azimuth elevation]
Azimuth and elevation of view, specified as a two-element vector
of the form [azimuth elevation]
defined in degree
units.
Example: ax.View = [45 45];
Type
— Type of graphics object'axes'
This property is read only.
Type of graphics object returned as 'axes'
.
Tag
— Tag to associate with axes''
(default) | character vectorUser-specified tag to associate with the axes,
specified as a character vector. Tags provide a way to identify graphics
objects. Use this property to find all objects with a specific tag
within a plotting hierarchy, for example, searching for the tag using findobj
.
Example: 'January Data'
UserData
— Data to associate with axes[]
(default) | any MATLAB dataData to associate with the axes object, specified as any MATLAB data, for example, a scalar, vector, matrix, cell array, character array, table, or structure. MATLAB does not use this data.
To associate multiple sets of data or to attach a field name
to the data, use the getappdata
and setappdata
functions.
Example: 1:100
Parent
— Parent of axesParent of axes, specified as figure object, uipanel object, or uitab object.
Children
— Children of axesGraphicsPlaceholder
array | array of graphics objectsChildren of axes, 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
of the axes. To add a child to this list, set
the Parent
property of the child graphics object
to the axes object.
HandleVisibility
— Visibility of object handle'on'
(default) | 'off'
| 'callback'
Visibility of axes object handle in the Children
property
of the parent, specified as one of these values:
'on'
— The axes object handle is always visible.
'off'
— The axes object handle is invisible at all times. This option
is useful for preventing unintended changes to the UI by another function.
Set the HandleVisibility
to 'off'
to
temporarily hide the handle during the execution of that function.
'callback'
— The axes 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 axes at
the command-line, but allows callback functions to access it.
If the axes 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.
This includes get
, findobj
, gca
, gcf
, gco
, newplot
, cla
, clf
, and close
.
Hidden object handles are still valid. Set the root ShowHiddenHandles
property
to 'on'
to list all object handles regardless of
their HandleVisibility
property setting.
CurrentPoint
— Location of mouse pointerLocation of mouse pointer, specified as a 2-by-3 array. The CurrentPoint
property
contains the coordinates of two points defined by the location of
the mouse pointer with respect to the requested axes.
The two points indicate the location of the last mouse click,
unless there is a WindowButtonMotionFcn
callback defined
for the figure. If the WindowButtonMotionFcn
callback
is defined, then the points indicate the last location of the mouse
pointer.
If the click is within the axes in orthogonal projection, then the two points lie on the line that is perpendicular to the plane of the screen and that passes through the pointer. This is true for both 2-D and 3-D views.
The 3-D coordinates are the points, in the axes coordinate system, where this line intersects the front and back surfaces of the axes volume (which is defined by the axes x, y, and z limits).
The returned matrix is of the form:
[xfront yfront zfront xback yback zback]
The first row defines the point nearest to the camera position. The second row specified the point furthest from the camera position.
If the click is outside the axes in orthogonal projection, but within the figure, the returned values are:
Back point — Point in the plane of the camera target (which is perpendicular to the viewing axis).
Front point — Point in the camera position plane (which is perpendicular to the viewing axis).
These points lie on a line that passes through the pointer and is perpendicular to the camera target and camera position planes.
The values of the current point when using perspective projection can be different from the same point in orthographic projection because the shape of the axes volume can be different.
Clicking outside of the axes volume in perspective projection returns the front point as the current camera position at all times. Only the back point updates with the coordinates of a point that lies on a line extending from the camera position through the pointer and intersecting the camera target at that point.
For related information, see the axes Projection
, CameraPosition
,
and CameraTarget
properties.
Also, see the figure CurrentPoint
properties.
ButtonDownFcn
— Mouse-click callback''
(default) | function handle | cell array | character vectorMouse-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 axes. If you specify this property using a function handle, then MATLAB passes two arguments to the callback function when executing the callback:
The axes object — You can access properties of the axes object from within the callback function.
Event data — This argument is empty for this
property. 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 Callback Definition.
Note:
If the |
Example: @myCallback
Example: {@myCallback,arg3}
UIContextMenu
— Context menuContext menu, specified as a uicontextmenu object. Use this
property to display a context menu when you right-click the axes. Create the context menu using the uicontextmenu
function.
Note:
If the |
Selected
— Selection state'off'
(default) | 'on'
Selection state, specified as one of these values:
'on'
— Selected. If you
click the axes when in plot edit mode, then MATLAB sets
its Selected
property to 'on'
.
If the SelectionHighlight
property also is set
to 'on'
, then MATLAB displays selection handles
around the axes.
'off'
— Not selected.
SelectionHighlight
— Display of selection handles when selected'on'
(default) | 'off'
Display of selection handles when selected, specified as one of these values:
'on'
— Display selection
handles when the Selected
property is set to 'on'
.
'off'
— Never display selection
handles, even when the Selected
property is set
to 'on'
.
PickableParts
— Ability to capture mouse clicks'visible'
(default) | 'all'
| 'none'
Ability to capture mouse clicks, specified as one of these values:
'visible'
— Can capture
mouse clicks only when visible. The Visible
property
must be set to 'on'
. The HitTest
property
determines if the axes responds to the click or
if an ancestor does.
'all'
— Can capture mouse
clicks regardless of visibility. The Visible
property
can be set to 'on'
or 'off'
.
The HitTest
property determines if the axes responds to the click or if an ancestor does.
'none'
— Cannot capture
mouse clicks. Clicking the axes 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 HitTest
property
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.
HitTest
— Response to captured mouse clicks'on'
(default) | 'off'
Response to captured mouse clicks, specified as one of these values:
'on'
— Trigger the ButtonDownFcn
callback
of the axes. If you have defined the UIContextMenu
property,
then invoke the context menu.
'off'
— Trigger the callbacks
for the nearest ancestor of the axes that has
a HitTest
property set to 'on'
and
a PickableParts
property value that enables the
ancestor to capture mouse clicks.
Note:
The |
Interruptible
— Callback interruption'on'
(default) | 'off'
Callback interruption, specified as 'on'
or 'off'
.
The Interruptible
property determines if a running
callback can be interrupted.
Note: There are two callback states to consider:
Whenever MATLAB invokes a callback, that callback
attempts to interrupt a running callback. The |
If the ButtonDownFcn
callback of the axes is the running callback, then the Interruptible
property
determines if it another callback can interrupt it:
'on'
— Interruptible. Interruption
occurs at the next point where MATLAB processes the queue, such
as when there is a drawnow
, figure
, getframe
, waitfor
, or pause
command.
If the running callback contains one of these commands, then MATLAB stops the execution of the callback at this point and executes the interrupting callback. MATLAB resumes executing the running callback when the interrupting callback completes. For more information, see Interrupt Callback Execution.
If the running callback does not contain one of these commands, then MATLAB finishes executing the callback without interruption.
'off'
— Not interruptible. MATLAB finishes
executing the running callback without any interruptions.
BusyAction
— Callback queuing'queue'
(default) | 'cancel'
Callback queuing specified as 'queue'
or 'cancel'
.
The BusyAction
property determines how MATLAB handles
the execution of interrupting callbacks.
Note: There are two callback states to consider:
Whenever MATLAB invokes a callback, that callback attempts
to interrupt a running callback. The |
If the ButtonDownFcn
callback of the axes tries to interrupt a running callback that cannot be
interrupted, then the BusyAction
property determines
if it is discarded or put in the queue. Specify the BusyAction
property
as one of these values:
'queue'
— Put the interrupting
callback in a queue to be processed after the running callback finishes
execution. This is the default behavior.
'cancel'
— Discard the interrupting
callback.
CreateFcn
— Creation callback''
(default) | function handle | cell array | character vectorCreation 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 create the axes. Setting the CreateFcn
property
on an existing axes has no effect. You must define
a default value for this property, or define this property using a Name,Value
pair
during axes creation. MATLAB executes the
callback after creating the axes and setting all
of its properties.
If you specify this callback using a function handle, then MATLAB passes two arguments to the callback function when executing the callback:
The axes object — You can
access properties of the axes object from within
the callback function. You also can access the axes object
through the CallbackObject
property of the root,
which can be queried using the gcbo
function.
Event data — This argument is empty for this
property. 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 Callback Definition.
Example: @myCallback
Example: {@myCallback,arg3}
DeleteFcn
— Deletion callback''
(default) | function handle | cell array | character vectorDeletion 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 delete the axes. MATLAB executes the callback before destroying the axes so that the callback can access its property values.
If you specify this callback using a function handle, then MATLAB passes two arguments to the callback function when executing the callback:
The axes object — You can
access properties of the axes object from within
the callback function. You also can access the axes object
through the CallbackObject
property of the root,
which can be queried using the gcbo
function.
Event data — This argument is empty for this
property. 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 Callback Definition.
Example: @myCallback
Example: {@myCallback,arg3}
BeingDeleted
— Deletion status of axes'off'
(default) | 'on'
This property is read only.
Deletion status of axes, returned as 'off'
or 'on'
. MATLAB sets
the BeingDeleted
property to 'on'
when
the delete function of the axes begins execution
(see the DeleteFcn
property). The BeingDeleted
property
remains set to 'on'
until the axes no
longer exists.
Check the value of the BeingDeleted
property
to verify that the axes is not about to be deleted
before querying or modifying it.