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") -------------- next part -------------- A non-text attachment was scrubbed... Name: plot.png Type: image/png Size: 3933 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120212/35a891e6/attachment.png>
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")
On 12.02.2012 11:09, Christof Klu? wrote:> 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")Works fine for me. See abline(v=as.Date("2011-01-27"), col="red", lty="dashed") which is exactly on the date. Uwe Ligges> > plot.png > > > > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.