Path: news.mathworks.com!newsfeed-00.mathworks.com!nlpi057.nbdc.sbc.com!prodigy.net!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!f40g2000pri.googlegroups.com!not-for-mail
From: Srikanth <skt@xdtech.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Set legend regardless of plot
Date: Tue, 9 Dec 2008 08:39:34 -0800 (PST)
Organization: http://groups.google.com
Lines: 18
Message-ID: <bd617f21-3b2b-44f3-bc82-c49d76775871@f40g2000pri.googlegroups.com>
References: <ghm163$20g$1@fred.mathworks.com>
NNTP-Posting-Host: 75.174.211.81
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1228840775 22241 127.0.0.1 (9 Dec 2008 16:39:35 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Tue, 9 Dec 2008 16:39:35 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: f40g2000pri.googlegroups.com; posting-host=75.174.211.81; 
	posting-account=j_XsrAkAAACkxxx2VHf0sFm-lsgqPZjc
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.4) 
	Gecko/2008102920 Firefox/3.0.4,gzip(gfe),gzip(gfe)
Bytes: 1927
Xref: news.mathworks.com comp.soft-sys.matlab:505879


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