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 timestamp. It appens usually when the xlim is short like only some days. xlim is settled as a POSIXt like this "2006-12-30 17:25:44 CET" "2007-01-02 03:16:51 CET" On the graph it prints : 1167500000 and 1167700000 instead of dates. And the result gives a x axes in unix timestamps as if the plot function didn't recognize that it is a timestamp but just an integer. What am i missing, since R sees itself that it is time stamps and not integer when xlim is enougth large, how do i tell the plot function to see these numbers as POSIXt? thks. [[alternative HTML version deleted]]
As the footer says PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. We can't help you with a problem we cannot reproduce, and random guessing is not going to be productive. On Thu, 4 Jan 2007, COMTE Guillaume wrote:> 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 timestamp. > It appens usually when the xlim is short like only some days. > xlim is settled as a POSIXt like this > "2006-12-30 17:25:44 CET" "2007-01-02 03:16:51 CET" > On the graph it prints : 1167500000 and 1167700000 instead of dates. > And the result gives a x axes in unix timestamps as if the plot function didn't recognize that it is a timestamp but just an integer. > What am i missing, since R sees itself that it is time stamps and not integer when xlim is enougth large, how do i tell the plot function to see these numbers as POSIXt? > > thks. > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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. >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
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 timestamp. It appens usually when the xlim is short like only some days. xlim is settled as a POSIXt like this "2006-12-30 17:25:44 CET" "2007-01-02 03:16:51 CET" On the graph it prints : 1167500000 and 1167700000 instead of dates. And the result gives a x axes in unix timestamps as if the plot function didn't recognize that it is a timestamp but just an integer. What am i missing, since R sees itself that it is time stamps and not integer when xlim is enougth large, how do i tell the plot function to see these numbers as POSIXt? I put an attachement, inside there is an example that demonstrate what i experience (hope it won't be deleted, it is a tar.gz archive made using debian under R version 2.1.0, 2005-04-18, i386-pc-linux-gnu attached base packages: [1] "methods" "stats" "graphics" "grDevices" "utils" "datasets" [7] "base"). thks. 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
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]]