Skip to content

annotating time axis by axis.POSIXct

3 messages · PIKAL Petr, Gavin Simpson

#
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

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
_ 
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
#
On Thu, 2009-11-05 at 10:28 +0100, Petr PIKAL wrote:
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
#
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:
but I
http://www.R-project.org/posting-guide.html