Thread Subject: How to add textbox like legend & line breaks?

Subject: How to add textbox like legend & line breaks?

From: Joe Duchtel

Date: 18 Sep, 2009 15:31:14

Message: 1 of 5

Hello -

I was wondering if there is a way in MATLAB to add a legend to a plot
using the legend('Location', 'XYZ') command without being associated
with any data? I looked into using the textbox but it is much more
difficult to specify the position ... something legend() already
does. Maybe there is a way to not show the little leading sample line
in a legend?

I was also wondering if there is any way to use a line break in the
text of a legend. It did not like the \n.

Thanks!
Joe

Subject: How to add textbox like legend & line breaks?

From: Jan Simon

Date: 18 Sep, 2009 15:55:06

Message: 2 of 5

Dear Joe!

> I was also wondering if there is any way to use a line break in the
> text of a legend. It did not like the \n.

You don't *like* it?! Does it work?
Does a cell string work?

KInd regards, Jan

Subject: How to add textbox like legend & line breaks?

From: John

Date: 18 Sep, 2009 16:58:02

Message: 3 of 5

Try using sprintf for inserting '\n'

Joe Duchtel <duchtel@gmail.com> wrote in message <1bed937a-e442-42bf-8acb-9a6dfb13d73f@p15g2000vbl.googlegroups.com>...
> Hello -
>
> I was wondering if there is a way in MATLAB to add a legend to a plot
> using the legend('Location', 'XYZ') command without being associated
> with any data? I looked into using the textbox but it is much more
> difficult to specify the position ... something legend() already
> does. Maybe there is a way to not show the little leading sample line
> in a legend?
>
> I was also wondering if there is any way to use a line break in the
> text of a legend. It did not like the \n.
>
> Thanks!
> Joe

Subject: How to add textbox like legend & line breaks?

From: Joe Duchtel

Date: 18 Sep, 2009 17:13:47

Message: 4 of 5

On Sep 18, 12:58 pm, "John" <sj...@cnbc.cmu.edu> wrote:
> Try using sprintf for inserting '\n'
>
>
>
> Joe Duchtel <duch...@gmail.com> wrote in message <1bed937a-e442-42bf-8acb-9a6dfb13d...@p15g2000vbl.googlegroups.com>...
> > Hello -
>
> > I was wondering if there is a way in MATLAB to add a legend to a plot
> > using the legend('Location', 'XYZ') command without being associated
> > with any data?  I looked into using the textbox but it is much more
> > difficult to specify the position ... something legend() already
> > does.  Maybe there is a way to not show the little leading sample line
> > in a legend?
>
> > I was also wondering if there is any way to use a line break in the
> > text of a legend.  It did not like the \n.
>
> > Thanks!
> > Joe- Hide quoted text -
>
> - Show quoted text -

Subject: How to add textbox like legend & line breaks?

From: Joe Duchtel

Date: 18 Sep, 2009 17:13:58

Message: 5 of 5

On Sep 18, 11:55 am, "Jan Simon" <matlab.THIS_Y...@nMINUSsimon.de>
wrote:
> Dear Joe!
>
> > I was also wondering if there is any way to use a line break in the
> > text of a legend.  It did not like the \n.
>
> You don't *like* it?! Does it work?
> Does a cell string work?
>
> KInd regards, Jan

Hello -

With *like* I meant ... Warning: Unable to interpret TeX string "\n".
I just tried sprintf and it works beautifully ... thanks!

Any suggestions on how to place a textbox() the same way as a legend
()?

Thanks,
Joe

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
sprintf Sprinceana 18 Sep, 2009 13:01:19
add legend to plot Sprinceana 18 Sep, 2009 13:01:19
legend to plot Sprinceana 18 Sep, 2009 13:01:19
legend Sprinceana 18 Sep, 2009 13:01:19
plot Sprinceana 18 Sep, 2009 13:01:19
rssFeed for this Thread

Contact us at files@mathworks.com