[R] lattice: left-aligned text in strips?

From: RINNER Heinrich <HEINRICH.RINNER_at_tirol.gv.at>
Date: Wed, 14 May 2008 09:47:10 +0200


[adapted repost of question

http://tolstoy.newcastle.edu.au/R/e4/help/08/03/6260.html]

Dear R community,

by default, text in the strips of a trellis plot is centered in the strip.
Is there a way to have the text left-aligned?

For example:

library(lattice)
test <- data.frame(x=rnorm(100), y=rnorm(100), a=rep(c("A: centered text","B: centered text"),50))
xyplot(y ~ x | a, data = test) # ok, strip text is centered test <- data.frame(x=rnorm(100), y=rnorm(100), a=rep(c("A: left-aligned

text","B: left-aligned text (possibly loooooooooooooooooooooooooooong
string"),50))
xyplot(y ~ x | a, data = test) # how???

I am using R 2.6.2 on Windows XP, package lattice Version 0.17-6.

[The reason I would like to do this is because "in real life" my
conditioning variable 'a' can have quite long strings as its value. I am automatically creating a series of trellis plots, and in each one a different number of panels will be produced (maybe 4, maybe 20,...). So in some cases (few panels, short labels) text in the strips will be perfectly readable, while in some cases (many panels, long labels) only the middle of the text will.
I know I could abbreviate the strip text by using something like: xyplot(y ~ x | substr(a,1,35), data = test) But there is no "natural" choice of string length here when I want to cut off as few text as possible, so just left aligning the strip texts would seem like a natural and easy(?) solution to me - if I was able to do it...]

-Heinrich.

        [[alternative HTML version deleted]]



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. Received on Wed 14 May 2008 - 12:16:21 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 14 May 2008 - 15:30:37 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive