[R] plot dates

Jim Lemon jim at bitwrit.com.au
Mon Apr 26 12:46:05 CEST 2010


On 04/26/2010 08:05 PM, karine heerah wrote:
>
> hi everybody,
>
>
>
> How can you plot some dates? I mean how can i have the tickmarks with the label of each date on my x axis?
>
>
>
> The dates i use are in POSIXct format, i don't know if it matters.
>
Hi Karine,
Here's one way:

plot(1:3,xaxt="n")
tickpos<-1:3
vgridpos<-as.POSIXct(c("2010-01-01","2010-06-01","2010-11-01"))
vgridlab<-format.POSIXct(vgridpos,"%d/%m/%Y")
axis(1,at=tickpos,labels=vgridlab)

Jim



More information about the R-help mailing list