[R] Problem with plot() and POSIXt dates

From: COMTE Guillaume <g.comte_at_alliance-ir.net>
Date: Fri 05 Jan 2007 - 13:48:45 GMT


So maybe i will finaly succeed asking the right way,  

Hy all,

I'm plotting graphs using plot() function, they are on X axes POSIX dates:

"POSIXt" "oldClass" "POSIXct" "POSIXlt"

I can't figure out why sometimes it prints the month and days and sometimes it prints the unix timestamps.

Here is an example that reproduce my problem the data's to use with it can be downloaded from http://www.alliance-ir.net/r-project/demo.tar.gz <http://www.alliance-ir.net/r-project/demo.tar.gz> :

limite_x<-structure(as.numeric(read.table("limite_x")), class=c("POSIXt","POSIXct"))

limite_y<-as.numeric(read.table("limite_y"))

test<-as.numeric(read.table("y_values"))

abscisse_test<-structure(as.numeric(read.table("x_values")), class=c("POSIXt","POSIXct"))

plot((test/10)~abscisse_test,type="s",col="lightgreen",xlab="",ylab="",ylim=limite_y,xlim=limite_x)

length_test<-length(test)

#if i cut the var "test" to be closer to xlim values, i know that xlim is at the end of "test" :

test_short<-test[(length_test-10):length_test]

abscisse_test_short<-abscisse_test[(length_test-10):length_test]

plot((test_short/10)~abscisse_test_short,type="s",col="lightgreen",xlab="",ylab="",ylim=limite_y,xlim=limite_x)

dev.off()

> sessionInfo()

R version 2.4.0 (2006-10-03)

i386-pc-linux-gnu  

locale:

LC_CTYPE=fr_FR@euro;LC_NUMERIC=C;LC_TIME=fr_FR@euro;LC_COLLATE=fr_FR@euro;LC_MONETARY=fr_FR@euro;LC_MESSAGES=fr_FR@euro;LC_PAPER=fr_FR@euro;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=fr_FR@euro;LC_IDENTIFICATION=C  

attached base packages:

[1] "methods" "stats" "graphics" "grDevices" "utils" "datasets"

[7] "base"  

COMTE Guillaume

Ingénieur Projet

Alliance Technologies

Projet Philharmonie

24 rue Martre

92110 Clichy

Tel : 01 40 87 48 06

Fax : 01 40 87 48 14  

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch 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. Received on Sat Jan 06 11:44:17 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 06 Jan 2007 - 01:30:25 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.