From: niko rose on
Hello,
My data are aranged by days and for each day I plot several trial in the same color. I would like my legend to be per day only! That is, say I plotted 5 trials for day 1 and 3 trials for day 2, then my legend should be composed of TWO LINES ONLY, one for DAY1 and one for DAY2. Currently, the legend creates a number of lines iddentical to the number of lines in the plot. Does anyone know how I can change to the way of presentation described above?
Thank you.
From: Bruno Luong on
"niko rose" <mymatlab101(a)gmail.com> wrote in message <hlrseq$ove$1(a)fred.mathworks.com>...
> HDoes anyone know how I can change to the way of presentation described above?

Yes, pass the array of handles of the selected lines as the first argument to LEGEND.

Bruno
From: Sadik on
If I am understanding correctly, you can solve the problem very easily.

Just plot 1 trial of day1 and then a trial of day 2. Now put your legend. And then continue and finish your drawings. That's it.

Best.

"niko rose" <mymatlab101(a)gmail.com> wrote in message <hlrseq$ove$1(a)fred.mathworks.com>...
> Hello,
> My data are aranged by days and for each day I plot several trial in the same color. I would like my legend to be per day only! That is, say I plotted 5 trials for day 1 and 3 trials for day 2, then my legend should be composed of TWO LINES ONLY, one for DAY1 and one for DAY2. Currently, the legend creates a number of lines iddentical to the number of lines in the plot. Does anyone know how I can change to the way of presentation described above?
> Thank you.
From: niko rose on
"Bruno Luong" <b.luong(a)fogale.findmycountry> wrote in message <hls0ed$hbt$1(a)fred.mathworks.com>...
> "niko rose" <mymatlab101(a)gmail.com> wrote in message <hlrseq$ove$1(a)fred.mathworks.com>...
> > HDoes anyone know how I can change to the way of presentation described above?
>
> Yes, pass the array of handles of the selected lines as the first argument to LEGEND.
>
> Bruno


Didn't understand. Can you please give an example for how you "pass the array of handles of the selected lines as the first argument to LEGEND" ???
Thank you :)
From: Bruno Luong on
> Didn't understand. Can you please give an example for how you "pass the array of handles of the selected lines as the first argument to LEGEND" ???
> Thank you :)

h=plot(rand(10,5))
legend(h([1 end]), 'first','last')

% Bruno