Re: [R] Thousand separator in format of axis

From: Marc Schwartz <MSchwartz_at_mn.rr.com>
Date: Sun 17 Sep 2006 - 22:24:33 GMT

On Sun, 2006-09-17 at 17:47 -0400, Ruben Roa Ureta wrote:
> Hi:
> How can i make that the numbers in the tick annotations of an axis be
> written as, say 20 000 and not 20000 (i.e. with the little gap seprating
> thousands)?
> Thanks
> Ruben

There are several ways to format numbers:

  ?format
  ?sprintf  
  ?formatC

A quick example:

 y <- seq(0, 100000, 10000)  

 # Set the y axis so that it does not get drawn  # See ?par
 plot(1:11, y, yaxt = "n", ylab = "")

 # Use formatC() and set 'big.mark' to " "  # See ?axis also
 axis(2, at = y, labels = formatC(y, big.mark = " ", format = "d"),

      las = 2)  

HTH, Marc Schwartz



R-help@stat.math.ethz.ch 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. Received on Mon Sep 18 08:27:15 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sun 17 Sep 2006 - 23:30:05 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.