[R] annotating time axis by axis.POSIXct

Petr PIKAL petr.pikal at precheza.cz
Thu Nov 5 14:15:50 CET 2009


Thanks.

I did not read help page carefully and overlooked axis.Date

Regards
Petr


Gavin Simpson <gavin.simpson at ucl.ac.uk> napsal dne 05.11.2009 10:43:22:

> On Thu, 2009-11-05 at 10:28 +0100, Petr PIKAL wrote:
> > Dear all
> > 
> > I try to format labels on axis as standard ones does not look well, 
but I 
> > am not able to make axis.POSIXct to work. here is an example
> 
> But you are plotting an axis using an object of class "Date", so why use
> axis.POSIXct?
> 
> Your example works if I do:
> 
> axis.Date(1, at=x, format="%m/%Y")
> 
> The examples in ?axis.Date show that this does work using axis.POSIXct
> if one does have a POSIXct object.
> 
> HTH
> 
> G
> 
> > 
> > x<-seq(as.Date("2008-1-1"), as.Date("2009-9-6"), by="2 months")
> > y<-rnorm(11)
> > plot(x,y) #not very sophisticated axis
> > 
> > plot(x,y, axes=F)
> > axis(2)
> > axis.POSIXct(1, at=x, format="%m/%Y") # no axis
> > 
> > The same is on R2.10.0, 2.10.dev and 2.11.dev
> > 
> > R session
> > 
> > > version
> >                _ 
> > platform       i386-pc-mingw32 
> > arch           i386 
> > os             mingw32 
> > system         i386, mingw32 
> > status 
> > major          2 
> > minor          10.0 
> > year           2009 
> > month          10 
> > day            26 
> > svn rev        50208 
> > language       R 
> > version.string R version 2.10.0 (2009-10-26)
> > 
> > Czech Locale
> > 
> > Is it a bug or am I missing something?
> > 
> > regards
> > Petr
> > 
> > ______________________________________________
> > R-help at r-project.org 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.
> -- 
> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
>  Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
>  ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
>  Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
>  Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
>  UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
> 
>




More information about the R-help mailing list