Scatter - Scatter chart appearance and behavior - MATLAB (original) (raw)
Scatter Properties
Scatter chart appearance and behavior
Scatter
properties control the appearance and behavior of Scatter
object. By changing property values, you can modify certain aspects of the scatter chart. Use dot notation to query and set properties.
s = scatter(1:10,1:10); m = s.Marker; s.Marker = '*';
Markers
Marker symbol, specified as one of the options listed in this table:
Marker | Description | Resulting Marker |
---|---|---|
"o" | Circle | ![]() |
"+" | Plus sign | ![]() |
"*" | Asterisk | ![]() |
"." | Point | ![]() |
"x" | Cross | ![]() |
"_" | Horizontal line | ![]() |
"|" | Vertical line | ![]() |
"square" | Square | ![]() |
"diamond" | Diamond | ![]() |
"^" | Upward-pointing triangle | ![]() |
"v" | Downward-pointing triangle | ![]() |
">" | Right-pointing triangle | ![]() |
"<" | Left-pointing triangle | ![]() |
"pentagram" | Pentagram | ![]() |
"hexagram" | Hexagram | ![]() |
"none" | No markers | Not applicable |
Marker edge transparency, specified as a scalar in the range [0,1]
or 'flat'
. A value of 1 is opaque and 0 is completely transparent. Values between 0 and 1 are semitransparent.
To set the edge transparency to a different value for each point in the plot, set theAlphaData
property to a vector the same size as theXData
property, and set theMarkerEdgeAlpha
property to 'flat'
.
Marker face transparency, specified as a scalar in the range[0,1]
or 'flat'
. A value of 1 is opaque and 0 is completely transparent. Values between 0 and 1 are semitransparent.
To set the marker face transparency to a different value for each point in the plot, set the AlphaData
property to a vector the same size as the XData
property, and set theMarkerFaceAlpha
property to'flat'
.
Transparency data for each plotted point, specified as an array the same size as theXData
property. After specifying the values, set theMarkerFaceAlpha
and MarkerEdgeAlpha
properties to control the type of transparency. If theMarkerFaceAlpha
and MarkerEdgeAlpha
properties are both set to scalar values, then the Scatter
object does not use the AlphaData
values.
The AlphaDataMapping
property determines how theScatter
object interprets the AlphaData
property values.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| logical
Control how the AlphaData
property is set, specified as one of these values:
'auto'
— MATLAB® controls the value of theAlphaData
property. The value can be:- The default value of the
AlphaData
property. - The values in a table variable. The
SourceTable
property specifies the table, and theAlphaVariable
property specifies the variable. If either theSourceTable
orAlphaVariable
properties are empty, the defaultAlphaData
value is used.
- The default value of the
'manual'
— TheAlphaData
property is set directly and does not update automatically.
Color and Size Data
Marker colors, specified as one of these values:
- RGB triplet — Use the same color for all the markers in the plot. 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.5 0.6 0.7]
. - Three-column matrix of RGB triplets — Use a different color for each marker in the plot. Each row of the matrix defines one color. The number of rows must equal the number of markers.
- Vector — Use a different color for each marker in the plot. Specify
CData
as a vector the same length asXData
. Linearly map the values in the vector to the colors in the current colormap.
Example: [1 0 0; 0 1 0; 0 0 1]
Control how the CData
property is set, specified as one of these values:
'auto'
— MATLAB controls the value of theCData
property. The value can be:- One of the colors from the
ColorOrder
property of the axes. MATLAB uses theSeriesIndex
property of theScatter
object and theColorOrder
property of the axes to select a color. This is the default behavior. - The values in a table variable. The
SourceTable
property specifies the table, and theColorVariable
property specifies the variable. If either of these properties are empty, then the color data comes from theColorOrder
property of the axes.
- One of the colors from the
'manual'
— You control the value of theCData
property manually, either by specifying a color when you call a plotting function or by setting theCData
property on theScatter
object after plotting.
Variable linked to CData
, specified as a character vector or string containing a MATLAB workspace variable. MATLAB evaluates the variable in the base workspace to generate theCData
.
By default, there is no linked variable so the value is an empty character vector. If you link a variable, then MATLAB does not update the CData
values immediately. To force an update of the data values, use the refreshdata function.
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.
Series index, specified as a positive whole number or "none"
. This property is useful for reassigning the marker colors of Scatter
objects so that they match the colors of other objects. By default, theSeriesIndex
property is a number that corresponds to the object's order of creation, starting at 1
.
MATLAB uses the number to calculate indices for assigning colors when you call plotting functions. The indices refer to the rows of the arrays stored in theColorOrder
property of the axes. The marker colors change when you change the Scatter
object's SeriesIndex
value, or when you change ColorOrder
property of the axes.
A SeriesIndex
value of"none"
corresponds to a neutral color that does not participate in the indexing scheme. (since R2023b)
How Manual Color Assignment Overrides SeriesIndex
Behavior
To manually control the fill color of the markers, use either of these approaches:
- One color for all markers — Set the
MarkerFaceColor
property to a color name, RGB triplet, or a hexadecimal color code. - Different colors for all the markers — Set the
MarkerFaceColor
property to"flat"
. Then set theCData
property to an RGB triplet, matrix of RGB triplets, or a vector of colormap indices.
Manually controlling the edge colors of the markers works the same way, except that you set MarkerEdgeColor
property to a color value or"flat"
.
When you manually set the color of an object, MATLAB disables automatic color selection for that object and allows your color to persist, regardless of the value of the SeriesIndex
property. The CDataMode
property indicates whether theCData
colors have been set manually (by you) or automatically. A value of "manual"
indicates manual selection, and a value of "auto"
indicates automatic selection.
Automatic color selection is disabled when you perform either of these actions:
- Set the
MarkerFaceColor
orMarkerEdgeColor
to a value other than"flat"
. - Set the
CData
to a color value manually.
To enable automatic selection again, set the MarkerFaceColor
,MarkerEdgeColor
, or both properties to"flat"
. Set the CDataMode
property to"auto"
, and set the SeriesIndex
property to a positive whole number.
In some cases, MATLAB sets the SeriesIndex
value to0
, which also disables automatic color selection.
Marker sizes, specified in one of these forms:
- Scalar — Use the same size for all of the markers.
- Vector — Use a different size for each marker. Specify
SizeData
as a vector the same length asXData
.
Specify the values in point units, where one point equals 1/72 inch. To specify a marker that has an area of one square inch, use a value of 72^2.
Example: 50
Control how the SizeData
property is set, specified as one of these values:
'auto'
— MATLAB controls the value of theSizeData
property. The value can be:- The default value of the
SizeData
property. - The values in a table variable. The
SourceTable
property specifies the table, and theSizeVariable
property specifies the variable. If either theSourceTable
orSizeVariable
properties are empty, the defaultSizeData
value is used.
- The default value of the
'manual'
— You set theSizeData
property directly; it does not change.
Variable linked to SizeData
, specified as a character vector or string containing a MATLAB workspace variable. MATLAB evaluates the variable in the base workspace to generate theSizeData
.
By default, there is no linked variable so the value is an empty character vector. If you link a variable, then MATLAB does not update the SizeData
values. To force an update of the data values, use the refreshdata function.
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.
Cartesian Coordinate Data
x values, specified as a scalar or a vector. The scatter plot displays an individual marker for each value inXData
.
The input argument x
to the plotting function sets the_x_ values. XData
andYData
must have equal lengths.
Example: [1 2 4 2 6]
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| categorical
| datetime
| duration
Control how the XData
property is set, specified as one of these values:
'auto'
— TheXData
property updates automatically based on theSourceTable
andXVariable
properties. This is the case when you pass a table to any of the Cartesian scatter plotting functions (such asscatter
orscatter3
).'manual'
— TheXData
property is set directly and does not update automatically. This is the case when you pass coordinate values as vectors or matrices to any of the Cartesian scatter plotting functions.
y values, specified as a scalar or a vector. The scatter plot displays an individual marker for each value inYData
.
The input argument y
to the plotting function sets the_y_ values. XData
andYData
must have equal lengths.
Example: [1 3 3 4 6]
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| categorical
| datetime
| duration
Control how the YData
property is set, specified as one of these values:
'auto'
— TheYData
property updates automatically based on theSourceTable
andYVariable
properties. This is the case when you pass a table to any of the Cartesian scatter plotting functions (such asscatter
orscatter3
).'manual'
— TheYData
property is set directly and does not update automatically. This is the case when you pass coordinate values as vectors or matrices to any of the Cartesian scatter plotting functions.
z values, specified as a scalar or a vector.
- For 2-D scatter plots,
ZData
is empty by default. - For 3-D scatter plots, the input argument
z
to the plotting function sets the z values.XData
,YData
, andZData
must have equal lengths.
Example: [1 2 2 1 0]
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| categorical
| datetime
| duration
Control how the ZData
property is set, specified as one of these values:
'auto'
— TheZData
property updates automatically based on theSourceTable
andZVariable
properties. This is the case when you pass a table to any of the Cartesian scatter plotting functions (such asscatter
orscatter3
).'manual'
— TheZData
property is set directly and does not update automatically. This is the case when you pass coordinate values as vectors or matrices to any of the Cartesian scatter plotting functions.
Type of jitter (spacing of points) along the _x_-dimension, specified as one of the following values:
'none'
— Do not jitter the points.'density'
— Jitter the points using the kernel density estimate of y for 2-D charts. If you specify this option in two dimensions for a 3-D chart, the points are jittered based on the kernel density estimate in the third dimension. For example, settingXJitter
andYJitter
to'density'
uses the kernel density estimate of_z_.'rand'
— Jitter the points randomly with a uniform distribution.'randn'
— Jitter points randomly with a normal distribution.
Maximum amount of jitter (offset between points) along the _x_-dimension, specified as a nonnegative scalar value in data units.
For example, to set the jitter width to 90% of the shortest distance between adjacent points, take the minimum distance between unique values of x
and scale by0.9
.
XJitterWidth = 0.9 * min(diff(unique(x)));
Since R2025a
Direction of jitter along the _x_-dimension, specified as one of these values:
"positive"
— Jitter the points in the positive_x_ direction."negative"
— Jitter the points in the negative_x_ direction."both"
— Jitter the points in both directions of_x_.
Type of jitter (spacing of points) along the _y_-dimension, specified as one of the following values:
'none'
— Do not jitter the points.'density'
— Jitter the points using the kernel density estimate of x for 2-D charts. If you specify this option in two dimensions for a 3-D chart, the points are jittered based on the kernel density estimate in the third dimension. For example, settingXJitter
andYJitter
to'density'
uses the kernel density estimate of_z_.'rand'
— Jitter the points randomly with a uniform distribution.'randn'
— Jitter points randomly with a normal distribution.
Maximum amount of jitter (offset between points) along the_y_-dimension, specified as a nonnegative scalar value in data units.
For example, to set the jitter width to 90% of the shortest distance between adjacent points, take the minimum distance between unique values of y
and scale by0.9
.
YJitterWidth = 0.9 * min(diff(unique(y)));
Since R2025a
Direction of jitter along the _y_-dimension, specified as one of these values:
"positive"
— Jitter the points in the positive_y_ direction."negative"
— Jitter the points in the negative_y_ direction."both"
— Jitter the points in both directions of_y_.
Type of jitter (spacing of points) along the _z_-dimension, specified as one of the following values:
'none'
— Do not jitter the points.'density'
—Jitter the points using the kernel density estimate of y. Or, if you specify this option in one additional dimension, the points are jittered based on the kernel density estimate in the third dimension. For example, settingYJitter
andZJitter
to'density'
uses the kernel density estimate of_x_.'rand'
— Jitter the points randomly with a uniform distribution.'randn'
— Jitter points randomly with a normal distribution.
Maximum amount of jitter (offset between points) along the _z_-dimension in data units, specified as a nonnegative scalar value.
For example, to set the jitter width to 90% of the shortest distance between adjacent points, take the minimum distance between unique values ofz
and scale by0.9
.
ZJitterWidth = 0.9 * min(diff(unique(z)));
Since R2025a
Direction of jitter along the _z_-dimension, specified as one of these values:
"positive"
— Jitter the points in the positive_z_ direction."negative"
— Jitter the points in the negative_z_ direction."both"
— Jitter the points in both directions of_z_.
Polar Coordinate Data
Radius values, specified as a vector. ThetaData
andRData
must be vectors of equal length.
This property applies only to polar axes.
Control how the RData
property is set, specified as one of these values:
'auto'
— TheRData
property updates automatically based on theSourceTable
andRVariable
properties. This is the case when you pass a table to thepolarscatter
orscatter
functions.'manual'
— TheRData
property is set directly and does not update automatically. This is the case when you pass coordinate values as vectors or matrices to thepolarscatter
orscatter
functions.
Variable linked to RData
, specified as a character vector or string containing a MATLAB workspace variable name. MATLAB evaluates the variable in the base workspace to generate theRData
.
By default, there is no linked variable so the value is an empty character vector, ''
. If you link a variable, then MATLAB does not update the RData
values immediately. To force an update of the data values, use the refreshdata function.
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.
This property applies only to polar axes.
Angle values, specified as a vector. ThetaData
andRData
must be vectors of equal length.
This property applies only to polar axes.
Control how the ThetaData
property is set, specified as one of these values:
'auto'
— TheThetaData
property updates automatically based on theSourceTable
andThetaVariable
properties. This is the case when you pass a table to thepolarscatter
orscatter
functions.'manual'
— TheThetaData
property is set directly and does not update automatically. This is the case when you pass coordinate values as vectors or matrices to thepolarscatter
orscatter
functions.
Variable linked to ThetaData
, specified as a character vector or string containing a MATLAB workspace variable name. MATLAB evaluates the variable in the base workspace to generate theRData
.
By default, there is no linked variable so the value is an empty character vector, ''
. If you link a variable, then MATLAB does not update the ThetaData
values immediately. To force an update of the data values, use the refreshdata function.
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.
This property applies only to polar axes.
Geographic Coordinate Data
Latitude values, specified as a vector. LatitudeData
and LongitudeData
must be vectors of equal length.
This property applies only to geographic axes.
Control how the LatitudeData
property is set, specified as one of these values:
'auto'
— TheLatitudeData
property updates automatically based on theSourceTable
andLatitudeVariable
properties. This is the case when you pass a table to a plotting function.'manual'
— TheLatitudeData
property is set directly and does not update automatically. This is the case when you pass coordinate values as vectors or matrices to a plotting function.
This property applies only to geographic axes.
Variable linked to LatitudeData
, specified as a character vector or string containing a MATLAB workspace variable name. MATLAB evaluates the variable in the base workspace to generate theRData
.
By default, there is no linked variable so the value is an empty character vector, ''
. If you link a variable, MATLAB does not update the LatitudeData
values immediately. To force an update of the data values, use the refreshdata function.
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.
This property applies only to geographic axes.
Longitude values, specified as a vector.LongitudeData
and LatitudeData
must be vectors of equal length.
This property applies only to geographic axes.
Control how the LongitudeData
property is set, specified as one of these values:
'auto'
— TheLongitudeData
property updates automatically based on theSourceTable
andLongitudeVariable
properties. This is the case when you pass a table to a plotting function.'manual'
— TheLongitudeData
property is set directly and does not update automatically. This is the case when you pass coordinate values as vectors or matrices to a plotting function.
This property applies only to geographic axes.
Variable linked to LongitudeData
, specified as a character vector or string containing a MATLAB workspace variable name. MATLAB evaluates the variable in the base workspace to generate theRData
.
By default, there is no linked variable so the value is an empty character vector, ''
. If you link a variable, MATLAB does not update the LatitudeData
values immediately. To force an update of the data values, use the refreshdata function.
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.
This property applies only to geographic axes.
Table Data (Since R2021b)
Source table containing the data to plot, specified as a table or timetable.
Table variable containing the _x_-coordinates, specified using one of the indexing schemes from the following table. The variable you specify can contain numeric, categorical, datetime, or duration values. When you set this property, MATLAB updates the XData
property.
This table lists the different indexing schemes you can use to specify the table variable.
Indexing Scheme | Examples |
---|---|
Variable name:A string scalar or character vector.A pattern object. The pattern object must refer to only one variable. | "A" or 'A' — A variable named A"Var"+digitsPattern(1) — The variable with the name "Var" followed by a single digit |
Variable index:An index number that refers to the location of a variable in the table.A logical vector. Typically, this vector is the same length as the number of variables, but you can omit trailing 0 or false values. | 3 — The third variable from the table[false false true] — The third variable |
Variable type:A vartype subscript that selects a table variable of a specified type. The subscript must refer to only one variable. | vartype("double") — The variable containing double values |
Table variable containing the _y_-coordinates, specified using one of the indexing schemes from the following table. The variable you specify can contain numeric, categorical, datetime, or duration values. When you set this property, MATLAB updates the YData
property.
This table lists the different indexing schemes you can use to specify the table variable.
Indexing Scheme | Examples |
---|---|
Variable name:A string scalar or character vector.A pattern object. The pattern object must refer to only one variable. | "A" or 'A' — A variable named A"Var"+digitsPattern(1) — The variable with the name "Var" followed by a single digit |
Variable index:An index number that refers to the location of a variable in the table.A logical vector. Typically, this vector is the same length as the number of variables, but you can omit trailing 0 or false values. | 3 — The third variable from the table[false false true] — The third variable |
Variable type:A vartype subscript that selects a table variable of a specified type. The subscript must refer to only one variable. | vartype("double") — The variable containing double values |
Table variable containing the _z_-coordinates, specified using one of the indexing schemes from the following table. The variable you specify can contain numeric, categorical, datetime, or duration values. When you set this property, MATLAB updates the ZData
property.
This table lists the different indexing schemes you can use to specify the table variable.
Indexing Scheme | Examples |
---|---|
Variable name:A string scalar or character vector.A pattern object. The pattern object must refer to only one variable. | "A" or 'A' — A variable named A"Var"+digitsPattern(1) — The variable with the name "Var" followed by a single digit |
Variable index:An index number that refers to the location of a variable in the table.A logical vector. Typically, this vector is the same length as the number of variables, but you can omit trailing 0 or false values. | 3 — The third variable from the table[false false true] — The third variable |
Variable type:A vartype subscript that selects a table variable of a specified type. The subscript must refer to only one variable. | vartype("double") — The variable containing double values |
Table variable containing the radius values, specified using one of the indexing schemes from the following table. The variable you specify can contain any type of numeric values. When you set this property, MATLAB updates the RData
property.
Here is a list of the different indexing schemes you can use to specify the table variable.
Indexing Scheme | Examples |
---|---|
Variable name:A string scalar or character vector.A pattern object. The pattern object must refer to only one variable. | "A" or 'A' — A variable named A"Var"+digitsPattern(1) — The variable with the name "Var" followed by a single digit |
Variable index:An index number that refers to the location of a variable in the table.A logical vector. Typically, this vector is the same length as the number of variables, but you can omit trailing 0 or false values. | 3 — The third variable from the table[false false true] — The third variable |
Variable type:A vartype subscript that selects a table variable of a specified type. The subscript must refer to only one variable. | vartype("double") — The variable containing double values |
Table variable containing the angle values, specified using one of the indexing schemes from the following table. The variable you specify can contain any type of numeric values. When you set this property, MATLAB updates the ThetaData
property.
Here is a list of the different indexing schemes you can use to specify the table variable.
Indexing Scheme | Examples |
---|---|
Variable name:A string scalar or character vector.A pattern object. The pattern object must refer to only one variable. | "A" or 'A' — A variable named A"Var"+digitsPattern(1) — The variable with the name "Var" followed by a single digit |
Variable index:An index number that refers to the location of a variable in the table.A logical vector. Typically, this vector is the same length as the number of variables, but you can omit trailing 0 or false values. | 3 — The third variable from the table[false false true] — The third variable |
Variable type:A vartype subscript that selects a table variable of a specified type. The subscript must refer to only one variable. | vartype("double") — The variable containing double values |
Table variable containing the latitude values for geographic plots, specified using one of the indexing schemes from the following table. When you set this property, MATLAB updates the LatitudeData
property.
Here is a list of the different indexing schemes you can use to specify the table variable.
Indexing Scheme | Examples |
---|---|
Variable name:A string scalar or character vector.A pattern object. The pattern object must refer to only one variable. | "A" or 'A' — A variable named A"Var"+digitsPattern(1) — The variable with the name "Var" followed by a single digit |
Variable index:An index number that refers to the location of a variable in the table.A logical vector. Typically, this vector is the same length as the number of variables, but you can omit trailing 0 or false values. | 3 — The third variable from the table[false false true] — The third variable |
Variable type:A vartype subscript that selects a table variable of a specified type. The subscript must refer to only one variable. | vartype("double") — The variable containing double values |
Table variable containing the longitude values for geographic plots, specified using one of the indexing schemes from the following table. When you set this property, MATLAB updates the LongitudeData
property.
Here is a list of the different indexing schemes you can use to specify the table variable.
Indexing Scheme | Examples |
---|---|
Variable name:A string scalar or character vector.A pattern object. The pattern object must refer to only one variable. | "A" or 'A' — A variable named A"Var"+digitsPattern(1) — The variable with the name "Var" followed by a single digit |
Variable index:An index number that refers to the location of a variable in the table.A logical vector. Typically, this vector is the same length as the number of variables, but you can omit trailing 0 or false values. | 3 — The third variable from the table[false false true] — The third variable |
Variable type:A vartype subscript that selects a table variable of a specified type. The subscript must refer to only one variable. | vartype("double") — The variable containing double values |
Table variable containing marker size data, specified as a variable index into the source table.
Specifying the Table Index
Use any of the following indexing schemes to specify the desired variable.
Indexing Scheme | Examples |
---|---|
Variable name:A string scalar or character vector.A pattern object. The pattern object must refer to only one variable. | "A" or 'A' — A variable named A"Var"+digitsPattern(1) — The variable with the name "Var" followed by a single digit |
Variable index:An index number that refers to the location of a variable in the table.A logical vector. Typically, this vector is the same length as the number of variables, but you can omit trailing 0 or false values. | 3 — The third variable from the table[false false true] — The third variable |
Variable type:A vartype subscript that selects a table variable of a specified type. The subscript must refer to only one variable. | vartype("double") — The variable containing double values |
Specifying Size Data
The variable you specify can contain any numeric type. When you set theSizeVariable
property, MATLAB updates the SizeData
property.
Table variable containing the color data, specified as a variable index into the source table.
Specifying the Table Index
Use any of the following indexing schemes to specify the desired variable.
Indexing Scheme | Examples |
---|---|
Variable name:A string scalar or character vector.A pattern object. The pattern object must refer to only one variable. | "A" or 'A' — A variable named A"Var"+digitsPattern(1) — The variable with the name "Var" followed by a single digit |
Variable index:An index number that refers to the location of a variable in the table.A logical vector. Typically, this vector is the same length as the number of variables, but you can omit trailing 0 or false values. | 3 — The third variable from the table[false false true] — The third variable |
Variable type:A vartype subscript that selects a table variable of a specified type. The subscript must refer to only one variable. | vartype("double") — The variable containing double values |
Specifying Color Data
Specifying the ColorVariable
property controls the colors of the markers. The data in the variable controls the marker fill color when theMarkerFaceColor
property is set to"flat"
. The data can also control the marker outline color, when the MarkerEdgeColor
is set to"flat"
.
The table variable you specify can contain values of any numeric type. The values can be in either of the following forms:
- A column of numbers that linearly map into the current colormap.
- A three-column array of RGB triplets. RGB triplets are three-element vectors whose values specify the intensities of the red, green, and blue components of specific colors. The intensities must be in the range
[0,1]
. For example,[0.5 0.7 1]
specifies a shade of light blue.
When you set the ColorVariable
property, MATLAB updates the CData
property.
Table variable containing transparency data, specified as a variable index into the source table.
Specifying the Table Index
Use any of the following indexing schemes to specify the desired variable.
Indexing Scheme | Examples |
---|---|
Variable name:A string scalar or character vector.A pattern object. The pattern object must refer to only one variable. | "A" or 'A' — A variable named A"Var"+digitsPattern(1) — The variable with the name "Var" followed by a single digit |
Variable index:An index number that refers to the location of a variable in the table.A logical vector. Typically, this vector is the same length as the number of variables, but you can omit trailing 0 or false values. | 3 — The third variable from the table[false false true] — The third variable |
Variable type:A vartype subscript that selects a table variable of a specified type. The subscript must refer to only one variable. | vartype("double") — The variable containing double values |
Specifying Transparency Data
The data in the variable you specify controls the transparency of the markers. Smaller values are more transparent, and larger values are more opaque. The values can be any numeric type.
After setting the AlphaVariable
property, set the MarkerFaceAlpha
and MarkerEdgeAlpha
properties to control the type of transparency. If the MarkerFaceAlpha
and MarkerEdgeAlpha
properties are both set to scalar values, then the scatter object does not use the data from the table.
When you set this property, MATLAB updates the AlphaData
property.
Legend
Legend label, specified as a character vector or string scalar. The legend does not display until you call the legend
command. If you do not specify the text, then legend
sets the label using the form'dataN'
.
Interactivity
Data tip content, specified as a DataTipTemplate
object. You can control the content that appears in a data tip by modifying the properties of the underlying DataTipTemplate
object. For a list of properties, seeDataTipTemplate Properties.
For an example of modifying data tips, see Create Custom Data Tips.
Note
The DataTipTemplate
object is not returned byfindobj
or findall
, and it is not copied by copyobj
.
Callbacks
Callback Execution Control
This property is read-only.
Parent/Child
Parent, specified as an Axes
,PolarAxes
, Group
, orTransform
object.
Identifiers
This property is read-only.
Type of graphics object, returned as 'scatter'
. Use this property to find all objects of a given type within a plotting hierarchy, for example, searching for the type using findobj.
Object identifier, specified as a character vector or string scalar. You can specify a unique Tag
value to serve as an identifier for an object. When you need access to the object elsewhere in your code, you can use the findobj function to search for the object based on the Tag
value.
Version History
Introduced before R2006a
Set the XJitterDirection
,YJitterDirection
, and ZJitterDirection
properties to control the direction of the jitter in your chart. Each of these properties can have a value of "negative"
,"positive"
, or "both"
.
Opt out of automatic color selection for Scatter
objects by setting theSeriesIndex
property to "none"
. When you specify"none"
, the Scatter
object has a neutral color.
To enable automatic color selection again, set the SeriesIndex
property to a positive whole number.
Control how Scatter
objects vary in color by setting theSeriesIndex
property. This property is useful when you want to match the colors of different objects in the axes.
Setting or getting UIContextMenu
property is not recommended. Instead, use the ContextMenu
property, which accepts the same type of input and behaves the same way as theUIContextMenu
property.
There are no plans to remove the UIContextMenu
property, but it is no longer listed when you call the set
, get
, orproperties
functions on the Scatter
object.