[R] Tick mark alignment for POSIXct data

jim holtman
2006-04-17T22:54:03Z

I am using POSIXct objects to store my date/time information.  If I am
plotting less that 2 days worth of data, I get the correct tick marks on the
x-axis which is showing the 'day HH:MM' and these line up with the data
points.

If the data spans more than 2 days, the tick marks are now off.  In the data
below, I am creating some sample data and plotting the points.  I am in the
Eastern Timezone.  When the second plot is generated, the tick marks are 4
hours behind the actual time; it appears that the data is being plotted in
GMT, but the tick marks are EDT.  I as looking in axis.POSIXct and it
appears that the rounding that is done for 'pretty printing' the x-axis
is
normalized to GMT, so that the tick marks are plotted 4 hours before the
data points.

Is there a way of carrying the time zone into axis.POSIXct so that the ticks
marks are generated in the correct locations?

###=========test script   ---   Eastern Time Zone==========# generate less than
2 days of data points
x.1 <- seq(as.POSIXct('2006-6-1 00:00:00'), as.POSIXct('2006-6-2
12:00:00'),
by='2 hours')
plot(x.1, seq(length(x.1)), main='tick marks aligned') # default

# now setup 4 days worth of data; tick marks don't line up as expected
x.1 <- seq(as.POSIXct('2006-6-1 00:00:00'), as.POSIXct('2006-6-5
00:00:00'),
by='day')
plot(x.1, seq(length(x.1)), main='tick marks not aligned') # default




--
Jim Holtman
Cincinnati, OH
+1 513 646 9390 (Cell)
+1 513 247 0281 (Home)

What the problem you are trying to solve?

	[[alternative HTML version deleted]]