Modifying Properties
You can set and query graphics object properties in two ways:
- The Property Editor is an interactive tool that enables you to see and change object property values.
- The
set
andget
commands enable you to set and query the values of properties
To change the default value of properties see Setting Default Property Values.
Axes Property Descriptions
This section lists property names along with the types of values each accepts. Curly braces { } enclose default values.
ALim
[amin,
amax]
Alpha axis limits. A two-element vector that determines how MATLAB maps the AlphaData
values of surface, patch and image objects to the figure's alphamap. amin
is the value of the data mapped to the first alpha value in the alphamap, and amax
is the value of the data mapped to the last alpha value in the alphamap. Data values in between are linearly interpolated across the alphamap, while data values outside are clamped to either the first or last alphamap value, whichever is closest.
When ALimMode
is auto
(the default), MATLAB assigns amin
the minimum data value and amax
the maximum data value in the graphics object's AlphaData
. This maps AlphaData
elements with minimum data values to the first alphamap entry and those with maximum data values to the last alphamap entry. Data values in between are mapped linearly to the values
If the axes contains multiple graphics objects, MATLAB sets ALim
to span the range of all objects' AlphaData
(or FaceVertexAlphaData
for patch objects).
ALimMode
{auto} | manual
Alpha axis limits mode. In auto
mode, MATLAB sets the ALim
property to span the AlphaData
limits of the graphics objects displayed in the axes. If ALimMode
is manual, MATLAB does not change the value of ALim
when the AlphaData
limits of axes children change. Setting the ALim
property sets ALimMode
to manual.
AmbientLightColor
ColorSpec
The background light in a scene. Ambient light is a directionless light that shines uniformly on all objects in the axes. However, if there are no visible light objects in the axes, MATLAB does not use AmbientLightColor
. If there are light objects in the axes, the AmbientLightColor
is added to the other light sources.
AspectRatio
(Obsolete)
This property produces a warning message when queried or changed. It has been superseded by the DataAspectRatio[Mode]
and PlotBoxAspectRatio[Mode]
properties.
Box
on | {off}
Axes box mode. This property specifies whether to enclose the axes extent in a box for 2-D views or a cube for 3-D views. The default is to not display the box.
BusyAction
cancel | {queue}
Callback routine interruption. The BusyAction
property enables you to control how MATLAB handles events that potentially interrupt executing callback routines. If there is a callback routine executing, subsequently invoked callback routines always attempt to interrupt it. If the Interruptible
property of the object whose callback is executing is set to on
(the default), then interruption occurs at the next point where the event queue is processed. If the Interruptible
property is off
, the BusyAction
property (of the object owning the executing callback) determines how MATLAB handles the event. The choices are:
cancel
- discard the event that attempted to execute a second callback routine.queue
- queue the event that attempted to execute a second callback routine until the current callback finishes.
ButtonDownFcn
string or function handle
Button press callback routine. A callback routine that executes whenever you press a mouse button while the pointer is within the axes, but not over another graphics object displayed in the axes. For 3-D views, the active area is defined by a rectangle that encloses the axes.
Define this routine as a string that is a valid MATLAB expression or the name of an M-file. The expression executes in the MATLAB workspace.
See Function Handle Callbacks for information on how to use function handles to define the callback function.
CameraPosition
[x, y, z]
axes coordinates
The location of the camera. This property defines the position from which the camera views the scene. Specify the point in axes coordinates.
If you fix CameraViewAngle
, you can zoom in and out on the scene by changing the CameraPosition
, moving the camera closer to the CameraTarget
to zoom in and farther away from the CameraTarget
to zoom out. As you change the CameraPosition
, the amount of perspective also changes, if Projection
is perspective
. You can also zoom by changing the CameraViewAngle
; however, this does not change the amount of perspective in the scene.
CameraPositionMode
{auto} | manual
Auto or manual CameraPosition. When set to auto
, MATLAB automatically calculates the CameraPosition
such that the camera lies a fixed distance from the CameraTarget
along the azimuth and elevation specified by view
. Setting a value for CameraPosition
sets this property to manual.
CameraTarget
[x, y, z]
axes coordinates
Camera aiming point. This property specifies the location in the axes that the camera points to. The CameraTarget
and the CameraPosition
define the vector (the view axis) along which the camera looks.
CameraTargetMode
{auto} | manual
Auto or manual CameraTarget placement. When this property is auto
, MATLAB automatically positions the CameraTarget
at the centroid of the axes plotbox. Specifying a value for CameraTarget
sets this property to manual
.
CameraUpVector
[x, y, z]
axes coordinates
Camera rotation. This property specifies the rotation of the camera around the viewing axis defined by the CameraTarget
and the CameraPosition
properties. Specify CameraUpVector
as a three-element array containing the x, y, and z components of the vector. For example, [0 1 0]
specifies the positive y-axis as the up direction.
The default CameraUpVector
is [0 0 1]
, which defines the positive z-axis as the up direction.
CameraUpVectorMode
auto} | manual
Default or user-specified up vector. When CameraUpVectorMode
is auto
, MATLAB uses a value of [0 0 1]
(positive z-direction is up) for 3-D views and [0 1 0]
(positive y-direction is up) for 2-D views. Setting a value for CameraUpVector
sets this property to manual
.
CameraViewAngle
scalar greater than 0 and less than or equal to
180 (angle in degrees)
The field of view. This property determines the camera field of view. Changing this value 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.
CameraViewAngleMode
{auto} | manual
Auto or manual CameraViewAngle. When in auto
mode, MATLAB sets CameraViewAngle
to the minimum angle that captures the entire scene (up to 180°).
The following table summarizes MATLAB automatic camera behavior.
Children
vector of graphics object handles
Children of the axes. A vector containing the handles of all graphics objects rendered within the axes (whether visible or not). The graphics objects that can be children of axes are images, lights, lines, patches, surfaces, and text. You can change the order of the handles and thereby change the stacking of the objects on the display.
The text objects used to label the x-, y-, and z-axes are also children of axes, but their HandleVisibility
properties are set to callback
. This means their handles do not show up in the axes Children
property unless you set the Root ShowHiddenHandles
property to on
.
CLim
[cmin, cmax]
Color axis limits. A two-element vector that determines how MATLAB maps the CData
values of surface and patch objects to the figure's colormap. cmin
is the value of the data mapped to the first color in the colormap, and cmax
is the value of the data mapped to the last color in the colormap. Data values in between are linearly interpolated across the colormap, while data values outside are clamped to either the first or last colormap color, whichever is closest.
When CLimMode
is auto
(the default), MATLAB assigns cmin
the minimum data value and cmax
the maximum data value in the graphics object's CData
. This maps CData
elements with minimum data value to the first colormap entry and with maximum data value to the last colormap entry.
If the axes contains multiple graphics objects, MATLAB sets CLim
to span the range of all objects' CData
.
CLimMode
{auto} | manual
Color axis limits mode. In auto
mode, MATLAB sets the CLim
property to span the CData
limits of the graphics objects displayed in the axes. If CLimMode
is manual
, MATLAB does not change the value of CLim
when the CData
limits of axes children change. Setting the CLim
property sets this property to manual
.
Clipping
{on} | off
This property has no effect on axes.
Color
{none}
|
ColorSpec
Color of the axes back planes. Setting this property to none
means the axes is transparent and the figure color shows through. A ColorSpec
is a three-element RGB vector or one of the MATLAB predefined names. Note that while the default value is none
, the matlabrc.m
file may set the axes color
to a specific color.
ColorOrder
m-by-3 matrix of RGB values
Colors to use for multiline plots. ColorOrder
is an m-by-3 matrix of RGB values that define the colors used by the plot
and plot3
functions to color each line plotted. If you do not specify a line color with plot
and plot3
, these functions cycle through the ColorOrder
to obtain the color for each line plotted. To obtain the current ColorOrder
, which may be set during startup, get the property value:
Note that if the axes NextPlot
property is set to replace
(the default), high-level functions like plot
reset the ColorOrder
property before determining the colors to use. If you want MATLAB to use a ColorOrder
that is different from the default, set NextPlot
to replacechildren
. You can also specify your own default ColorOrder
.
CreateFcn
string or function handle
Callback routine executed during object creation. This property defines a callback routine that executes when MATLAB creates an axes object. You must define this property as a default value for axes. For example, the statement,
defines a default value on the Root level that sets the current axes' background color to blue whenever you (or MATLAB) create an axes. MATLAB executes this routine after setting all properties for the axes. Setting this property on an existing axes object has no effect.
The handle of the object whose CreateFcn
is being executed is accessible only through the Root CallbackObject
property, which can be queried using gcbo
.
See Function Handle Callbacks for information on how to use function handles to define the callback function.
CurrentPoint
2-by-3 matrix
Location of last button click, in axes data units. A 2-by-3 matrix containing the coordinates of two points defined by the location of the pointer. These two points lie on the line that is perpendicular to the plane of the screen and passes through the pointer. 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:
MATLAB updates the CurrentPoint
property whenever a button-click event occurs. The pointer does not have to be within the axes, or even the figure window; MATLAB returns the coordinates with respect to the requested axes regardless of the pointer location.
DataAspectRatio
[dx dy dz]
Relative scaling of data units. A three-element vector controlling the relative scaling of data units in the x, y, and z directions. For example, setting this property t o [1 2 1]
causes 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.
Note that the DataAspectRatio
property interacts with the PlotBoxAspectRatio
, XLimMode
, YLimMode
, and ZLimMode
properties to control how MATLAB scales the x-, y-, and z-axis. Setting the DataAspectRatio
will disable the stretch-to-fill behavior, if DataAspectRatioMode
, PlotBoxAspectRatioMode
, and CameraViewAngleMode
are all auto
. The following table describes the interaction between properties when stretch-to-fill
behavior is disabled.
DataAspectRatioMode
{auto} | manual
User or MATLAB controlled data scaling. This property controls whether the values of the DataAspectRatio
property are user defined or selected automatically by MATLAB. Setting values for the DataAspectRatio
property automatically sets this property to manual
. Changing DataAspectRatioMode
to manual
disables the stretch-to-fill behavior, if DataAspectRatioMode
, PlotBoxAspectRatioMode
, and CameraViewAngleMode
are all auto.
DeleteFcn
string or function handle
Delete axes callback routine. A callback routine that executes when the axes object is deleted (e.g., when you issue a delete
or a close
command). MATLAB executes the routine before destroying the object's properties so the callback routine can query these values.
The handle of the object whose DeleteFcn
is being executed is accessible only through the Root CallbackObject
property, which can be queried using gcbo
.
See Function Handle Callbacks for information on how to use function handles to define the callback function.
DrawMode
{normal} | fast
Rendering method. This property controls the method MATLAB uses to render graphics objects displayed in the axes, when the figure Renderer
property is painters
.
normal
mode draws objects in back to front ordering based on the current view in order to handle hidden surface elimination and object intersections.fast
mode draws objects in the order in which you specify the drawing commands, without considering the relationships of the objects in three dimensions. This results in faster rendering because it requires no sorting of objects according to location in the view, but may produce undesirable results because it bypasses the hidden surface elimination and object intersection handling provided bynormal
DrawMode
.
When the figure Renderer
is zbuffer
, DrawMode
is ignored, and hidden surface elimination and object intersection handling are always provided.
FontAngle
{normal} | italic | oblique
Select italic or normal font. This property selects the character slant for axes text. normal
specifies a nonitalic font. italic
and oblique
specify italic font.
FontName
A name such as Courier
or the string FixedWidth
Font family name. The font family name specifying the font to use for axes labels. To display and print properly, FontName
must be a font that your system supports. Note that the x-, y-, and z-axis labels do not display in a new font until you manually reset them (by setting the XLabel
, YLabel
, and ZLabel
properties or by using the xlabel
, ylabel
, or zlabel
command). Tick mark labels change immediately.
Specifying a Fixed-Width Font
If you want an axes to use a fixed-width font that looks good in any locale, you should set FontName
to the string FixedWidth
:
This eliminates the need to hardcode the name of a fixed-width font, which may not display text properly on systems that do not use ASCII character encoding (such as in Japan where multibyte character sets are used). A properly written MATLAB application that needs to use a fixed-width font should set FontName
to FixedWidth
(note that this string is case sensitive) and rely on FixedWidthFontName
to be set correctly in the end-user's environment.
End users can adapt a MATLAB application to different locales or personal environments by setting the root FixedWidthFontName
property to the appropriate value for that locale from startup.m
.
Note that setting the root FixedWidthFontName
property causes an immediate update of the display to use the new font.
FontSize
Font size specified in FontUnits
Font size. An integer specifying the font size to use for axes labels and titles, in units determined by the FontUnits
property. The default point size is 12. The x-, y-, and z-axis text labels do not display in a new font size until you manually reset them (by setting the XLabel
, YLabel
, or ZLabel
properties or by using the xlabel
, ylabel
, or zlabel
command). Tick mark labels change immediately.
FontUnits
{points} | normalized | inches |
centimeters |
pixels
Units used to interpret the FontSize
property. When set to normalized
, MATLAB interprets the value of FontSize
as a fraction of the height of the axes. For example, a normalized
FontSize
of 0.1 sets the text characters to a font whose height is one tenth of the axes' height. The default units (points
), are equal to 1/72 of an inch.
FontWeight
{normal} | bold | light | demi
Select bold or normal font. The character weight for axes text. The x-, y-, and z-axis text labels do not display in bold until you manually reset them (by setting the XLabel
, YLabel
, and ZLabel
properties or by using the xlabel
, ylabel
, or zlabel
commands). Tick mark labels change immediately.
GridLineStyle
- |
- -|
{:}
|
-. |
none
Line style used to draw grid lines. The line style is a string consisting of a character, in quotes, specifying solid lines (-), dashed lines (--), dotted lines(:
), or dash-dot lines (-.). The default grid line style is dotted. To turn on grid lines, use the grid
command.
HandleVisibility
{on} | callback | off
Control access to object's handle by command-line users and GUIs. This property determines when an object's handle is visible in its parent's list of children. HandleVisibility
is useful for preventing command-line users from accidentally drawing into or deleting a figure that contains only user interface devices (such as a dialog box).
Handles are always visible when HandleVisibility
is on
.
Setting HandleVisibility
to callback
causes handles to be visible from within callback routines or functions invoked by callback routines, but not from within functions invoked from the command line. This provides a means to protect GUIs from command-line users, while allowing callback routines to have complete access to object handles.
Setting HandleVisibility
to off
makes handles invisible at all times. This may be necessary when a callback routine invokes a function that might potentially damage the GUI (such as evaluating a user-typed string) and so temporarily hides its own handles during the execution of that function.
When a handle is not visible in its parent's list of children, it cannot be returned by functions that obtain handles by searching the object hierarchy or querying handle properties. This includes get
, findobj
, gca
, gcf
, gco
, newplot
, cla
, clf
, and close
.
When a handle's visibility is restricted using callback
or off
, the object's handle does not appear in its parent's Children
property, figures do not appear in the Root's Currentfigure
property, objects do not appear in the Root's CallbackObject
property or in the figure's CurrentObject
property, and axes do not appear in their parent's Currentaxes
property.
You can set the Root ShowHiddenHandles
property to on to make all handles visible, regardless of their HandleVisibility
settings (this does not affect the values of the HandleVisibility
properties).
Handles that are hidden are still valid. If you know an object's handle, you can set
and get
its properties, and pass it to any function that operates on handles.
HitTest
{on} | off
Selectable by mouse click. HitTest
determines if the axes can become the current object (as returned by the gco
command and the figure CurrentObject
property) as a result of a mouse click on the axes. If HitTest
is off
, clicking on the axes selects the object below it (which is usually the figure containing it).
Interruptible
{on} | off
Callback routine interruption mode. The Interruptible
property controls whether an axes callback routine can be interrupted by subsequently invoked callback routines. Only callback routines defined for the ButtonDownFcn
are affected by the Interruptible
property. MATLAB checks for events that can interrupt a callback routine only when it encounters a drawnow
, figure
, getframe
, or pause
command in the routine. See the BusyAction
property for related information.
Setting Interruptible
to on
allows any graphics object's callback routine to interrupt callback routines originating from an axes property. Note that MATLAB does not save the state of variables or the display (e.g., the handle returned by the gca
or gcf
command) when an interruption occurs.
Layer
{bottom} | top
Draw axis lines below or above graphics objects. This property determines if axis lines and tick marks draw on top or below axes children objects for any 2-D view (i.e., when you are looking along the x-, y-, or z-axis). This is useful for placing grid lines and tick marks on top of images.
LineStyleOrder
LineSpec
Order of line styles and markers used in a plot. This property specifies which line styles and markers to use and in what order when creating multiple-line plots. For example,
sets LineStyleOrder
to solid line with asterisk marker, dotted line, and hollow circle marker. The default is (-), which specifies a solid line for all data plotted. Alternatively, you can create a cell array of character strings to define the line styles:
MATLAB supports four line styles, which you can specify any number of times in any order. MATLAB cycles through the line styles only after using all colors defined by the ColorOrder
property. For example, the first eight lines plotted use the different colors defined by ColorOrder
with the first line style. MATLAB then cycles through the colors again, using the second line style specified, and so on.
You can also specify line style and color directly with the plot
and plot3
functions or by altering the properties of the line objects.
Note that, if the axes NextPlot
property is set to replace
(the default), high-level functions like plot
reset the LineStyleOrder
property before determining the line style to use. If you want MATLAB to use a LineStyleOrder
that is different from the default, set NextPlot
to replacechildren
. You can also specify your own default LineStyleOrder
.
LineWidth
linewidth in points
Width of axis lines. This property specifies the width, in points, of the x-, y-, and z-axis lines. The default line width is 0.5 points (1 point = 1/72 inch).
MinorGridLineStyle
- |
- -|
{:}
|
-. |
none
Line style used to draw minor grid lines. The line style is a string consisting of one or more characters, in quotes, specifying solid lines (-), dashed lines (--), dotted lines(:
), or dash-dot lines (-.). The default minor grid line style is dotted. To turn on minor grid lines, use the grid
minor
command.
NextPlot
add
|
{replace} | replacechildren
Where to draw the next plot. This property determines how high-level plotting functions draw into an existing axes.
add
-- use the existing axes to draw graphics objects.replace
-- reset all axes properties, exceptPosition
, to their defaults and delete all axes children before displaying graphics (equivalent tocla
reset
).replacechildren
-- remove all child objects, but do not reset axes properties (equivalent tocla
).
The newplot
function simplifies the use of the NextPlot
property and is used by M-file functions that draw graphs using only low-level object creation routines. See the M-file pcolor
.m
for an example. Note that figure graphics objects also have a NextPlot
property.
Parent
figure handle
Axes parent. The handle of the axes' parent object. The parent of an axes object is the figure in which it is displayed. The utility function gcf
returns the handle of the current axes' Parent
. You can reparent axes to other figure objects.
PlotBoxAspectRatio
[px py pz]
Relative scaling of axes plotbox. A three-element vector controlling the relative scaling of the plot box in the x-, y-, and z-directions. The plot box is a box enclosing the axes data region as defined by the x-, y-, and z-axis limits.
Note that the PlotBoxAspectRatio
property interacts with the DataAspectRatio
, XLimMode
, YLimMode
, and ZLimMode
properties to control the way graphics objects are displayed in the axes. Setting the PlotBoxAspectRatio
disables stretch-to-fill behavior, if DataAspectRatioMode
, PlotBoxAspectRatioMode
, and CameraViewAngleMode
are all auto
.
PlotBoxAspectRatioMode
{auto} | manual
User or MATLAB controlled axis scaling. This property controls whether the values of the PlotBoxAspectRatio
property are user defined or selected automatically by MATLAB. Setting values for the PlotBoxAspectRatio
property automatically sets this property to manual
. Changing the PlotBoxAspectRatioMode
to manual
disables stretch-to-fill behavior, if DataAspectRatioMode
, PlotBoxAspectRatioMode
, and CameraViewAngleMode
are all auto
.
Position
four-element vector
Position of axes. A four-element vector specifying a rectangle that locates the axes within the figure window. The vector is of the form:
where left
and bottom
define the distance from the lower-left corner of the figure window to the lower-left corner of the rectangle. width
and height
are the dimensions of the rectangle. All measurements are in units specified by the Units
property.
When axes stretch-to-fill behavior is enabled (when DataAspectRatioMode
, PlotBoxAspectRatioMode
, CameraViewAngleMode
are all auto
), the axes are stretched to fill the Position
rectangle. When stretch-to-fill is disabled, the axes are made as large as possible, while obeying all other properties, without extending outside the Position
rectangle
Projection
{orthographic} | perspective
Type of projection. This property selects between two projection types:
orthographic
- This projection maintains the correct relative dimensions of graphics objects with regard to the distance a given point is from the viewer. Parallel lines in the data are drawn parallel on the screen.perspective
- This projection incorporates 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; a distant line segment displays smaller than a nearer line segment of the same length. Parallel lines in the data may not appear parallel on screen.
Selected
on | off
Is object selected. When you set this property to on
, MATLAB displays selection "handles" at the corners and midpoints if the SelectionHighlight
property is also on
(the default). You can, for example, define the ButtonDownFcn
callback routine to set this property to on
, thereby indicating that the axes has been selected.
SelectionHighlight
{on} | off
Objects highlight when selected. When the Selected
property is on
, MATLAB indicates the selected state by drawing four edge handles and four corner handles. When SelectionHighlight
is off
, MATLAB does not draw the handles.
Tag
string (GUIDE sets this property)
User-specified object label. The Tag
property provides a means to identify graphics objects with a user-specified label. This is particularly useful when constructing interactive graphics programs that would otherwise need to define object handles as global variables or pass them as arguments between callback routines.
For example, suppose you want to direct all graphics output from an M-file to a particular axes, regardless of user actions that may have changed the current axes. To do this, identify the axes with a Tag
:
Then make that axes the current axes before drawing by searching for the Tag
with findobj
:
TickDir
in | out
Direction of tick marks. For 2-D views, the default is to direct tick marks inward from the axis lines; 3-D views direct tick marks outward from the axis line.
TickDirMode
{auto} | manual
Automatic tick direction control. In auto
mode, MATLAB directs tick marks inward for 2-D views and outward for 3-D views. When you specify a setting for TickDir
, MATLAB sets TickDirMode
to manual
. In manual
mode, MATLAB does not change the specified tick direction.
TickLength
[2DLength 3DLength]
Length of tick marks. A two-element vector specifying the length of axes tick marks. The first element is the length of tick marks used for 2-D views and the second element is the length of tick marks used for 3-D views. Specify tick mark lengths in units normalized relative to the longest of the visible X-, Y-, or Z-axis annotation lines.
Title
handle of text object
Axes title. The handle of the text object that is used for the axes title. You can use this handle to change the properties of the title text or you can set Title
to the handle of an existing text object. For example, the following statement changes the color of the current title to red:
To create a new title, set this property to the handle of the text object you want to use:
However, it is generally simpler to use the title
command to create or replace an axes title:
Type
string (read only)
Type of graphics object. This property contains a string that identifies the class of graphics object. For axes objects, Type
is always set to 'axes
'.
UIContextMenu
handle of a uicontextmenu object
Associate a context menu with the axes. Assign this property the handle of a Uicontextmenu object created in the axes' parent figure. Use the uicontextmenu
function to create the context menu. MATLAB displays the context menu whenever you right-click over the axes.
Units
inches
|
centimeters
|
{normalized}
|
points
|
pixels | characters
Position units. The units used to interpret the Position
property. All units are measured from the lower-left corner of the figure window.
normalized
units map the lower-left corner of the figure window to (0,0) and the upper-right corner to (1.0, 1.0).inches
,centimeters
, andpoints
are absolute units (one point equals 1/72 of an inch).Character
units are defined by characters from the default system font; the width of one character is the width of the letter x, the height of one character is the distance between the baselines of two lines of text.
UserData
matrix
User specified data. This property can be any data you want to associate with the axes object. The axes does not use this property, but you can access it using the set
and get
functions.
View
Obsolete
The functionality provided by the View property is now controlled by the axes camera properties - CameraPosition
, CameraTarget
, CameraUpVector
, and CameraViewAngle
. See the view
command.
Visible
{on} | off
Visibility of axes. By default, axes are visible. Setting this property to off
prevents axis lines, tick marks, and labels from being displayed. The visible property does not affect children of axes.
XAxisLocation
top | {bottom}
Location of x-axis tick marks and labels. This property controls where MATLAB displays the x-axis tick marks and labels. Setting this property to top
moves the x-axis to the top of the plot from its default position at the bottom.
YAxisLocation
right | {left}
Location of y-axis tick marks and labels. This property controls where MATLAB displays the y-axis tick marks and labels. Setting this property to right
moves the y-axis to the right side of the plot from its default position on the left side. See the plotyy
function for a simple way to use two y-axes.
Properties That Control the X-, Y-, or Z-Axis XColor, YColor, ZColor
ColorSpec
Color of axis lines. A three-element vector specifying an RGB triple, or a predefined MATLAB color string. This property determines the color of the axis lines, tick marks, tick mark labels, and the axis grid lines of the respective x-, y-, and z-axis. The default color axis color is black. See ColorSpec
for details on specifying colors.
XDir
, YDir
, ZDir
{normal} | reverse
Direction of increasing values. A mode controlling the direction of increasing axis values. axes form a right-hand coordinate system. By default:
- x-axis values increase from left to right. To reverse the direction of increasing x values, set this property to
reverse
.
- y-axis values increase from bottom to top (2-D view) or front to back (3-D view). To reverse the direction of increasing y values, set this property to
reverse
.
- z-axis values increase pointing out of the screen (2-D view) or from bottom to top (3-D view). To reverse the direction of increasing z values, set this property to
reverse
.
XGrid
, YGrid
, ZGrid
on | {off}
Axis gridline mode. When you set any of these properties to on
, MATLAB draws grid lines perpendicular to the respective axis (i.e., along lines of constant x, y, or z values). Use the grid
command to set all three properties on
or off
at once.
XLabel
, YLabel
, ZLabel
handle of text object
Axis labels. The handle of the text object used to label the x, y, or z-axis, respectively. To assign values to any of these properties, you must obtain the handle to the text string you want to use as a label. This statement defines a text object and assigns its handle to the XLabel
property:
MATLAB places the string 'axis label'
appropriately for an x-axis label. Any text object whose handle you specify as an XLabel
, YLabel
, or ZLabel
property is moved to the appropriate location for the respective label.
Alternatively, you can use the xlabel
, ylabel
, and zlabel
functions, which generally provide a simpler means to label axis lines.
XLim
, YLim
, ZLim
[minimum maximum]
Axis limits. A two-element vector specifying the minimum and maximum values of the respective axis.
Changing these properties affects the scale of the x-, y-, or z-dimension as well as the placement of labels and tick marks on the axis. The default values for these properties are [0 1].
XLimMode
, YLimMode
, ZLimMode
{auto} | manual
MATLAB or user-controlled limits. The axis limits mode determines whether MATLAB calculates axis limits based on the data plotted (i.e., the XData
, YData
, or ZData
of the axes children) or uses the values explicitly set with the XLim
, YLim
, or ZLim
property, in which case, the respective limits mode is set to manual
.
XMinorGrid, YMinorGrid, ZMinorGrid
on
| {
off
}
Enable or disable minor gridlines. When set to on
, MATLAB draws gridlines aligned with the minor tick marks of the respective axis. Note that you do not have to enable minor ticks to display minor grids.
XMinorTick, YMinorTick, ZMinorTick
on
| {
off
}
Enable or disable minor tick marks. When set to on
, MATLAB draws tick marks between the major tick marks of the respective axis. MATLAB automaticaly determines the number of minor ticks based on the space between the major ticks.
XScale, YScale, ZScale
{linear} | log
Axis scaling. Linear or logarithmic scaling for the respective axis. See also loglog
, semilogx
, and semilogy
.
XTick, YTick, ZTick
vector of data values locating tick marks
Tick spacing. A vector of x-, y-, or z-data values that determine the location of tick marks along the respective axis. If you do not want tick marks displayed, set the respective property to the empty vector, [ ]. These vectors must contain monotonically increasing values.
XTickLabel, YTickLabel, ZTickLabel
string
Tick labels. A matrix of strings to use as labels for tick marks along the respective axis. These labels replace the numeric labels generated by MATLAB. If you do not specify enough text labels for all the tick marks, MATLAB uses all of the labels specified, then reuses the specified labels.
labels the first four tick marks on the x-axis and then reuses the labels until all ticks are labeled.
Labels can be specified as cell arrays of strings, padded string matrices, string vectors separated by vertical slash characters, or as numeric vectors (where each number is implicitly converted to the equivalent string using num2str
). All of the following are equivalent:
set(gca,'XTickLabel',{'1';'10';'100'})
set(gca,'XTickLabel','1|10|100')
set(gca,'XTickLabel',[1;10;100])
set(gca,'XTickLabel',['1 ';'10 ';'100'])
Note that tick labels do not interpret TeX character sequences (however, the Title
, XLabel
, YLabel
, and ZLabel
properties do).
XTickMode, YTickMode, ZTickMode
{auto} | manual
MATLAB or user controlled tick spacing. The axis tick modes determine whether MATLAB calculates the tick mark spacing based on the range of data for the respective axis (auto
mode) or uses the values explicitly set for any of the XTick
, YTick
, and ZTick
properties (manual
mode). Setting values for the XTick
, YTick
, or ZTick
properties sets the respective axis tick mode to manual
.
XTickLabelMode, YTickLabelMode, ZTickLabelMode
{auto} | manual
MATLAB or user determined tick labels. The axis tick mark labeling mode determines whether MATLAB uses numeric tick mark labels that span the range of the plotted data (auto
mode) or uses the tick mark labels specified with the XTickLabel
, YTickLabel
, or ZTickLabel
property (manual
mode). Setting values for the XTickLabel
, YTickLabel
, or ZTickLabel
property sets the respective axis tick label mode to manual
.
No comments:
Post a Comment