Thank you to Peter Dalgaard, who provided help for some of this solution. It is still not ideal since the dots which are equidistant in the x-direction ideally should respect the reciprocal scale in the y-direction. op <- par("cex"= 0.7) x<-y<-NA plot(x,y,xlim=c(0,10),ylim=1/c(2000,70), axes=F) box() axis(1) pretty.y<-c(70,80,90,100,110,120,130,140,150,160,180,200,220,250,300,350,400,500,600,800,1200,2000) axis(2,at=1/pretty.y,labels=(pretty.y),las=2) axis(4) # for comparison abline(h=1/pretty.y) grid(nx=10,ny=0,col="black",lty="solid") grid(nx=120,ny=0,col="black",lty="dotted") par(op) -----Oprindelig meddelelse----- Fra: Troels Ring <tring at mail1.stofanet.dk> Til: R-help <r-help at stat.math.ethz.ch> Dato: 20. november 1999 12:57> >Dear friends. > >I wanted to reproduce a sheet of paper useful for plotting the reciprocal of some biochemical variable (creatinine) over time (Bleyer Am J Kidney Dis 34:576-578,1999). Time on X axis with units years and months. On Y axis, 1/creatinine, but with the original creatinine value indicated - to make it easier for people to use it. When using the graph, the linear decrease in 1/crea over time will be useful for managing patients. Here is what I came up with, but how do I configure the Y axis with the natural values 40-2000 umol/l alongside their reciprocal representation, so that 1/crea will be a stright line ? > > x <- NA > y <- NA > plot(x,y,xlim=c(0,10),ylim=c(40,2000)) > grid(nx=10,ny=10,col="black",lty="solid") > grid(nx=120,ny=10,col="black",lty="dotted") > >Troels Ring, M.D >Department of Nephrology >Aalborg, Denmark >tring at mail1.stofanet.dk > >-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- >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 >_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ >-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
"Troels Ring" <tring at mail1.stofanet.dk> writes:> Thank you to Peter Dalgaard, who provided help for some of this > solution.(The remark on rev() was confused. I had been working with ylim=1/c(40,2000), which comes surprisingly close to working, but leaves problems with inverted signs in various places. Then I fixed it at the last moment and didn't see that the labeling issue had changed)> It is still not ideal since the dots which are equidistant > in the x-direction ideally should respect the reciprocal scale in > the y-direction. > > op <- par("cex"= 0.7) > x<-y<-NA > plot(x,y,xlim=c(0,10),ylim=1/c(2000,70), axes=F) > box() > axis(1) > pretty.y<-c(70,80,90,100,110,120,130,140,150,160,180,200,220,250,300,350,400,500,600,800,1200,2000) > axis(2,at=1/pretty.y,labels=(pretty.y),las=2) > axis(4) # for comparison > abline(h=1/pretty.y) > grid(nx=10,ny=0,col="black",lty="solid") > grid(nx=120,ny=0,col="black",lty="dotted") > par(op)You should probably drop the dotted grid lines in favor of abline(h=1/prettyfine.y) with something like prettyfine.y<-c(71:79,seq(82,88,2),seq(92,98,2),seq(102,108,2), seq(125,145,10),seq(170,210,20),275,325,450,700) abline(h=1/prettyfine.y,lty='dotted') -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._