[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]]

