Plot 1 is different than plot 2; in plot 1 the points are offset to the left of the axis tick marks.
datet <- as.POSIXct(dates)
## 1 plot(datet,WEIGHT.KG)
## 2 plot(datet,WEIGHT.KG,xaxt='n') axis.POSIXct(1,at=datet)
To investigate a bit, I made a copy of axis.POSIXct and modified it slightly to return the value of "at" that it calculates. I get this:
"2003-10-06 17:00:00 PDT" "2003-10-08 17:00:00 PDT"
"2003-10-10 17:00:00 PDT" "2003-10-12 17:00:00 PDT"
"2003-10-14 17:00:00 PDT"
These are equal to midnight GMT, since my systems are currently in PDT, i.e. GMT-7.
version_ platform powerpc-apple-darwin6.7.5
arch powerpc os darwin6.7.5 system powerpc, darwin6.7.5 status Patched major 1 minor 8.0 year 2003 month 10 day 13 language R
version_ platform i686-pc-linux-gnu
arch i686 os linux-gnu system i686, linux-gnu status Patched major 1 minor 8.0 year 2003 month 10 day 16
language R
version_ platform sparc-sun-solaris2.7
arch sparc os solaris2.7 system sparc, solaris2.7 status major 1 minor 7.1 year 2003 month 06 day 16 language R
-Don
At 9:21 AM -0400 10/17/03, Jacob Etches wrote:
If I take the following simple data:
YEAR MONTH DAY WEIGHT.KG 2003 10 6 1.2 2003 10 12 1.2 2003 10 16 1.3
and format the date data and plot it:
dates <- strptime(paste(DAY,MONTH,YEAR),"%d%m%Y") plot(c(min(dates),max(dates)),c(0,max(WEIGHT.KG)), xlab="Date",ylab="Weight (kg)",type="n") lines(dates,WEIGHT.KG) points(dates,WEIGHT.KG)
I find that the data points are all plotted at (x-1,y), where x is in days. Have I requested this behaviour accidentally? I'm using R-1.8 on OS X.
Printing the dates object looks correct, and simple manipulations such as max(dates)-min(dates) behave normally.
Jacob Etches
Doctoral candidate Dept of Public Health Sciences University of Toronto
______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
-- -------------------------------------- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA
______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
