Change automatically colors and line style
Afficher commentaires plus anciens
Hello,
I'm sure my question has already been asked but I wasn't able to find it.
I'm plotting several functions in a loop such as:
for n=1:10
[Y{1,n},V]=f_regression(M(n,:),k,1);
hold all
h(n)=plot(V(:,i),Y{1,n}(:,i));
end
I want each function to have its own color. hold all changes ideed the color but a lot of them are the same color.
Is it possible to have strictly different colors or maybe change the line style when the color is the same?
Thanks for helping.
Réponse acceptée
Plus de réponses (1)
Henric Rydén
le 11 Juin 2014
Yes it's possible. Check the predefined colormaps here:
colors = jet(10);
for n=1:10
[Y{1,n},V]=f_regression(M(n,:),k,1);
hold all
h(n)=plot(V(:,i),Y{1,n}(:,i),'Color',colors(n,:));
end
1 commentaire
Alain
le 12 Juin 2014
Catégories
En savoir plus sur Blue dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!