
How to change color each loop?
33 ビュー (過去 30 日間)
古いコメントを表示
I have a program which should be repeated 5 times by a loop. I used plot() order in my program and I'm eager to change graph color each time. How can I do it?
For example:
plot(ZZ,dTdz3,'.',h,t,'y')
I want to change 'y' to 'm' in the next loop.
note: ZZ and dTdz3 are matrices and h and t help me make a line, none of them looks important in my question to you.
0 件のコメント
採用された回答
Image Analyst
2013 年 6 月 15 日
編集済み: Image Analyst
2013 年 6 月 15 日
Use the 'Color' option of plot:
ZZ = 1:5;
for k = 1:10
dTdz3 = rand(1,5);
plot(ZZ,dTdz3, 'Color', rand(1,3), 'LineWidth', 3)
hold on;
end

0 件のコメント
その他の回答 (1 件)
Azzi Abdelmalek
2013 年 6 月 15 日
編集済み: Azzi Abdelmalek
2013 年 6 月 15 日
couleur='ym'
for k=1:2
plot(ZZ,dTdz3,'.',h,t,couleur(k))
end
1 件のコメント
参考
カテゴリ
Help Center および File Exchange で Graph and Network Algorithms についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!