[英]Plotting points while plotting vectors : Matlab
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. 其中
x
和y
是向量:点的集合。
I do not want matlab to connect these points itself. 我不希望matlab本身连接这些点。 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. 我不想使用forloop,因为它耗时。 It takes a lot of time.
这需要很多时间。
你几乎就在那里,只需更改MarkerSize属性:
plot(x,y,'.','MarkerSize',1)
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 您可以查看文档: http : //www.mathworks.nl/help/matlab/creating_plots/using-high-level-plotting-functions.html
help scatter 帮助分散
IIRC: where S is the size of the scatter points: scatter(x,y,S) IIRC:其中S是散点的大小:散射(x,y,S)
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
. 创建的绘图没有行,但是对应于矩阵
x
和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 这给了
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.