On 2013-02-25 07:47, Manuel Kunz wrote:
Hi,I created a xyplot with a three-column layout. As suggested by Deepayan I tried to put titles to each column by using xlab.top. Unfortunately, as my y-axis scale relation = "free", the column titles are not centered at the three x axes anymore. Any idea how to center the titles? #Example: require(lattice) #require(latticeExtra) e <- data.frame(a = c(1:30), b = c(1:10, 20:29, 990:999), d = c(rep("A", 10), rep("B", 10), rep("C", 10))) #column titles centered for relation = "same" xyplot(b ~ a | d, e, scales = list(y = list(relation = "same", rot = 0)), aspect = 1.8, layout = c(3, 1), xlab.top = c("This is centered", "Bla", "Bla") ) #column titles not centered for relation = "free" xyplot(b ~ a | d, e, scales = list(y = list(relation = "free", rot = 0)), aspect = 1.8, layout = c(3, 1), xlab.top = c("This is not centered", "Bla", "Bla") ) # end of example Best regards, manuel
If this is a one-off, then I would just add a sufficient number of spaces, obtained by trial and error, to each label. On the other hand, why not use lattice's built-in facility to put your labels in the top strips, using the factor.levels argument. But perhaps your real use is more involved than the example. Peter Ehlers ______________________________________________ [email protected] 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.

