Skip to content

scatter

Scatter plot

scatter(x, y)

  • Generate a scatter plot with x- and y-data.
  • x and y are arrays that contain the (x,y)-coordinates of the data points.
  • The default point size and color are used.

scatter(x, y, s)

  • s is a positive scalar specifying the sizes of all of the points.
  • If s is an empty array, the default point size is used.

scatter(x, y, s, c)

  • c is a vector of 3 elements specifying the RGB values of all of the points. The RGB values should be in the range [0,1].

Example 1: Scatter plot of randomly generated x- and y-data in blue color and 6.0 point size

x=randn(1,100);
y=randn(1,100);

% Marker size of 6.0 and RGB values of 0,0,1.
scatter(x,y,6.0,[0 0 1])
Scatter plot is generated.

acos(x)