Thanks for the input.  If I have read the newletter correctly, then my
'plot' command should be:

plot(as.POSIXct(format(x.1), tz="GMT"), seq(length(x.1)))

Since the data points were at midnight, the tick mark now lines up with the
data.

My next question is that on the graph with less than two days, the tick
marks are at the data point; e.g., if the data was at "01:00", the hour tick
mark would be "01".  In the case where the time period is greater than 2
days, the data at "2006-6-2" has the tick mark with the label "Thu", but
2006-6-2 is "Fri".  Is there some reason for the change in the placement of
the tick marks for 'days'?  Is there a convention that says the tick marks
should mark a beginning of a time period?

But back to the original question.  The plots for a span of less than 2
days  came out with the tick marks lined up as expected without having to
use the conversion mentioned in the newletter.  If I use that conversion on
plots of less than a 2 day span, my tick marks are now displaced by the 4
hours due to the time zones.  So I appear to be getting inconsistencies in
the plots depending on the range of time being plotted.


On 4/17/06, Gabor Grothendieck <ggrothendieck@gmail.com> wrote:
>
> Read the R News 4/1 help desk article which specifically discusses this.
>
> On 4/17/06, jim holtman <jholtman@gmail.com> wrote:
> > 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]]
> >
> > ______________________________________________
> > 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
> >
>



--
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]]


