[R] Plot grouped data: How to change x-axis? (nlme)
Karl Knoblick
karlknoblich at yahoo.de
Wed Dec 31 13:13:45 CET 2003
Hallo!
GENERAL QUESTION:
I'm trying to change the tick marks of the x-axis in a
grouped data plot (nlme).
CONCRETE EXAMPLE:
In the example (see below) I want the x-axis to have
tick marks at 0, 6, 12, 18, 24. How can I do this?
WHAT I TRIED
I tried "normal" methods like axis(...) but this does
not work with this plot. And I also tried xlim=c(0,24)
but the ticks are unchanged and the plot looks worse
(because of no distances to the border of the Panels).
EXAMPLE:
--
# begin example
library(lattice)
library(nlme)
# create sample data
set.seed(123)
ID<-rep(1:6, each=4)
Time<-rep(c(0,6,12,24), 6)
Y<-runif(24)
DF<-data.frame(ID, Time, Y)
GDF<-groupedData(Y ~ Time | ID, data=DF)
plot(GDF,layout=c(3,2), aspect=0.6, xlab="Months")
# end example
QUESTION: How can I get tick marks at 0, 6, 12, 18, 24
on the x-axis?
Any help will be appreciate.
Karl.
PS: Have a happy new year and keep R running!!
More information about the R-help
mailing list