Got Questions? Get Answers.
Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
show some particular legend in a plot?

Subject: show some particular legend in a plot?

From: Kuo-Hsien

Date: 5 Sep, 2012 12:37:08

Message: 1 of 2

Dear all,

I have a plot and like to show some particular legend in a plot. Could you please give me some help?

Here is the sample code:
a = 1:10;
b = sin(a);
plot(1:5,a(1:5),'r-',5:10,a(5:10),'b-','DisplayName','legn2txt'); hold on
plot(1:5,b(1:5),'g-',5:10,b(5:10),'m-','DisplayName','legn4txt'); hold on

How to particularly show the "legn2txt" and "legn4txt"?

Thanks for helping me.

Cheers,
Michael

Subject: show some particular legend in a plot?

From: dpb

Date: 5 Sep, 2012 13:11:56

Message: 2 of 2

On 9/5/2012 7:37 AM, Kuo-Hsien wrote:
> Dear all,
>
> I have a plot and like to show some particular legend in a plot. Could
> you please give me some help?
>
> Here is the sample code:
> a = 1:10;
> b = sin(a);
> plot(1:5,a(1:5),'r-',5:10,a(5:10),'b-','DisplayName','legn2txt'); hold on
> plot(1:5,b(1:5),'g-',5:10,b(5:10),'m-','DisplayName','legn4txt'); hold on
>
> How to particularly show the "legn2txt" and "legn4txt"?
...

Looking at the doc's you can group stuff for a legend -- look at the
examples at the following links (basically going to PLOT() and following
the references there) and should get you there methinks altho my version
predates this stuff so can't test it out here:

<http://www.mathworks.com/help/techdoc/creating_plots/braliom.html>
<http://www.mathworks.com/help/techdoc/ref/lineseriesproperties.html>

--

Tags for 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.

Contact us