loop for scatter plot

27 ビュー (過去 30 日間)
Hassan
Hassan 2011 年 4 月 19 日
I have four matrix A,B,C and D and each of them has a dimension of (56 rows, 4 coulms). I want to scatter the same column of each matrix with another matrix. X1=A(:,1),Y1=B(:,1);X2=A(:,2),Y1=B(:,2), ...,X4=A(:,4),Y4=B(:,4) X5=A(:,1), Y1=C(:,1),X6=A(:,2),Y6=C(:,2),...,Xn=C(:,4), Yn=D(:,4)
I did it for one of them but don't know how to use a loop to make a seperate scatter plot for all of them. I am grateful foe your help.
X1=A(:,1) Y1=C(:,1) scatter(X1,Y1);

採用された回答

Matt Tearle
Matt Tearle 2011 年 4 月 19 日
Like this?
plot([A,A,A],[B,C,D],'o')
EDIT Based on your comment, here's a new answer:
allX = [A,A,A];
allY = [B,C,D];
for k=1:size(allX,2)
figure(k)
scatter(allX(:,k),allY(:,k))
end
  3 件のコメント
Hassan
Hassan 2011 年 4 月 19 日
thanks Matt, it's what I wanted.
I have a different labels for X-axises and Y axises. for example:
X1_label='reflectance of instrument A at level 1'
Y1_label='reflectance of instrument B at level 1'
X2_label='reflectance of instrument A at level 2'
Y2_label='reflectance of instrument B at level 2'
.
.
.
label={X1_label;X2_label;...}
I wonder how to put them for different plots?
Hassan
Hassan 2011 年 4 月 19 日
I found a way to do that.
label={s1;s2;s3;s4;s5;s6;s7;s8;s9;s10;s11;s12;s13;s14;s15;s16}
fignum = 1;
for i=1:4
while ishandle(fignum)
fignum = fignum + 1;
end
figure(fignum);
X=A(:,i)
Y=C(:,i)
scatter(X,Y);
xlabel(s(i));
ylabel(s(i+4));
end

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeScatter Plots についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by