making a color plot with 3 matrices

i have 2 matrices as E(43,30619) and C(43,30619) and an altitude array as alt(43,1), E and C is related to altitude i want to plot a color plot in which put E ax X axis and C as Y axis and alt determines the color of points. i have used below script, but i couldn't get the plot i was expecting.
can any one please help me.
thank you
Z = alt;
[dummy ID]=sort(Z);
colors=colormap(jet(length(Z)));
% figure
d=0;
for i=1:length(Z)
X = EE(i,:);
Y =C_2(i,:);
plot(X(i),Y(i),'.','Color',colors(ID(i),:));
hold on
d=d+1;
end;

 採用された回答

Walter Roberson
Walter Roberson 2015 年 9 月 12 日

1 投票

pointsize = 14;
scatter(E(:), C(:), pointsize, repmat(colors(ID,:), size(E,2), 1) );

3 件のコメント

Joseph
Joseph 2015 年 9 月 12 日
thank you for answering. however your answer gives me below error:
X and Y must be vectors of the same length.
Walter Roberson
Walter Roberson 2015 年 9 月 12 日
You indicated that E(43,30619) and C(43,30619) . As those are exactly the same size, E(:) and C(:) would have to be exactly the same size. Please recheck the sizes of E and C.
By the way: you are aware, I hope, that you are plotting more than a million points? You are going to have difficulty seeing them all unless you have a high resolution display.
Joseph
Joseph 2015 年 9 月 12 日
編集済み: Joseph 2015 年 9 月 12 日
yes, it was my mistake, sorry about it. by mistake i used matrices with different dimensions. but using matrices with same dimension this time it didn't give error. it gives a plot with white screen. i think as you said, probably the number of points are too many that the display can't show the graph.
thank you, helped a lot.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGraphics についてさらに検索

タグ

質問済み:

2015 年 9 月 12 日

編集済み:

2015 年 9 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by