MATLAB plot http://www.mathworks.com/help/techdoc/ref/plot.html文档非常全面。
LineSpec http://www.mathworks.com/help/techdoc/ref/linespec.html属性列出了不同样式的线条、颜色和点的语法。
如果您想要更多选择,请参阅LineSeries 属性 http://www.mathworks.com/help/techdoc/ref/lineseriesproperties.html。
您可以指定属性,例如Marker
(风格),MarkerEdgeColor
, MarkerFaceColor
, and MarkerSize
.
您还可以使用RGB 三元组 http://www.mathworks.com/help/techdoc/visualize/f0-18164.html#f0-5919定义颜色,如果你想偏离 rgbcmykw。
例子:
使用橙色五角星形标记绘制单个点 (3,4):
p=[3,4];
plot(p(1),p(2),'Marker','p','Color',[.88 .48 0],'MarkerSize',20)
绘制带有绿色“o”标记的点数组:
p=round(10*rand(2,10));
plot(p(1,:),p(2,:),'go')
EDIT:如果您将所有积分存储为p1=[x1,y1]
, p2=[x2,y2]
等等,先尝试将它们重新组织成 2xN 矩阵。重新生成点,或者如果您已经将它们作为单对,请使用
p=[p1;p2;p3]'; %# the [;] notation vertically concatenates into Nx2,
%# and the ' transposes to a 2xN
plot(p(1,:),p(2,:),'go')
或者,如果您有大量存储为单对的点,例如最多 p1000 左右,您could use eval http://www.mathworks.com/help/techdoc/ref/eval.html (cringe).
p=[]; %# initialize p
for n=1:nPoints %# if you've got 1000 points, nPairs should be 1000
eval(['p(:,n)=p',num2str(n)],''); %#executes p(:,n)=pn' for each nPoint
end