[R] How to align the text in the legend

jim holtman jholtman at gmail.com
Thu Nov 29 23:26:03 CET 2007


try this when plotting the legend:

plot(...)
par(family='mono')
legend('topright', legend=....)

This should use fixed width fonts for your legend.

On Nov 29, 2007 4:20 PM, Wang, Zhaoming (NIH/NCI) [C]
<wangzha at mail.nih.gov> wrote:
> Can you give me a little more in detail?  I'm new to this.
> Thanks
> Zhaoming
>
>
> -----Original Message-----
> From: jim holtman [mailto:jholtman at gmail.com]
> Sent: Thursday, November 29, 2007 4:05 PM
> To: Wang, Zhaoming (NIH/NCI) [C]
> Cc: r-help at r-project.org
> Subject: Re: [R] How to align the text in the legend
>
> Have you tried a non-proportional font like Courier?
>
> On Nov 29, 2007 12:14 PM, Wang, Zhaoming (NIH/NCI) [C]
> <wangzha at mail.nih.gov> wrote:
> > Hello,
> >
> >
> >
> > I tried to align lines of text in the legend of a plot.  It always
> > defaults to the central alignment.  How can I adjust it to be left
> > alignment?
> >
> > Here is the code fragment written in python using Rpy module:
> >
> >
> >
> >  text = 'Quantiles     #Loci\n'
> >
> >  text += '%s         %6d\n' % (' 100',totalloci)
> >
> >  text += '%s         %6d\n' % ('  95',per95cntloci)
> >
> >  text += '%s         %6d\n' % ('  50',per50cntloci)
> >
> >  r.legend(20,30,text,cex=0.6,bty='n')
> >
> >
> >
> >
> >
> > Thanks
> >
> > Zhaoming
> >
> >
> >        [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
>
>
> --
> Jim Holtman
> Cincinnati, OH
> +1 513 646 9390
>
> What is the problem you are trying to solve?
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?



More information about the R-help mailing list