Clear Filters
Clear Filters

How to plot curve with one color without precising which color it is?

1 view (last 30 days)
How can I plot curves with the same color without having to determine exactly what color I want? The plot function is inside a for loop and for each iteration I want to have a group of curves with the same color.

Accepted Answer

Philippe Lebel
Philippe Lebel on 11 Dec 2019
for i = 1:10
if i == 1
h = plot(1:10,1:2*i:20*i)
v = get(h,'Color');
plot(1:10,1:2*i:20*i, 'Color', v)
hold on

More Answers (0)


Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!