MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

 Subject: Problem with adding legend? From: niko rose Date: 21 Feb, 2010 18:02:02 Message: 1 of 6 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.
 Subject: Problem with adding legend? From: Bruno Luong Date: 21 Feb, 2010 19:10:05 Message: 2 of 6 "niko rose" wrote in message ... > 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
 Subject: Problem with adding legend? From: Sadik Date: 21 Feb, 2010 19:10:06 Message: 3 of 6 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" wrote in message ... > 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.
 Subject: Problem with adding legend? From: niko rose Date: 21 Feb, 2010 19:55:05 Message: 4 of 6 "Bruno Luong" wrote in message ... > "niko rose" wrote in message ... > > 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 :)
 Subject: Problem with adding legend? From: Bruno Luong Date: 21 Feb, 2010 21:52:02 Message: 5 of 6 > 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
 Subject: Problem with adding legend? From: yaya yoyo Date: 22 Feb, 2010 05:42:06 Message: 6 of 6 "Bruno Luong" wrote in message ... > > 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 It works! Thank you :)

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.