[R] (no subject)
Tim Clark
mudiver1200 at yahoo.com
Tue Oct 12 00:56:50 CEST 2010
Dear List,
I am trying to plot date vs. time, but am having problems getting my y-axis
labels how I want them. When left on its own R plots time at 6 hour intervals
from 03:00 to 23:00. I am wanting 6 hour intervals from 2:00 to 22:00. I
realize yaxp doesn't work in plot(), so I am trying to get it to work in par().
However, now I get the ticks where I want them but the time is output as a very
big number (serial time?). I have also tried axis() using at= and also get
seriel time numbers. Any suggestions on how to format time on an axis?
mydat$Date<-as.POSIXct(as.character(mydat$Date), format=c("%m/%d/%Y"))
mydat$Time<-as.POSIXct(as.character(mydat$Time), format=c("%H:%M:%S"))
plot(mydat$DateTime,mydat$Time, xlab=c("Date"), ylab=c("Time"),
xlim=c(min(mydat$DateTime),max(mydat$DateTime)),
ylim=c(min(mydat$Time),max(mydat$Time)),
yaxt="n",
yaxs="i",
pch=19, cex=.4,
type="n")
par(yaxp=c(as.POSIXct(as.character("02:00"),
format=c("%H:%M")),as.POSIXct(as.character("22:00"), format=c("%H:%M")),5))
axis(2)
Thanks,
Tim
Tim Clark
Marine Ecologist
National Park of American Samoa
More information about the R-help
mailing list