1

Possible Duplicate:
Automatically plot different colored lines in MATLAB

I have the following data

X <25x139 double>
t <25x1 double>
names <139x1 cell>

So essentially t is time, and X is a matrix of 139 different samples at each time interval, where names is an array of each of those sample names.

I want to plot (on the same axis) a range of my samples against time, where each line has

a) A different color

b) A legend name

Community
  • 1
  • 1
Alex
  • 2,000
  • 4
  • 23
  • 41
  • 2
    This has been covered a number of times in other questions. For plotting different colored lines: [Automatically plot different colored lines in MATLAB](http://stackoverflow.com/q/2028818/52738), [Matlab choose random color for plotting](http://stackoverflow.com/q/3225206/52738)... For dealing with legends, look through what you get from [this SO search](http://stackoverflow.com/search?q=[matlab]+legend), or check the [LEGEND documentation](http://www.mathworks.com/help/techdoc/ref/legend.html). – gnovice Aug 05 '11 at 18:21
  • 1
    @ash: a warning: at 139 samples, you will have a really hard time finding that many visually distinguishable colors, plus the legend will be huge with 139 entries.. – Amro Aug 06 '11 at 01:34

1 Answers1

2

does this work?

plot(t,X);legend(names);
BlessedKey
  • 1,615
  • 1
  • 10
  • 16