Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: legend interpreter

Subject: legend interpreter

From: Cora

Date: 08 May, 2008 20:46:05

Message: 1 of 3

Hi,

I try to get my filename e.g.orange 4.70_02 displayed in
the legend

unfortunately it displayes 0 as a subscript due to _ in
front of it. I know that this is due to 'Interpreter' 'tex'
and one possibility is to write it like
orange 4.70\_02 but I don't want to change this manually
because I read it in as an function input

function Flightdisplay(Filename,Na)
(e.g.Flightdisplay('*.txt','orange 4.70_02')

I tried
legend(Na, 'Interpreter', 'none')
but it gives me a warning:
Warning: Ignoring extra legend entries.

I tried
set(0,'DefaultTextInterpreter','none')
but this changes only the label on the x and y achses which
actually require 'Interpreter', 'tex', but not my legend.

Any ideas?
Perhaps a way to insert \ automatically in front of _ ?

Thanks


Subject: Re: legend interpreter

From: Bruno Luong

Date: 09 May, 2008 07:57:03

Message: 2 of 3

"Cora " <janatc@web.de> wrote in message
<fvvoqd$af3$1@fred.mathworks.com>...
> Hi,
>
> I try to get my filename e.g.orange 4.70_02 displayed in
> the legend
>
> unfortunately it displayes 0 as a subscript due to _ in
> front of it. I know that this is due to 'Interpreter' 'tex'
> and one possibility is to write it like
> orange 4.70\_02 but I don't want to change this manually
> because I read it in as an function input
>
> function Flightdisplay(Filename,Na)
> (e.g.Flightdisplay('*.txt','orange 4.70_02')
>
> I tried
> legend(Na, 'Interpreter', 'none')
> but it gives me a warning:
> Warning: Ignoring extra legend entries.
>
> I tried
> set(0,'DefaultTextInterpreter','none')
> but this changes only the label on the x and y achses which
> actually require 'Interpreter', 'tex', but not my legend.
>
> Any ideas?
> Perhaps a way to insert \ automatically in front of _ ?
>
> Thanks
>
>

regexprep(string,'_','\\_')

Bruno

Subject: Re: legend interpreter

From: Cora

Date: 10 May, 2008 16:06:02

Message: 3 of 3

"Bruno Luong" <b.luong@fogale.fr> wrote in message
<g0104f$93t$1@fred.mathworks.com>...
> "Cora " <janatc@web.de> wrote in message
> <fvvoqd$af3$1@fred.mathworks.com>...
> > Hi,
> >
> > I try to get my filename e.g.orange 4.70_02 displayed
in
> > the legend
> >
> > unfortunately it displayes 0 as a subscript due to _ in
> > front of it. I know that this is due
to 'Interpreter' 'tex'
> > and one possibility is to write it like
> > orange 4.70\_02 but I don't want to change this
manually
> > because I read it in as an function input
> >
> > function Flightdisplay(Filename,Na)
> > (e.g.Flightdisplay('*.txt','orange 4.70_02')
> >
> > I tried
> > legend(Na, 'Interpreter', 'none')
> > but it gives me a warning:
> > Warning: Ignoring extra legend entries.
> >
> > I tried
> > set(0,'DefaultTextInterpreter','none')
> > but this changes only the label on the x and y achses
which
> > actually require 'Interpreter', 'tex', but not my
legend.
> >
> > Any ideas?
> > Perhaps a way to insert \ automatically in front of _ ?
> >
> > Thanks
> >
> >
>
> regexprep(string,'_','\\_')
>
> Bruno
>

Thanks, that was very helpful
I also realized that
h=legend(Na);
set(h,'Interpreter','none')
istead of legend(Na, 'Interpreter', 'none') works

Tags for this Thread

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.

rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
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 Disclaimer prior to use.
Related Topics