[R] xaxp with dates

Uwe Ligges ligges at statistik.uni-dortmund.de
Thu Apr 27 10:15:29 CEST 2000


> As promised ver 1.01 solved the former problem and now dates plot OK in
> windows. But.
> In the following code, "cex.axis"=0.5 works OK but "xaxp"=c(14620,14680,4)
> has seemingly no effect. The limits for xaxp was found from the default
> plot and inspecting par(). I need to put the date marks at specific points.
> Could I suppress them altogether and make a new xaxis corresponding to the
> points ? Was xaxp not intended in this way ?
> Thank you for your (so far) endless patience !
>
> data <- read.table("vanco1.dat",h=T)
> op <- par("xaxp"=c(14620,14680,4),"cex.axis"=0.5)
> attach(data)
> library(date)
> dates <- mdy.date(month,day,year)
> plot(dates,vanco,pch=c(19),xlab='',ylab="[Vancomycin]",
> main="Vanco versus weekly dose")
> abline(h=10,lty=2)
> dm <- c(1,1,1,1,2,2,3)
> dd <- c(7,17,21,31,23,25,3)
> dy <- rep(2000,7)
> limits <- mdy.date(dm,dd,dy)
> abline(v=limits,lty=8)
> x <- c(14611.37, 14620.95, 14627.94, 14634.44, 14650.85, 14663.85,
> 14667.58,14680.15)
> mtext(c("1","2","3","4","4.5","3","2","3"),3,at=x)
> par(op)

I wanted to tell you to use something like

   plot(dates, vanco, axes=FALSE)
   axis(.....)
   box()

as a workaround, but plot(dates,vanco,axes=FALSE) draws the
"dates"-axis!
Bug???


Something like

   plot(dates, vanco, xaxt="n")
   axis(1, temp <- seq(14620, 14680, 4), as.character(as.date(temp)),
cex.axis=0.5)

should work.


Regards,
Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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