Scatter chart appearance and behavior (2024)

Table of Contents
Markers Marker — Marker symbol 'o' (default) | '+' | '*' | '.' | 'x' | ... MarkerEdgeAlpha — Marker edge transparency 1 (default) | scalar in range [0,1] | 'flat' MarkerFaceAlpha — Marker face transparency 1 (default) | scalar in range [0,1] | 'flat' AlphaData — Marker face transparency 1 (default) | array the same size as XData AlphaDataMode — Control how AlphaData is set 'auto' | 'manual' Color and Size Data CData — Marker colors [] (default) | RGB triplet | matrix of RGB triplets | vector CDataMode — Control how CData is set 'auto' (default) | 'manual' CDataSource — Variable linked to CData '' | character vector or string containing MATLAB workspace variable SeriesIndex — Series index positive whole number | "none" SizeData — Marker sizes [] (default) | scalar | vector SizeDataMode — Control how SizeData is set 'auto' | 'manual' SizeDataSource — Variable linked to SizeData '' | character vector or string containing MATLAB workspace variable Cartesian Coordinate Data XData — x values [] (default) | scalar | vector XDataMode — Control how XData is set 'auto' | 'manual' YData — y values [] (default) | scalar | vector YDataMode — Control how YData is set 'auto' | 'manual' ZData — z values [] (default) | scalar | vector ZDataMode — Control how ZData is set 'auto' | 'manual' XJitter — Jitter type for x-dimension 'none' | 'density' | 'rand' | 'randn' XJitterWidth — Maximum jitter along x-dimension nonnegative scalar YJitter — Jitter type for y-dimension 'none' | 'density' | 'rand' | 'randn' YJitterWidth — Maximum jitter along y-dimension nonnegative scalar ZJitter — Jitter type for z-dimension 'none' (default) | 'density' | 'rand' | 'randn' ZJitterWidth — Maximum jitter along z-dimension nonnegative scalar Polar Coordinate Data RData — Radius values vector RDataMode — Control how RData is set 'auto' | 'manual' RDataSource — Variable linked to RData '' (default) | character vector or string containing MATLAB workspace variable name ThetaData — Angle values vector ThetaDataMode — Control how ThetaData is set 'auto' | 'manual' ThetaDataSource — Variable linked to ThetaData '' (default) | character vector or string containing MATLAB workspace variable name Geographic Coordinate Data LatitudeData — Latitude values vector LatitudeDataMode — Control how LatitudeData is set 'auto' | 'manual' LatitudeDataSource — Variable linked to LatitudeData '' (default) | character vector or string containing MATLAB workspace variable name LongitudeData — Longitude values vector LongitudeDataMode — Control how LongitudeData is set 'auto' | 'manual' LongitudeDataSource — Variable linked to LongitudeData '' (default) | character vector or string containing MATLAB workspace variable name Table Data (Since R2021b) SourceTable — Source table table | timetable XVariable — Table variable containing x-coordinates string scalar | character vector | pattern | numeric scalar | logical vector | vartype() YVariable — Table variable containing y-coordinates string scalar | character vector | pattern | numeric scalar | logical vector | vartype() ZVariable — Table variable containing z-coordinates string scalar | character vector | pattern | numeric scalar | logical vector | vartype() RVariable — Table variable containing radius values string array | character vector | cell array | pattern | numeric scalar or vector | logical vector | vartype() ThetaVariable — Table variable containing angle values string array | character vector | cell array | pattern | numeric scalar or vector | logical vector | vartype() LatitudeVariable — Table variable containing latitude values string array | character vector | cell array | pattern | numeric scalar or vector | logical vector | vartype() LongitudeVariable — Table variable containing longitude values string array | character vector | cell array | pattern | numeric scalar or vector | logical vector | vartype() SizeVariable — Table variable containing marker size data table variable index ColorVariable — Table variable containing color data table variable index AlphaVariable — Table variable containing marker transparency data table variable index Legend Interactivity DataTipTemplate — Data tip content DataTipTemplate object Callbacks Callback Execution Control Parent/Child Parent — Parent Axes object | PolarAxes object | Group object | Transform object Identifiers Type — Type of graphics object 'scatter' Version History R2023b: Opt out of automatic color selection with SeriesIndex="none" R2020a: Control automatic color selection with the SeriesIndex property R2020a: UIContextMenu property is not recommended See Also Topics MATLAB Command Americas Europe Asia Pacific References

Scatter chart appearance and behavior

expand all in page

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

expand all

Marker symbol, specified as one of the options listed in this table:

MarkerDescriptionResulting Marker
"o"Circle

Scatter chart appearance and behavior (1)

"+"Plus sign

Scatter chart appearance and behavior (2)

"*"Asterisk

Scatter chart appearance and behavior (3)

"."Point

Scatter chart appearance and behavior (4)

"x"Cross

Scatter chart appearance and behavior (5)

"_"Horizontal line

Scatter chart appearance and behavior (6)

"|"Vertical line

Scatter chart appearance and behavior (7)

"square"Square

Scatter chart appearance and behavior (8)

"diamond"Diamond

Scatter chart appearance and behavior (9)

"^"Upward-pointing triangle

Scatter chart appearance and behavior (10)

"v"Downward-pointing triangle

Scatter chart appearance and behavior (11)

">"Right-pointing triangle

Scatter chart appearance and behavior (12)

"<"Left-pointing triangle

Scatter chart appearance and behavior (13)

"pentagram"Pentagram

Scatter chart appearance and behavior (14)

"hexagram"Hexagram

Scatter chart appearance and behavior (15)

"none"No markersNot 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 the AlphaData property to a vector the same size as the XData property, and set the MarkerEdgeAlpha 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 the MarkerFaceAlpha property to 'flat'.

Transparency data for each plotted point, specified as an array the same size as the XData property. After specifying the values, 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 AlphaData values.

The AlphaDataMapping property determines how the Scatter 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 the AlphaData 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 the AlphaVariable property specifies the variable. If either the SourceTable or AlphaVariable properties are empty, the default AlphaData value is used.

  • 'manual' — The AlphaData property is set directly and does not update automatically.

Color and Size Data

expand all

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 as XData. 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 the CData property. The value can be:

    • One of the colors from the ColorOrder property of the axes. MATLAB uses the SeriesIndex property of the Scatter object and the ColorOrder 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 the ColorVariable property specifies the variable. If either of these properties are empty, then the color data comes from the ColorOrder property of the axes.

  • 'manual' — You control the value of the CData property manually, either by specifying a color when you call a plotting function or by setting the CData property on the Scatter 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 the CData.

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, the SeriesIndex 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 the ColorOrder 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 the CData 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 the CData 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 or MarkerEdgeColor 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 to 0, 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 as XData.

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 the SizeData 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 the SizeVariable property specifies the variable. If either the SourceTable or SizeVariable properties are empty, the default SizeData value is used.

  • 'manual' — You set the SizeData 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 the SizeData.

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

expand all

x values, specified as a scalar or a vector. The scatter plot displays an individual marker for each value in XData.

The input argument x to the plotting function sets the x values. XData and YData 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' — The XData property updates automatically based on the SourceTable and XVariable properties. This is the case when you pass a table to any of the Cartesian scatter plotting functions (such as scatter or scatter3).

  • 'manual' — The XData 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 in YData.

The input argument y to the plotting function sets the y values. XData and YData 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' — The YData property updates automatically based on the SourceTable and YVariable properties. This is the case when you pass a table to any of the Cartesian scatter plotting functions (such as scatter or scatter3).

  • 'manual' — The YData 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, and ZData 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' — The ZData property updates automatically based on the SourceTable and ZVariable properties. This is the case when you pass a table to any of the Cartesian scatter plotting functions (such as scatter or scatter3).

  • 'manual' — The ZData 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, setting XJitter and YJitter 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 by 0.9.

XJitterWidth = 0.9 * min(diff(unique(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, setting XJitter and YJitter 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 by 0.9.

YJitterWidth = 0.9 * min(diff(unique(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, setting YJitter and ZJitter 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 of z and scale by 0.9.

ZJitterWidth = 0.9 * min(diff(unique(z)));

Polar Coordinate Data

expand all

Radius values, specified as a vector. ThetaData and RData 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' — The RData property updates automatically based on the SourceTable and RVariable properties. This is the case when you pass a table to the polarscatter or scatter functions.

  • 'manual' — The RData property is set directly and does not update automatically. This is the case when you pass coordinate values as vectors or matrices to the polarscatter or scatter 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 the RData.

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 and RData 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' — The ThetaData property updates automatically based on the SourceTable and ThetaVariable properties. This is the case when you pass a table to the polarscatter or scatter functions.

  • 'manual' — The ThetaData property is set directly and does not update automatically. This is the case when you pass coordinate values as vectors or matrices to the polarscatter or scatter 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 the RData.

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

expand all

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' — The LatitudeData property updates automatically based on the SourceTable and LatitudeVariable properties. This is the case when you pass a table to a plotting function.

  • 'manual' — The LatitudeData 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 the RData.

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' — The LongitudeData property updates automatically based on the SourceTable and LongitudeVariable properties. This is the case when you pass a table to a plotting function.

  • 'manual' — The LongitudeData 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 the RData.

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)

expand all

Source table containing the data to plot. Specify this property as a table or a 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 SchemeExamples

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 SchemeExamples

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 SchemeExamples

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 for polar plots, 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. This property applies only to polar axes.

Here is a list of the different indexing schemes you can use to specify the table variable.

Indexing SchemeExamples

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 for polar plots, 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. This property applies only to polar axes.

Here is a list of the different indexing schemes you can use to specify the table variable.

Indexing SchemeExamples

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. This property applies only to geographic axes.

Here is a list of the different indexing schemes you can use to specify the table variable.

Indexing SchemeExamples

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. This property applies only to geographic axes.

Here is a list of the different indexing schemes you can use to specify the table variable.

Indexing SchemeExamples

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 SchemeExamples

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 the SizeVariable 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 SchemeExamples

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 the MarkerFaceColor 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 SchemeExamples

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

expand all

Interactivity

expand all

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, see DataTipTemplate Properties.

For an example of modifying data tips, see Create Custom Data Tips.

Note

The DataTipTemplate object is not returned by findobj or findall, and it is not copied by copyobj.

Callbacks

expand all

Callback Execution Control

expand all

Parent/Child

expand all

Parent, specified as an Axes, PolarAxes, Group, or Transform object.

Identifiers

expand all

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.

Version History

Introduced before R2006a

expand all

Control how Scatter objects vary in color by setting the SeriesIndex property. This property is useful when you want to match the colors of different objects in the axes.

See Also

scatter | scatter3 | swarmchart | swarmchart3

Topics

  • Access Property Values
  • Graphics Object Properties

MATLAB Command

You clicked a link that corresponds to this MATLAB command:

 

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Scatter chart appearance and behavior (16)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom (English)

Asia Pacific

Contact your local office

Scatter chart appearance and behavior (2024)

References

Top Articles
Latest Posts
Article information

Author: Amb. Frankie Simonis

Last Updated:

Views: 5689

Rating: 4.6 / 5 (56 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Amb. Frankie Simonis

Birthday: 1998-02-19

Address: 64841 Delmar Isle, North Wiley, OR 74073

Phone: +17844167847676

Job: Forward IT Agent

Hobby: LARPing, Kitesurfing, Sewing, Digital arts, Sand art, Gardening, Dance

Introduction: My name is Amb. Frankie Simonis, I am a hilarious, enchanting, energetic, cooperative, innocent, cute, joyous person who loves writing and wants to share my knowledge and understanding with you.