Bug 14016 - plot.POSIXct uses wrong x axis
plot.POSIXct uses wrong x axis
Status: RESOLVED FIXED
Product: R
Classification: Unclassified
Component: Misc
old
ix86 (32-bit) Windows 32-bit
: P5 normal
Assigned To: Jitterbug compatibility account
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-10-20 11:43 UTC by Jitterbug compatibility account
Modified: 2010-04-12 10:00 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jitterbug compatibility account 2009-10-20 11:43:25 UTC
From: karl@huftis.org
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

Comment 1 Brian Ripley 2010-04-12 10:00:57 UTC
This was not documented to work, but has been added as a new feature in 2.12.0