[R] Reversing axis in a log plot

Christian Marquardt marquardt.christian at gmail.com
Thu May 19 16:29:58 CEST 2005


Hello,

apologies if I'm overlooking the obvious... I would like to revert a
logarithmic axis with R 2.1.0 on Linux, e.g. for using pressure as a
vertical coordinate. Say we have

  x = seq(1,3, by = 0.01)
  y = exp(x)

Plotting and reversing linear axis is fine

   plot(x,y)
   plot(x,y, ylim = c(30,1))

as is a usual log-plot:

  plot(x,y, log = "y", ylim = c(1,30))

However,

  plot(x,y, log = "y", ylim = c(30,1))

fails with

  Error in axis(2, ...) : log - axis(), 'at' creation, _SMALL_ range:
invalid {xy}axp or par;
         axp[0]= 10, usr[0:1]=(34.3721,0.872801)
  In addition: Warning message:
  CreateAtVector "log"(from axis()): usr[0] = 34.3721 > 0.872801 = usr[1] !

What am I doing wrong here?

Thanks a lot,

  Christian.




More information about the R-help mailing list