The following is a part of my matlab code. As it\'s shown, I would like to plot 8 curves in one plot. But I want to make each curve with one unique color. I also want to cha
Just use hold all
instead of hold on
and put the legend labels in a cell array
hold all
for i=1:8
.
.
.
plot(b,r);
Leg{i} = ['qho-',num2str(i)];
end
legend(Leg)
See this question for example: Sparse matrix plot matlab
NOTE:
From Matlab R2014b onward, hold on
has been modified to act like hold all
, i.e. change the colours of the plots each time one is plotted. The docs state that the hold all
syntax will be removed in future releases.