Bill et al,

See ?axTicks


plot(3^(0:5), 0:5, log="x",axes=FALSE)


> axTicks(1)
[1]   1   2   5  10  20  50 100 200

> axTicks(2)
[1] 0 1 2 3 4 5


HTH,

Marc Schwartz


On Aug 16, 2010, at 5:17 PM, William Dunlap wrote:

> 
>> -----Original Message-----
>> From: r-help-boun...@r-project.org 
>> [mailto:r-help-boun...@r-project.org] On Behalf Of array chip
>> Sent: Monday, August 16, 2010 2:54 PM
>> To: Wu Gong; r-help@r-project.org
>> Subject: Re: [R] print numbers
>> 
>> Thank you all for the suggestions. They all worked. Now, 
>> those numbers on the 
>> ticks are produced by default plot function "bxp()", i.e. 
>> they are different in 
>> each plot, is there any functions I can retrieve them so I 
>> can use formatC() or 
>> prettyNum() etc?
> 
> I've been curious about that also.  I've used
> the kludge of calling axis with a transparent color
> to get the default positions of the tick marks,
> but I don't know the official way to do it:
>> plot(3^(0:5), 0:5, log="x",axes=FALSE)
>> xTicks <- axis(side=1, col.axis="#00000000")
>> xTicks
>  [1]   1   2   5  10  20  50 100 200
>> axis(side=1, at=xTicks, lab=as.character(as.roman(xTicks)))
> 
>> yTicks <- axis(side=2, col.axis="#00000000")
>> yTicks
>  [1] 0 1 2 3 4 5
>> axis(side=2, at=yTicks, lab=sprintf("%02d", yTicks))
> 
> Bill Dunlap
> Spotfire, TIBCO Software
> wdunlap tibco.com 
>> 
>> Thanks again,
>> 
>> John
>> 
>> 
>> 
>> ----- Original Message ----
>> From: Wu Gong <w...@mtmail.mtsu.edu>
>> To: r-help@r-project.org
>> Sent: Mon, August 16, 2010 2:41:51 PM
>> Subject: Re: [R] print numbers
>> 
>> 
>> Hi John,
>> 
>> formatC will do your work. Hope it helps.
>> 
>> x <- y <- c(50.00,25.00,10.00,1.00,0.05,0.01)
>> plot(x,y,log = "xy",axes = F)
>> axis(1, x, formatC(x))
>> axis(2, y, formatC(y))
>> 
>> Regards,
>> 
>> Wu

______________________________________________
R-help@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.

Reply via email to