Question on plots i,e different line properties
6 ビュー (過去 30 日間)
古いコメントを表示
I am plotting a 2-D matrix using only one command
colorlinestyle1 = {'r-*','g-*','b-*','k-*','m-*','c-*','r-+','g-+','b-+','k-+','m-+','c-+','r-<','g-<','b-<','k-<','m-<','c-<'};
for i=1:1:size(z1,2)-1 figure{i} plot(a5(z1(i):(z1(i+1)-1),5:20)',colorlinestyle1{1:size(z1(i):(z1(i+1)-1))}); end
In the 'For' loop each time I execute the loop a new figure is opened, and on each figure I have around 2 to 12 different lines depending on the value of 'i' . When I try to plot using the above command all the lines are showing in same format i,e "r-*" . I wish to have different format for different lines in a particular figure window. I also want to keep the ordering of the line format same i,e they should follow the order of 'colorstyle1' variable
0 件のコメント
回答 (2 件)
Honglei Chen
2012 年 10 月 31 日
You can use LineStyleOrder and ColorOrder to achieve the combination between color and line style. However, I'm not aware an interface to define an order markers.
0 件のコメント
Jonathan Epperl
2012 年 10 月 31 日
Easiest would probably be to use an additional for-loop to fill figure{i}. Had you formatted your code I would have maybe been able to use your variables, but so I'll give you a general example:
colorlinestyle1 = {'r-*','g-*','b-*','k-*','m-*','c-*','r-+','g-+','b-+','k-+','m-+','c-+','r-<','g-<','b-<','k-<','m-<','c-<'};
for i=1:1:size(z1,2)-1
figure(i) % select the i-th figure
for j=1:number_of_lines(i)
plot(xdata(i,j),ydata(i,j),colorlinestyle1{j})
% Plot the j-th line in the i-th plot, using style j
hold on % keep on plotting in figure i
end
hold off % release figure i
end
参考
カテゴリ
Help Center および File Exchange で Line Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!