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
> format(10000, big.mark=" ")[1] "10 000"> format(seq(10000,100000,10000), big.mark=" ", scientific=FALSE)[1] " 10 000" " 20 000" " 30 000" " 40 000" " 50 000" " 60 000" " 70 000" [8] " 80 000" " 90 000" "100 000"> plot(seq(10000, 100000, 10000), yaxt="n") > axis(2, at=seq(10000, 100000, 10000), labels=format(seq(10000,100000,10000),+ big.mark=" ", scientific=FALSE))
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 > RubenThere 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