0

I have code that will plot a compass plot in octave (3.2.4) /matlab but how do I get rid of the arrows / change color

[x,y]=pol2cart(90*pi/180,1);
compass(x,y) 

I tried

[x,y]=pol2cart(90*pi/180,1);
compass(x,y,'*')

and

[x,y]=pol2cart(90*pi/180,1);
compass(x,y,'--r') 

along with several combinations any idea?

Thanks

4

1 回答 1

2

要删除箭头,您需要删除绘图的xdataydata字段中的前两个条目以外的所有条目。颜色可以通过设置color属性来改变。请在下面找到带有任意数量箭头的指南针图的解决方案。

[x,y]=pol2cart([45 90]*pi/180,1);

h = compass(x,y);

for k = 1:length(h)
    a = get(h(k), 'xdata'); 
    b = get(h(k), 'ydata'); 

    set(h(k), 'xdata', a(1:2), 'ydata', b(1:2), 'color', 'r')
end
于 2012-05-13T19:11:39.647 回答