Thread Subject: Only show a few signals in legend

Subject: Only show a few signals in legend

From: Henrieke

Date: 6 Nov, 2009 09:55:05

Message: 1 of 2

Hi everyone!

I have a plot containing about 20 signals. I would like to display a legend which only contains a limited number of those signals...

Example: I only want to display a legend for signal A and C

If I use a code like this:

legend(['Signal A' 'C' ])

the legend will use the line color of Signal B instead of C.

a code like this

legend(['Signal A' ' ' 'C' ])

 will display all the linetypes in the legend witout giving a name for Signal B.

Anyone has an idea?
Thanks a lot
Henni

Subject: Only show a few signals in legend

From: Jos

Date: 6 Nov, 2009 12:19:01

Message: 2 of 2

"Henrieke " <Henni_Niermann@NOSPAMhotmail.com> wrote in message <hd0rpo$88k$1@fred.mathworks.com>...
> Hi everyone!
>
> I have a plot containing about 20 signals. I would like to display a legend which only contains a limited number of those signals...
>
> Example: I only want to display a legend for signal A and C
>
> If I use a code like this:
>
> legend(['Signal A' 'C' ])
>
> the legend will use the line color of Signal B instead of C.
>
> a code like this
>
> legend(['Signal A' ' ' 'C' ])
>
> will display all the linetypes in the legend witout giving a name for Signal B.
>
> Anyone has an idea?
> Thanks a lot
> Henni

Use the plot handles to create the legend.

H = plot(rand(10,4),'-') % 4 lines
legend(H([1 3]),{'1st signal','3rd signal'})

hth
Jos

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
legend selected... Henrieke 6 Nov, 2009 04:59:07
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com