[R] plotting dates, incorrectly scaled x-axis?

Christof Kluß ckluss at email.uni-kiel.de
Sun Feb 12 11:15:52 CET 2012


Hi,

I want to plot with axis.Date(), but something is scaled incorrectly.
The red vertical line in is put on a totally wrong position. (sample below)

Do you have an idea what I'm doing wrong?

Thx
Christof


x11(width=30, height=20)

x<-seq(as.Date("2010-02-27"), as.Date("2011-03-28"),"month")
y <- seq(0,100,length=length(x))

plot(y ~ x, type="o", tck=1, xaxt="n")

axis.Date(1, at=x, labels=format(x,"%b\n%Y"), padj=0.5)

abline(v=as.Date("2011-01-01"), col="red", lty="dashed")



More information about the R-help mailing list