[R] print numbers

William Dunlap wdunlap at tibco.com
Tue Aug 17 00:17:24 CEST 2010


> -----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
> 
> -----
> A R learner.
> -- 
> View this message in context: 
> http://r.789695.n4.nabble.com/print-numbers-tp2327378p2327525.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> 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.
> 
> ______________________________________________
> 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