Afshartous, David
2009-Sep-09 21:53 UTC
[R] Xyplot, multi line title via main, all lines left justified
All, Below is an xyplot plot with multiple panels and a title produced via main: library("lattic") data.ex = data.frame(y = rnorm(10), t = rep(1:5, 2), group = rep(c(0,1), each = 5)) xyplot(y ~ t | as.factor(group), data = data.ex, main = list("Put figure caption here xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx want this line left justified" )) I must be mis-interpreting the help description for main under xyplot, and the descriptions of just, hjust, and vjust in textGrob, since manipulation of these arguments do not seem to produce the desired result of having the second line of text left-justified. Any help much appreciated. David
Deepayan Sarkar
2009-Sep-10 13:08 UTC
[R] Xyplot, multi line title via main, all lines left justified
On Wed, Sep 9, 2009 at 2:53 PM, Afshartous, David <DAfshartous at med.miami.edu> wrote:> > All, > > Below is an xyplot plot with multiple panels and a title produced via main: > > library("lattic") > data.ex = data.frame(y = rnorm(10), t = rep(1:5, 2), group = rep(c(0,1), > each = 5)) > > xyplot(y ~ t | as.factor(group), data = data.ex, > ? ?main = list("Put figure caption here xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx > ? ?want this line left justified" )) > > I must be mis-interpreting the help description for main under xyplot, and > the descriptions of just, hjust, and vjust in textGrob, since manipulation > of these arguments do not seem to produce the desired result of having the > second line of text left-justified.This seems to work. You need to choose a suitable value of 'x', as the default will be to start at the center. xyplot(y ~ t | as.factor(group), data = data.ex, main = textGrob("Put figure caption here xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx want this line left justified", x = 0, hjust = 0)) -Deepayan