Hi, When I plot, the axis ticks are printed as "50.00 25.00 10.00 1.00 0.05 0.01", is there any way to print them as "50 25 10 1 0.05 0.01" instead? Thanks John
On Aug 16, 2010, at 3:53 PM, array chip wrote:> Hi, > > When I plot, the axis ticks are printed as "50.00 25.00 10.00 > 1.00 0.05 > 0.01", is there any way to print them as "50 25 10 1 0.05 0.01" > instead?No example, so we don't even know which of the three plotting paradigms you might be using, but if these are base graphics perhaps something along ht elines of: ... , labels =c("50", "25", "10", "1", "0.05", "0.01"), ... -- David Winsemius, MD West Hartford, CT
Try this: x <- c(50,25,5,1,.1,.05) prettyNum(x) On Mon, Aug 16, 2010 at 4:53 PM, array chip <arrayprofile@yahoo.com> wrote:> Hi, > > When I plot, the axis ticks are printed as "50.00 25.00 10.00 1.00 0.05 > 0.01", is there any way to print them as "50 25 10 1 0.05 0.01" > instead? > > Thanks > > John > > ______________________________________________ > 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. >-- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]
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.
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? 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.