scatter

Creates dots in an axes and returns handles of the dots.

Syntax

h = scatter(x, y)

h = scatter(..., color)

h = scatter(..., style)

h = scatter(..., property, value, ...)

h = scatter(hAxes, ...)

Inputs

x,y
Range of the x and y axes.
Type: double | integer
Dimension: scalar | vector | matrix
color
Color of the scattered dots.
Type: double | integer | string
Dimension: scalar | vector
style
Style of the scattered dots.
Type: char
Dimension: scalar
property
Properties that control the appearance or behavior of the graphics object .
Type: string
Dimension: scalar
value
Value of properties.
Type: double | integer | string
Dimension: scalar | vector
hAxes
Axis handle. .
Type: double
Dimension: scalar

Outputs

h
Handle of the scatter graphics object.

Examples

Simple scatter example:
clf;
x = rand(1, 100);
y = rand(1, 100);
s = scatter (x, y);
Figure 1. Scatter plot

Simple scatter example with size color and filled option:
clf;
x = rand(1, 100);
y = rand(1, 100);
s = scatter (x, y, 10, 'gv', 'filled');
Figure 2. Scatter plot with options

Comments

If there is no axes, one will be created first. Takes optional arguments to control the dots style. It can be either the size of the dots (not supported yet), or the color of the dots (not supported yet), or the style of the dots, or “filled...not supported yet), or property/value pair(s), or all of them. If the first argument of scatter() is an axes handle, lines will be created in that axes.