plotting 20 graphs on singe screen with different colors

11 ビュー (過去 30 日間)
som
som 2012 年 1 月 22 日
Hi all
I've written a program having twenty outputs . these outputs are obtained from a FOR loop and I want to present the plot of them using different colours like below:
period=[1:300];
for ss=1:20 for y=1:25 for t=1:12
s_sim{ss}(y,t)= .... % CALCULATION OF 's_sim{ss}(y,t)' VALUES
end
end
hold on
plot (period , s_sim_series{ss}, 'LineWidth',1,'MarkerEdgeColor','r','MarkerFaceColor','r', 'MarkerSize',5 );
end
How can I do it?
thanks,

採用された回答

Junaid
Junaid 2012 年 1 月 22 日
Dear one possible ways is this...
col=hsv(20);
figure;
hold on;
for i=1:20
plot([0 1],[0 i],'color',col(i,:));
end
or if you have any preferences for colors, then make an array of color and then use it in loop.
  3 件のコメント
Walter Roberson
Walter Roberson 2012 年 1 月 22 日
change the plot() call to be
for ss = 1 : 20
plot(period, s_sim_series{ss}, 'color', col(ss,:))
end
Junaid
Junaid 2012 年 1 月 22 日
Thanks Walter... dear in your program first declare col as I have given sample code. It should work then

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

その他の回答 (1 件)

Junaid
Junaid 2012 年 1 月 22 日
Dear Somayeh,
col=hsv(20);
figure;
hold on;
for ss=1:20
for y=1:25
for t=1:12
s_sim{ss}(y,t)= ...% calculation of 's_sim{ss}(y,t)' values
end
end
plot (period , s_sim_series{ss}, 'Color', col(ss));
end
if your s_sim is computed correctly then you can see the plot. I hope it works now.
  1 件のコメント
som
som 2012 年 1 月 23 日
Thanks dear junadi

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

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by