how to produce multtiple stacked plots with different colors in a for loop?

4 次查看(过去 30 天)
I am producing multiple plots in a for loop in one axis. Any idea to produce different colors for each plot? It will be ~60 plots stacked on each other.
Beacuse plots are stacked in a for loop I cant give individual color as usual.

采纳的回答

Daniel M
Daniel M 2019-10-25
You can use the power of colormaps (link) to do this. Here is an example:
t = 0:0.001:1;
figure
col = jet(60);
for k = 1:60
x = sin(2*pi*5*t + k/60);
plot(t,x,'-','Color',col(k,:));
hold on
end

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by