Help with plotting multiple line complete with legends.
Afficher commentaires plus anciens
Hi there, This question has a few parts so bare with me if it seems confused, I'll try my best to be clear. My problem is this, I want to plot 11 lines in different colours on the same graph complete with legends. As you all know I should be able plot with the command -- plot(x,y,'blue',x,z'red......). I run out of colours with specific names and therefore have to define them with [rand1,rand2,rand3]. To use a color like this I have to use 'color' before using the 1:3 color matrix with the plot command. So now I have - plot(x,y,blue,.....x,n,'color',[rand1,rand2,rand3]) This turns all the lines the same colour as [rand1,rand2,rand3] ! In addition to this I don't really like having to write one massive plot command, I would prefer to do it in a for loop, In this loop I would like to be able to add legends as I go. But only one legend is ever added! So if anyone has a solution to my problem (Maybe making some sort of color map if there isn't anything simpler..) I would be very much in your debt. Thanks in advance. Tim.
Réponse acceptée
Plus de réponses (1)
Kevin Holst
le 7 Mar 2012
0 votes
Tim,
See a previous answer that I helped a guy out with here:
Also, 11 different colors will be fairly jumbled on a plot, in my opinion. Have you thought of using 4 colors and 3 line styles?
Catégories
En savoir plus sur Legend 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!