[R] How to create a legend without plot, and to use scientific notation for axes label ?

Stanley Ng stanleyngkl at gmail.com
Thu Apr 10 12:33:26 CEST 2008


Hi, 

How can I use formatC to convert 6000000 to 6e5 and not 6e+05 ?

> formatC(600000)
[1] "6e+05"
> formatC(600000, format="e", digit=0)
[1] "6e+05"

-----Original Message-----
From: Uwe Ligges [mailto:ligges at statistik.tu-dortmund.de] 
Sent: Thursday, April 10, 2008 17:11
To: Ng Stanley
Cc: r-help
Subject: Re: [R] How to create a legend without plot, and to use scientific
notation for axes label ?



Uwe Ligges wrote:
> 
> 
> Ng Stanley wrote:
>> Hi,
>>
>> I have a 3 by 2 plots per page, and would like to place a legend on 
>> the last region. How to do that ?
> 
> 
> Create an empty plot, e.g.:
> 
> plot(1, type="n", axes=FALSE, xlab="", ylab="")
> legend(1, 1, legend = c("Hello", "World"), col=1:2,
>        lwd=2, cex=3, xjust=0.5, yjust=0.5)
> 
> Uwe Ligges
> 
> 
> 
>> Also, is there any way to specify scientific notation for axes label ?


Oh, I was too quick and forgot the 2nd question:
Use axis() with formatC().

Uwe Ligges





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