[R] Possible bug in plot.POSIXct regarding x axis
Remko Duursma
remkoduursma at gmail.com
Tue Oct 20 05:51:32 CEST 2009
I think it is a bug. Apparently plot.POSIXct calls axis.POSIXct for
both y (correct) and x (incorrect) axes:
set.seed(1)
x=seq(1,1e8,length=100)+round(runif(100)*1e8)
y=as.POSIXct(x,origin="2001-01-01")
plot(y, axes=FALSE)
axis.POSIXct(2, y)
axis.POSIXct(1,y) # is what it does
axis(1, col="red") # is what it should do
Remko
On Mon, Oct 19, 2009 at 9:04 PM, Karl Ove Hufthammer <karl at huftis.org> wrote:
> I believe I have found a bug (or at least a misfeature) in plot.POSIXct.
> See the following 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)
>
> This plots some random (date)times against their indices. The y axis
> correctly shows appropriate values (years), but the x axis contains the
> single number '59:58' in the lower left corner, which makes no sense.
>
> Compare this to a simple 'plot(x)', which shows the index numbers on the
> x axis.
>
> I observe this with both R 2.9.2 and 2.10.0 alphas.
>
> If anybody can confirm that this should be considered a bug, I'll report
> it in the bug system.
>
> --
> Karl Ove Hufthammer
>
> ______________________________________________
> 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.
>
-------------------------------------------------
Remko Duursma
Post-Doctoral Fellow
Centre for Plants and the Environment
University of Western Sydney
Hawkesbury Campus
Richmond NSW 2753
Dept of Biological Science
Macquarie University
North Ryde NSW 2109
Australia
Mobile: +61 (0)422 096908
www.remkoduursma.com
More information about the R-help
mailing list