Use the same color multiple times in a plotting loop
30 ビュー (過去 30 日間)
古いコメントを表示
Hello everyone,
I have a problem with a plotting loop, where I am plotting the spectral data and following the fit. For the reason of clarity I want to have them both in the same color, however matlab switches to the next color in order. Can anyone give me hint how to avoid this?
Ralf
3 件のコメント
採用された回答
Narges M
2013 年 7 月 24 日
編集済み: Narges M
2013 年 7 月 24 日
You could use a colormap such as HSV to generate a set of colors. For example:
folder=dir('*.csv');
N = length(folder);
col=hsv(N);
for i=1:N
file=folder(i,1).name;
A=csvread(file);
plot(A(:,1),A(:,2),'color',col(i,:));
hold all
f(:,1)=A(:,1);
f(:,2)=smooth(A(:,2),0.01,'lowess');
plot(f(:,1),f(:,2),'--','color',col(i,:));
end
You can read more in Matlab documentations: http://www.mathworks.com/help/techdoc/creating_plots/bqsxy_a-1.html
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Scatter Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!