How can I plot multiple lines with a slightly different shade of the same color?

36 ビュー (過去 30 日間)
Loek Meijers
Loek Meijers 2019 年 6 月 4 日
回答済み: Caroline 2019 年 11 月 19 日
Hi all,
I'm trying to create a figure in which I plot the data of around 20 measurement sequences from one experiment. I would like to be able to differentiate between these 20 lines by plotting each of them in a slightly different color of gray. These lines will then represent the 'population' data.
Whenever a measurement of the same quantity is done in the future, the line representing the data acquired could be plotted in red, while the population data would then be plotted in the background in different shades of gray as a comparison.
The loop used for plotting the different lines looks like this:
figure('name','Population data')
for ii = 1:20
plot(time,freqlist{ii});
hold on;
end
Here, freqlist would be a cell structure with a range of different frequency measurement series. Does anyone know a way to first define the starting color and then slightly change this color with each iteration?

採用された回答

Jan
Jan 2019 年 6 月 4 日
startColor = [0.5, 0.5, 0.5];
for ii = 1:20
plot(time, freqlist{ii}, 'Color', startColor + (ii-1) / 40);
hold on;
end

その他の回答 (1 件)

Caroline
Caroline 2019 年 11 月 19 日
how can i do it in spectrum 1 color e.g. blue, green? (various shades)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by