Re: [問題] 用scatter畫圖並著色已回收
※ 引述《LIERO (LIERO)》之銘言:
: 各位板友們早安~
: 目前碰到一個問題是
: 我用scatter畫出兩向量的散布圖後
: 想令某些點是紅色,某些點是藍色
: 某些點是橙色、綠色…等
: 不知道板上的朋友們有沒有什麼好方法
: 好指令可以跟我說一下呢
: 感恩感恩~
後來我用如下的方法:
for m = 1:(901*801)
% cluster center of coherency matrices of class Z9
if ((x(m) >= 0) & (x(m) <= 0.5)) & ((y(m) >= 0) & (y(m) <= 2*pi/9))
scatter(x(m),y(m),1,'blue');
hold on;
% cluster center of coherency matrices of class Z8
elseif ((x(m) >= 0) & (x(m) <= 0.5)) & ((y(m) <= 5*pi/18) & (y(m) >=
2*pi/9))
scatter(x(m),y(m),1,[0 0.5 1]);
hold on;
% cluster center of coherency matrices of class Z7
elseif ((x(m) >= 0) & (x(m) <= 0.5)) & ((y(m) >= 5*pi/18) & (y(m)<=
pi/2))
scatter(x(m),y(m),1,[1 0 1]);
hold on;
% cluster center of coherency matrices of class Z6
elseif ((x(m) <= 0.9) & (x(m) >= 0.5)) & ((y(m) >= 0) & (y(m) <=
2*pi/9))
scatter(x(m),y(m),1,[0 1 1]);
hold on;
% cluster center of coherency matrices of class Z5
elseif ((x(m) <= 0.9) & (x(m) >= 0.5)) & ((y(m) <= 5*pi/18) & (y(m)
>= 2*pi/9))
scatter(x(m),y(m),1,'g');
hold on;
% cluster center of coherency matrices of class Z4
elseif ((x(m) <= 0.9) & (x(m) >= 0.5)) & ((y(m) >= 5*pi/18) & (y(m)
<= pi/2))
scatter(x(m),y(m),1,'y');
hold on;
% cluster center of coherency matrices of class Z2
elseif ((x(m) >= 0.9) & (x(m) <= 1)) & ((y(m) >= 0) & (y(m) <= pi/3))
scatter(x(m),y(m),1,[1 0.5 0]);
hold on;
% cluster center of coherency matrices of class Z1
else ((x(m) >= 0.9) & (x(m) <= 1)) & ((y(m) <= pi/2) & (y(m) >= pi/3))
scatter(x(m),y(m),1,'r');
hold on;
end
end
--
但是 command window會一直跑出
ans=1
ans=1
不知道是怎麼回事@@
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.19.177
推
12/07 13:45, , 1F
12/07 13:45, 1F
→
12/07 17:27, , 2F
12/07 17:27, 2F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):