[R] problem with log axis

R Heberto Ghezzo, Dr heberto.ghezzo at mcgill.ca
Thu Nov 1 18:40:28 CET 2007


Hello,
if I do:
  x <- c(0.5,1,3,6,10,20,40)
  y <- 10-log(x)+rnorm(7,0,0.05)
  r1 <- lm(y ~ log(x))
  plot(log(x),y)
  abline(r1)
#
I get a nice plot with the regression line almost over the points.
but:
  plot(x,y,log="x")
  abline(r1)
gives me exactly the same plot for the points but the regression line
is completely off !
I would like the plot with the real values of X on the axis, not the log(X)
can somebody tell me why the "abline" is not correct in the second case?
Thanks
H.Ghezzo
McGill University
Montreal - Canada



More information about the R-help mailing list