Re: [R] Strange labels on plot with dates

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Tue 03 Apr 2007 - 13:44:59 GMT

What version of R are you using? When I copy and paste that into R 2.4.1 on Windows XP I get 2001, 2002, ..., 2007

On 4/3/07, Henrik Andersson <han@dmi.dk> wrote:
> Hello fellow R people,
>
> I don't understand the default behavior of the axis labeling when
> plotting dates.
>
> I would expect something like 2001, 2002 or possibly Jan 01, Jan
> 02...Jan 06, but instead I only see Jan 01, Jan 01, Jan 01....
>
>
> See the following example
>
> startdate <- strptime("2001-01-01",format="%Y-%m-%d")
> enddate <- strptime("2006-12-31",format="%Y-%m-%d")
> dates <- seq(startdate,enddate,by="month")
>
> daynr <- as.numeric(julian(dates,origin=dates[1]))
>
> yvar <- sin(daynr*2*pi/365)
>
> plot(yvar~dates,type='l')
>
> Cheers, Henrik
>
> --
> Henrik Andersson
>
> Danish Meteorological Institute
> Lyngbyvej 100
> 2100 Copenhagen
> Denmark
> Tel: +45 39157215
> Email: han@dmi.dk
>
> ______________________________________________
> R-help@stat.math.ethz.ch 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.
>



R-help@stat.math.ethz.ch 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. Received on Tue Apr 03 23:48:38 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 03 Apr 2007 - 14:30:58 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.