[R] How to align the text in the legend

Wang, Zhaoming (NIH/NCI) [C] wangzha at mail.nih.gov
Thu Nov 29 21:51:22 CET 2007


Thanks Petr!
I checked both of your suggestions and nothing seems working for me.
I don't understand why the well-formatted text string got re-aligned in
the legend of plot.

This is what I got:
Quantitles   #Samples
 100            2759
  95             121
  50              0

And here is what I'm looking for:
Quantitles   #Samples
 100             2759
  95              121
  50                0


-----Original Message-----
From: Petr PIKAL [mailto:petr.pikal at precheza.cz] 
Sent: Thursday, November 29, 2007 12:35 PM
To: Wang, Zhaoming (NIH/NCI) [C]
Cc: r-help at r-project.org
Subject: Odp: [R] How to align the text in the legend

Well, did you look at xjust, yjust options of legend?
And maybe it would be worth to check adj graphic parameter see ?par

Petr

r-help-bounces at r-project.org napsal dne 29.11.2007 18:14:55:

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



More information about the R-help mailing list