[Rd] plot.POSIXct uses wrong x axis (PR#14016)

karl at huftis.org karl at huftis.org
Tue Oct 20 08:45:17 CEST 2009


Full_Name: Karl Ove Hufthammer
Version: 2.10.0 beta
OS: Windows
Submission from: (NULL) (93.124.134.66)


When plotting a single POSIXct variable, 'plot' uses a nonsensical x axis. Here
is some example code:

set.seed(1)
x=seq(1,1e8,length=100)+round(runif(100)*1e8)
y=as.POSIXct(x,origin="2001-01-01")
plot(y)

The y axis correctly shows appropriate labels (years 2002 to 2006), but the x
axis show the single time '59:58' in the lower left corner.

Expected behaviour: The indices should be shown on the x axis, just like for
plot(x), where x is the x variable in the above example code.

Additional notes: While ?plot.POSIXct does not explicitly say that the second
variable ('y') is optional, the help for the generic, ?plot, does. And it seems
reasonable that it should be. Also plot(POSIXct.variable) does produce a
'correct' plot, except for the labels on the x axis.

Output of sessionInfo():

R version 2.10.0 beta (2009-10-17 r50136) 
i386-pc-mingw32 

locale:
[1] LC_COLLATE=Norwegian-Nynorsk_Norway.1252 
[2] LC_CTYPE=Norwegian-Nynorsk_Norway.1252   
[3] LC_MONETARY=Norwegian-Nynorsk_Norway.1252
[4] LC_NUMERIC=C                             
[5] LC_TIME=Norwegian-Nynorsk_Norway.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] tools_2.10.0



More information about the R-devel mailing list