ColorSpec is not a function; it refers to the three
ways in which you specify color for MATLAB graphics:
RGB triple
Short name
Long name
The short names and long names are MATLAB strings that specify
one of eight predefined colors. The RGB triple 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]. The following table lists the predefined colors
and their RGB equivalents.
RGB Value
Short Name
Long Name
[1 1 0]
y
yellow
[1 0 1]
m
magenta
[0 1 1]
c
cyan
[1 0 0]
r
red
[0 1 0]
g
green
[0 0 1]
b
blue
[1 1 1]
w
white
[0 0 0]
k
black
LineStyle
{-} | -- | : | -. | none
Line style. This property specifies the
line style of the object. Available line styles are shown in the
following table.
Specifier String
Line Style
-
Solid line (default)
--
Dashed line
:
Dotted line
-.
Dash-dot line
none
No line
You can use LineStyle none when you want to
place a marker at each point but do not want the points connected
with a line (see the Marker property).
LineWidth
scalar
The width of linear objects and edges of filled
areas. Specify this value in points (1 point =
1/72 inch). The default LineWidth is
0.5 points.
Marker
character (see table)
Marker symbol. The Marker
property specifies the type of markers that are displayed at plot
vertices. You can set values for the Marker property
independently from the LineStyle property. Supported
markers include those shown in the following table.
Marker Specifier
Description
+
Plus sign
o
Circle
*
Asterisk
.
Point
x
Cross
s
Square
d
Diamond
^
Upward-pointing triangle
v
Downward-pointing triangle
>
Right-pointing triangle
<
Left-pointing triangle
p
Five-pointed star (pentagram)
h
Six-pointed star (hexagram)
none
No marker (default)
MarkerEdgeColor
ColorSpec | none | {auto}
Marker edge color. The color of the marker
or the edge color for filled markers (circle, square, diamond,
pentagram, hexagram, and the four triangles). ColorSpec defines the color to use. none
specifies no color, which makes nonfilled markers invisible.
auto sets MarkerEdgeColor to the same color as
the Color property.
MarkerFaceColor
ColorSpec | {none} | auto
Marker face color. The fill color for
markers that are closed shapes (circle, square, diamond, pentagram,
hexagram, and the four triangles). ColorSpec defines the
color to use. none makes the interior of the marker
transparent, allowing the background to show through. auto sets the fill color to the axes
color, or to the figure color if the axes Color property is set to none
(which is the factory default for axes objects).
MarkerSize
size in points
Marker size. A scalar specifying the size
of the marker in points. The default value for MarkerSize
is 6 points (1 point = 1/72 inch). Note that MATLAB draws the point
marker (specified by the '.' symbol) at one-third the
specified size.
Parent
handle of parent axes, hggroup, or hgtransform
Parent of this object. This property
contains the handle of the object's parent. The parent is normally
the axes, hggroup, or hgtransform object that contains the
object.
See Objects That Can Contain Other Objects for more information on
parenting graphics objects.
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 to set this property to
on, thereby indicating that this particular object is
selected. This property is also set to on when an object
is manually selected in plot edit mode.
SelectionHighlight
{on} | off
Objects are highlighted 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 except when in plot edit mode and
objects are selected manually.
Tag
string
User-specified object label. The
Tag property provides a means to identify graphics objects
with a user-specified label. This is particularly useful when you
are constructing interactive graphics programs that would otherwise
need to define object handles as global variables or pass them as
arguments between callbacks. You can define Tag as any
string.
For example, you might create an areaseries object and set the
Tag property.
t = area(Y,'Tag','area1')
When you want to access objects of a given type, you can use
findobj to find the object's handle. The following
statement changes the FaceColor property of the object
whose Tag is area1.
set(findobj('Tag','area1'),'FaceColor','red')
Type
string (read only)
Class of graphics object. For lineseries
objects, Type is always the string line.
UIContextMenu
handle of a uicontextmenu object
Associate a context menu with this object.
Assign this property the handle of a uicontextmenu object created
in the object's parent figure. Use the uicontextmenu function to create the context menu.
MATLAB displays the context menu whenever you right-click over the
object.
UserData
array
User-specified data. This property can be
any data you want to associate with this object (including cell
arrays and structures). The object does not set values for this
property, but you can access it using the set and get functions.
Visible
{on} | off
Visibility of this object and its
children. By default, a new object's visibility is
on. This means all children of the object are visible
unless the child object's Visible property is set to
off. Setting an object's Visible property to
off prevents the object from being displayed. However, the
object still exists and you can set and query its properties.
XData
vector or matrix
The x-axis values for a graph. The
x-axis values for graphs are specified by the
X input argument. If XData is a vector,
length(XData) must equal length(YData) and must
be monotonic. If XData is a matrix, size(XData)
must equal size(YData) and each column must be
monotonic.
You can use XData to define meaningful coordinates for
an underlying surface whose topography is being mapped. See
Changing the Offset of a Contour for more information.
XDataMode
{auto} | manual
Use automatic or user-specified x-axis
values. If you specify XData (by setting the
XData property or specifying the x input
argument), MATLAB sets this property to manual and uses
the specified values to label the x-axis.
If you set XDataMode to auto after having
specified XData, MATLAB resets the
x-axis ticks to 1:size(YData,1) or
to the column indices of the ZData, overwriting any
previous values for XData.
XDataSource
string (MATLAB variable)
Link XData to
MATLAB variable. Set this property to a MATLAB variable
that is evaluated in the base workspace to generate the
XData.
MATLAB reevaluates this property only when you set it.
Therefore, a change to workspace variables appearing in an
expression does not change XData.
You can use the refreshdata function to force an update
of the object's data. refreshdata also enables you to
specify that the data source variable be evaluated in the workspace
of a function from which you call refreshdata.
See the refreshdata reference page for more information.
Note If you change
one data source property to a variable that contains data of a
different dimension, you might cause the function to generate a
warning and not render the graph until you have changed all data
source properties to appropriate values.
YData
vector or matrix of coordinates
Y-coordinates. A vector of
y-coordinates defining the values along the
y-axis for the graph. XData and
ZData must be the same length and have the same number of
rows.
YDataSource
string (MATLAB variable)
Link YData to
MATLAB variable. Set this property to a MATLAB variable
that is evaluated in the base workspace to generate the
YData.
MATLAB reevaluates this property only when you set it.
Therefore, a change to workspace variables appearing in an
expression does not change YData.
You can use the refreshdata function to force an update
of the object's data. refreshdata also enables you to
specify that the data source variable be evaluated in the workspace
of a function from which you call refreshdata.
See the refreshdata reference page for more information.
Note If you change
one data source property to a variable that contains data of a
different dimension, you might cause the function to generate a
warning and not render the graph until you have changed all data
source properties to appropriate values.
ZData
vector of coordinates
Z-coordinates. A vector defining the
z-coordinates for the graph. XData
and YData must be the same length and have the same number
of rows.
ZDataSource
string (MATLAB variable)
Link ZData to
MATLAB variable. Set this property to a MATLAB variable
that is evaluated in the base workspace to generate the
ZData.
MATLAB reevaluates this property only when you set it.
Therefore, a change to workspace variables appearing in an
expression does not change ZData.
You can use the refreshdata function to force an update
of the object's data. refreshdata also enables you to
specify that the data source variable be evaluated in the workspace
of a function from which you call refreshdata.
See the refreshdata reference page for more information.
Note If you change
one data source property to a variable that contains data of a
different dimension, you might cause the function to generate a
warning and not render the graph until you have changed all data
source properties to appropriate values.