[R] comma as decimal separator in plots

Antonio Olinto aolinto at bignet.com.br
Sat Jan 19 06:01:32 CET 2002


Hi,

Some time ago I asked about how to use comma as decimal separator in plots
and Mr. Paul Murrell wrote:
-------
You could try something with axis() and chartr(), like ...
    par(mfrow=c(2,1))
    plot(1:10/11, rep(1, 10), main="Standard X-Axis")
    plot(1:10/11, rep(1, 10), main="Customised X-Axis", axes=F)
    axis(1, at=pretty(1:10/11),
        labels=chartr(".", ",", as.character(pretty(1:10/11))))
    axis(2)
    box()
-------

This was very useful to me, but in the example:

x <- rnorm(50, mean=2, sd=0.1)
y <- rnorm(50, mean=2, sd=0.2)
plot(x,y)
axis(1,at=pretty(x),labels=chartr(".", ",", as.character(pretty(x))))
axis(2,at=pretty(y),labels=chartr(".", ",", as.character(pretty(y))))

I got an "2" in the middle of  the "2.0". How could I avoid it?

Thanks very much,

Antonio Olinto


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list