scatter
Creates dots in an axes and returns handles of the dots.
Syntax
h = scatter(x, y)
h = scatter(x, y, size)
h = scatter(x, y, size, cdata)
h = scatter(..., color)
h = scatter(..., style)
h = scatter(..., property, value, ...)
h = scatter(hAxes, ...)
Inputs
- x,y
- Range of the x and y axes.
- size
- Size of the scattered dots. Can be either a scalar, setting the same size for each dot, or a matrix, setting the size of each dot.
- cdata
- An Mx3 matrix that defines the color of each scattered dot.
- color
- Color of the scattered dots.
- style
- Style of the scattered dots.
- property
- Properties that control the appearance or behavior of the graphics object.
- value
- Value of the properties.
- hAxes
- Axis handle. .
Outputs
- h
- Handle of the scatter graphics object.
Examples
clf;
x = rand(1, 100);
y = rand(1, 100);
s = scatter (x, y);
clf;
x = rand(1, 100);
y = rand(1, 100);
s = scatter (x, y, 10, 'gv', 'filled');
clf;
s = scatter(1:10,1:10, 1:10)
clf;
s1 = scatter(1:10,1:10,1:10, jet(10));
hold on
% the size may be ignored
s1 = scatter(3:12,1:10,[], rainbow(10));
clf;
s = scatter(1:10,1:10);
% set the cdata
set(s,'cdata',winter(10));
% set the color of all dots to red
set(s,'markerfacecolor','r');
% set the color to 'cdata'
set(s,'markerfacecolor','flat');
Comments
If there is no axis, one will be created first. It takes optional arguments to control the dots style. It can be either the size of the dots (not supported yet), the color of the dots (not supported yet), the style of the dots, filled (not supported yet), property/value pairs, or all of them. If the first argument of scatter() is an axis handle, lines are created in that axis.