Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Set legend regardless of plot
Date: Wed, 10 Dec 2008 06:35:02 +0000 (UTC)
Organization: Lulea University of Technology
Lines: 24
Message-ID: <ghnnum$n5h$1@fred.mathworks.com>
References: <ghm163$20g$1@fred.mathworks.com> <bd617f21-3b2b-44f3-bc82-c49d76775871@f40g2000pri.googlegroups.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1228890902 23729 172.30.248.38 (10 Dec 2008 06:35:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 10 Dec 2008 06:35:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1595763
Xref: news.mathworks.com comp.soft-sys.matlab:506040


Srikanth <skt@xdtech.com> wrote in message <bd617f21-3b2b-44f3-bc82-c49d76775871@f40g2000pri.googlegroups.com>...
> On Dec 9, 8:00=A0am, "Chris " <chris.craws...@gmail.com> wrote:
> > Hi,
> > I'm having trouble setting my legend correctly. I have 3 sets of data plo=
> tted in a for loop which plot mulitple lines each. I want a single line in =
> the legend with a corresponding colour not an entry for each line.
> >
> > The line my books and searches on the internet have suggested is:
> > legend('-b','Ganymede','-g','Callisto','-k','Europa');
> >
> > but this displays six legend entrys - all of the same colour as the first=
>  6 lines calculated in the loop. Hopefully I'm missing something silly!
> >
> > Cheers,
> > Chris
> 
> Try getting a handle for the line(s) you want a legend(s) for - if
> there are more than one, just store them in a array and then use those
> handles to display your legend

You might be able to use this function (legendlinestyles)
http://www.mathworks.com/matlabcentral/fileexchange/22116

/JC