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

Contact us at files@mathworks.com