Reputation: 859
I need to make a plot with only points and tried something like
plot(x,y)
where x
and y
are vectors: collection of points.
I do not want matlab to connect these points itself. I want to plot as if plotted with
for loop
plot;hold on;
end
I tried
plot(x,y,'.');
But this gave me too thick points.
I do not want to use forloop because it is time expensive. It takes a lot of time.
Upvotes: 3
Views: 1736
Reputation: 7751
You may try this piece of code that avoid using loops. The plot created does not have lines but markers of different colors corresponding to each column of matrices x
and y
.
%some data (matrix)
x = repmat((2:10)',1,6);
y = bsxfun(@times, x, 1:6);
set(0,'DefaultAxesColorOrder', jet(6)); %set the default matlab color
figure('Color','w');
plot(x,y,'p'); %single call to plot
axis([1 11 0 70]);
box off;
legend(('a':'f')');
This gives
Upvotes: 1
Reputation: 45741
You're almost there, just change the MarkerSize property:
plot(x,y,'.','MarkerSize',1)
Upvotes: 4
Reputation: 331
help scatter
IIRC: where S is the size of the scatter points: scatter(x,y,S)
Upvotes: 2
Reputation: 553
Try:
plot(x,y,'*');
or
plot(x,y,'+');
You can take a look to the documentation: http://www.mathworks.nl/help/matlab/creating_plots/using-high-level-plotting-functions.html
Upvotes: 2