Try this: set the timezone to what you want before plotting:
> tzsave <- Sys.getenv("TZ") # save current
> Sys.setenv(TZ="GMT") # set to whatever
> plot(x,rep(1,11)) # plot
> Sys.setenv(TZ=tzsave) # restore
> plot(x,rep(1,11)) # plot in original time zone
On Wed, Jul 8, 2009 at 2:21 AM, Britton Stephens<stephens at ucar.edu>
wrote:> the help page for plot.POSIXct says
>
> "As from R 2.9.0 the date-times for a '"POSIXct"'
input are
> ? ?interpreted in the timwzonw give by the '"tzone"'
attribute it
> ? ?there is one, otherwise the current timezone. ?(Earlier vrsions
> ? ?always used the current timezone.)"
>
> however I am using 2.9.0 on linux and the following still happily produces
> an x-axis in local (MDT) time
>
>> x=strptime(paste('09-01-01
00:00:00',sep=''),format='%y-%m-%d
>> %H:%M:%S',tz="GMT")+60*60*24*(seq(0.5,1.5,.1))
>> x
> [1] "2009-01-01 12:00:00 GMT" "2009-01-01 14:24:00 GMT"
> [3] "2009-01-01 16:48:00 GMT" "2009-01-01 19:12:00 GMT"
> [5] "2009-01-01 21:36:00 GMT" "2009-01-02 00:00:00 GMT"
> [7] "2009-01-02 02:24:00 GMT" "2009-01-02 04:48:00 GMT"
> [9] "2009-01-02 07:12:00 GMT" "2009-01-02 09:36:00 GMT"
> [11] "2009-01-02 12:00:00 GMT"
>> attributes(x)
> $class
> [1] "POSIXt" ?"POSIXct"
>
> $tzone
> [1] "GMT"
>
>> plot(x,rep(1,11))
>
> Is this a bug, or am I missing something? ?Thanks a lot!
> Britt
>
> --
> Britton B. Stephens
> National Center for Atmospheric Research
> P.O. Box 3000, 1850 Table Mesa Drive
> Boulder, CO ?80307-3000
> Phone: (303) 497-1018
> Fax: (303) 497-1092
>
> ______________________________________________
> R-help at r-project.org 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.
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem that you are trying to solve?