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!!
Michael A. Miller
2003-Dec-31 15:00 UTC
[R] Plot grouped data: How to change x-axis? (nlme)
>>>>> "Karl" == Karl Knoblick <karlknoblich at yahoo.de> writes:> QUESTION: How can I get tick marks at 0, 6, 12, 18, 24 on > the x-axis? You can pass lattice arguments to plot. (See the section under scales in help('xyplot') for lots of details). For your purposes, try this: plot(GDF, layout=c(3,2), aspect=0.6, xlab="Months", scales=list(x=list(at=seq(0,24,6))) ) Happy New Year, Mike -- Michael A. Miller mmiller3 at iupui.edu Imaging Sciences, Department of Radiology, IU School of Medicine
Karl Knoblick <karlknoblich at yahoo.de> writes:> 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).The grouped data plots use the lattice package. To specify an axis in lattice calls you must use the scales argument. Details are given in the documentation for xyplot.
Possibly Parallel Threads
- [lattice] lines for stripplot (like dotplot) or jitter for dotplot?
- Interrater and intrarater variability (intraclass correlationcoefficients)
- bwplot puts the bars in the wrong place
- Variable passed to function not used in function in select=... in subset
- Interrater and intrarater variability (intraclass correlation coefficients)