[R] print numbers
array chip
arrayprofile at yahoo.com
Tue Aug 17 00:57:34 CEST 2010
Marc, this works perfectly!
Thanks
John
----- Original Message ----
From: Marc Schwartz <marc_schwartz at me.com>
To: William Dunlap <wdunlap at tibco.com>
Cc: array chip <arrayprofile at yahoo.com>; r-help at r-project.org
Sent: Mon, August 16, 2010 3:23:33 PM
Subject: Re: [R] print numbers
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-bounces at r-project.org
>> [mailto:r-help-bounces at r-project.org] On Behalf Of array chip
>> Sent: Monday, August 16, 2010 2:54 PM
>> To: Wu Gong; r-help at 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 <wg2f at mtmail.mtsu.edu>
>> To: r-help at 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
More information about the R-help
mailing list