change the color of multi lines in a graph

5 Ansichten (letzte 30 Tage)
Andrea
Andrea am 24 Aug. 2012
I have a function in a loop in which something plots and hold on the previous ones. After the loop I have a figure with 6 line (graph) in it. I want to change the color of each one but I simply cannot! can you please help me?
Kind Regards, Andrea

Akzeptierte Antwort

Doug Hull
Doug Hull am 24 Aug. 2012
when you create each one, you can specify the color:
colVec = [1 0 1;
0 1 1;
1 1 0]
clf
for i = 1:3
plot([1,2],rand(1,2),'color',colVec(i,:))
hold on
end
Alternately, you could save the handles as you are making these and set the colors later.

Weitere Antworten (0)

Kategorien

Mehr zu Color and Styling finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by