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. thanks a lot Karine _________________________________________________________________ Consultez vos emails Orange, Gmail, Yahoo!, Free ... directement depuis HOTMAIL ! [[alternative HTML version deleted]]
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
On 26/04/2010 6:05 AM, 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. >If your x variable is a POSIXct variable, it will happen automatically. If you don't like the tickmark locations or the date format, you can use axis.POSIXct to change them. For example, x <- as.POSIXct(c("2010/01/01", "2010/05/01")) plot(x, 1:2, xaxt="n") axis.POSIXct(1, x, format="%b%Y") Duncan Murdoch