[R] plot dates

Duncan Murdoch murdoch.duncan at gmail.com
Mon Apr 26 13:08:36 CEST 2010


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



More information about the R-help mailing list