Plotting array of x and y values as points

coo*_*ool 1 matlab matlab-figure

I can't understand this: when I write the following code I obtain this graph in matlab.

x = [0 1 2 3 4 5];
y = [0 1 0 1 0 1];
figure
plot(x,y);
Run Code Online (Sandbox Code Playgroud)

enter image description here

I had just expected that only the points written in arrays x and y would be plotted ,but the graph shows lines also...
I can't understand why is it so... Please help where am I wrong

Nic*_*ick 5

Try to use the following

figure(10);
plot(x,y, '.');

figure(20);
plot(x,y, 'x');

figure(30);
plot(x,y, '-r');
Run Code Online (Sandbox Code Playgroud)

See the differences... a dot-scatter, x-scatter and red line plot.

In the plot documentation you can read more about line styles. By default it is a blue line, as you can see in your plot!