[R] POSIXct dates on x-axis using xyplot
jim holtman
jholtman at gmail.com
Tue Sep 11 05:47:34 CEST 2007
I am using 'xyplot' in lattice to plot some data where the x-axis is a
POSIXct date. I have data which spans a 6 month period, but when I
plot it, only the last month is printed on the right hand side of the
axis. I would have expected that at least I would have a beginning
and an ending point so that I have a point of reference as to the time
that the data spans. Here is some test data.
> # create test data
> dates <- seq(as.POSIXct('2006-01-03'), as.POSIXct('2006-06-26'), by='1 week')
> my.data <- seq(1, length=length(dates))
> require(lattice)
[1] TRUE
> # plot only shows a single month ("Jul" on the right). Would have
> # expected at least the beginning and the ending month since this spans
> # a 6 month period
> pdf('/test.pdf')
> xyplot(my.data ~ dates)
> dev.off()
windows
2
> sessionInfo()
R version 2.5.1 (2007-06-27)
i386-pc-mingw32
locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
attached base packages:
[1] "stats" "graphics" "grDevices" "utils" "datasets" "methods"
[7] "base"
other attached packages:
lattice
"0.16-5"
> Sys.info()
sysname release
"Windows" "NT 5.1"
version nodename
"(build 2600) Service Pack 2" "JIM-LAPTOP"
machine login
"x86" "jim holtman"
user
"jim holtman"
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem you are trying to solve?
More information about the R-help
mailing list