[R] Custom ticks on x axis when dates are involved

Jim Lemon jim at bitwrit.com.au
Thu Nov 25 08:58:08 CET 2010


On 11/25/2010 06:27 AM, Monica Pisica wrote:
>
> ...
> Now the graph looks very close to what i want, but i know that my ticks actually are not exactly at 01/01/yyyy as i would like, although i suppose my error is not that much in this instance. However i would really appreciate if i can get the ticks on my x axis how i want in a much more elegant way - if possible (and if not at least in the correct way).
>
Hi Monica,
How about this?

mpdates<-as.POSIXct(paste("1/1",1984:2009,sep="/"),
  format="%d/%m/%Y")
axis(1,at=mpdates,1984:2009,las=2)

Jim



More information about the R-help mailing list