scatter plot matlab

scatter(x,y) creates a scatter plot with circular markers at the locations specified by the vectors x and y.

  • To plot one set of coordinates, specify x and y as vectors of equal length.

  • To plot multiple sets of coordinates on the same set of axes, specify at least one of x or y as a matrix.

scatter(x,y,sz) specifies the circle sizes. To use the same size for all the circles, specify sz as a scalar. To plot each circle with a different size, specify sz as a vector or a matrix.

scatter(x,y,sz,c) specifies the circle colors. You can specify one color for all the circles, or you can vary the color. For example, you can plot all red circles by specifying c as "red".

scatter(___,"filled") fills in the circles. Use the "filled" option with any of the input argument combinations in the previous syntaxes.

scatter(___,mkr) specifies the marker type.

scatter(tbl,xvar,yvar) plots the variables xvar and yvar from the table tbl. To plot one data set, specify one variable for xvar and one variable for yvar. To plot multiple data sets, specify multiple variables for xvaryvar, or both. If both arguments specify multiple variables, they must specify the same number of variables.

scatter(tbl,xvar,yvar,"filled") plots the specified variables from the table with filled circles.