Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between plot and scatter matlab

Consider the following data points and plots

a = randi(50,1,200);
b = randi(50,1,200);
figure;scatter(a,b,'.')
figure;plot(a,b,'.')

When we run the following code , we receive exactly the same plots for a against b , my question is why should we even use or to rephrase again in what conditions scatter plot has advantage over plot function ? because plot seem to have more formatting options that the scatter function

like image 283
Novice_Developer Avatar asked Dec 19 '22 15:12

Novice_Developer


1 Answers

plot has a concept of the order of the points mattering so you can use it to make line plots. plot also allows you to specify the input x and y values as either vectors or matrices or allows you to input multiple x and y vectors both of which allow you to plot multiple series at once:

![enter image description here

whereas scatter only allows you to input 1 x and 1 y and they both have to be vectors. However, 'scatter' allows you to specify an area and colour vector to affect the points individually i.e.

enter image description here

enter image description here

like image 55
Dan Avatar answered Dec 31 '22 01:12

Dan