フィルターのクリア

Different colors in graph

2 ビュー (過去 30 日間)
Karl
Karl 2013 年 5 月 13 日
Does anybody know how I can add different colors to the graphs in the folowing loop: gjG below is an 11x8 matrix.
Aar = {'2011', '2012', '2013_1', '2014_1', '2014_s2', '2014_s5'};
nAar = length(Aar);
figure
hold on
for iAar = 1:nAar
plot(gjG(11,:,iAar));
legend((Aar),'location','NE','FontSize',10);
end
hold off

採用された回答

Image Analyst
Image Analyst 2013 年 5 月 13 日
plot(gjG(11,:,iAar), 'Color', rand(1,3));
  2 件のコメント
Karl
Karl 2013 年 5 月 13 日
Thank you!
Karl
Karl 2013 年 5 月 13 日
A follow up:
I have created a loop that makes several figures. When I apply "rand(1,3)) in the loop below, each figure gets different colors. Do you know how I can change the loop below to so that the colors are the same in every figure?
Alder = {'<20', '2029','3039','4049','5059','6069','>70', 'all'};
Vars = {gjG, gjR, gjI, gjDI, gjBV, GtoDI, GtoBV, RtoDIplusR, ItoG, RtoG, GtoI};
Vars2 = {'gjG', 'gjR', 'gjI', 'gjDI', 'gjBV', 'GtoDI', 'GtoBV', 'RtoDIplusR', 'ItoG', 'RtoG', 'GtoI'};
Aar = {'2011', '2012', '2013_1', '2014_1', '2014_s2', '2014_s5'};
n = length(Vars);
nAar = length(Aar);
for iVars = 1:n;
aVars = Vars{iVars};
figure,title(Vars2{iVars});
hold on
for iAar = 1:nAar
plot(aVars(11,:,iAar), 'color', rand(1,3));
set(gca, 'XTickLabel',Alder)
legend((Aar),'location','NE','FontSize',10);
end
hold off
end

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraph and Network Algorithms についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by