How to plot with different colours?

조회 수: 4 (최근 30일)
bio lim
bio lim 2015년 5월 26일
댓글: bio lim 2015년 5월 26일
Hello. I am trying to plot with different colours (2D plot). I have an index 1 : 46, and for each array, I want a different colour.
Thanks.
figure
hold on
for ind=1 : 46,
plot(plane_des2(ind).Altitude, plane_des2(ind).IAS,'.');
xlabel('Horizontal Displacement');
ylabel('Unfiltered Airpseed');
title('Airpseed vs Displacement')
end
hold off
  댓글 수: 1
bio lim
bio lim 2015년 5월 26일
It doesn't have to be different colours. I just want to be able to tell the difference between the plots of each indexes. Thanks.

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2015년 5월 26일
There is an enhanced plot routine in the file exchange that can use combinations of values to make multiple lines more visible; unfortunately I do not recall the submission name at the moment. One that would help would be http://www.mathworks.com/matlabcentral/fileexchange/47921-plotpub-publication-quality-graphs-in-matlab
In the meantime:
maxind = 46;
colortab = jet(maxind); %distinct colors
figure
hold on
for ind=1 : maxind,
plot(plane_des2(ind).Altitude, plane_des2(ind).IAS,'.', 'Color', colortab(ind,:));
if ind == 1 %save time on the rest
xlabel('Horizontal Displacement');
ylabel('Unfiltered Airpseed');
title('Airpseed vs Displacement');
end
end
hold off

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by