On Fri, 2010-08-20 at 10:35 -0400, ivo welch wrote: > The treatment of dates seems to be a little inconsistent in R 2.11.1 > (2010-05-31): <snip /> > > [2] How do dates on axes work? > > > plot( c(as.Date(1:20, origin="1970-01-01")), 1:20 ) > > axis( side=3, c(as.Date(1:20, origin="1970-01-01"))) > > The lower axis is drawn from the plot() with dates. The upper axis > from axis() is drawn with numbers, not dates.
axis() isn't generic: > methods(axis) [1] axis.Date axis.POSIXct Warning message: In methods(axis) : function 'axis' appears not to be generic So you either have to call axis.Date directly or use the generic version Axis() plot( c(as.Date(1:20, origin="1970-01-01")), 1:20 ) axis.Date( side=3, c(as.Date(1:20, origin="1970-01-01"))) or plot( c(as.Date(1:20, origin="1970-01-01")), 1:20 ) Axis( side=3, c(as.Date(1:20, origin="1970-01-01"))) Think of axis.Date as being just like read.table or read.csv: they aren't the S3 methods of generic function 'read' for objects of class "table" or "csv", they are functions in their own right. > (PS: Is there an easier way to tell R that I want a whole lot more > tick marks and/or labels than what it gives me by default?) ?axis.Date ?Axis.Date But you need to supply the ticks locations and labels as with any axis call. HTH G > > regards, > > /iaw > > ---- > Ivo Welch (ivo.we...@brown.edu, ivo.we...@gmail.com) > > ______________________________________________ > R-help@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 %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% ______________________________________________ R-help@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.