[R] bwplot(): Can Panel Heading Span Two Lines? [RESOLVED]
David Winsemius
dwinsemius at comcast.net
Mon Sep 10 23:19:31 CEST 2012
On Sep 10, 2012, at 1:48 PM, Bert Gunter wrote:
> In addition, try this:
>
> x <- rep(1:10,2); y <- runif(20);f<-factor(rep(paste("This
> is\nLevel",1:2),e=10))
> xyplot(y~x|f,
> par.strip.text=list(lineheight=.8,lines=3))
Bert;
I had imagined that the factor level character strings could be automagically separated by substituting '\n' at each space or dash or wahtever:
strip.new <- function( which.given, which.panel, factor.levels, ...){
panel.text( x=0.5,y=1.5, lab=gsub("\\ ", "\n", factor.levels) )}
# Need to tweak the line height
xyplot(y~x|f, strip=strip.new)
Your approach of changing the levels to be pre-split with '\n's may be more straightforward.
--
David.
>
> I find the documentation here confusing and incomplete:
> "par.strip.text" is listed as a parameter both in ?xyplot and
> ?strip.custom. The arguments are apparently different in the two
> cases, although they are not clearly spelled out in either, although I
> would guess that the default setting in ?strip.default, "add.text,"
> may explain strip.default's. Note that the "lines" component is
> missing, for strip.custom() but apparently works in xtplot().
>
> Cheers,
> Bert
>
> On Mon, Sep 10, 2012 at 1:33 PM, Rich Shepard <rshepard at appl-ecosys.com> wrote:
>> On Mon, 10 Sep 2012, David Winsemius wrote:
>>
>>> The text that appears in the "panel header" is called the "strip". I
>>> didn't see it in the help page for bwplot. You need to look at:
>>
>>
>> David,
>>
>> That explains why I did not find it in the book's index.
>>
>>> ?strip.custom.
>>>
>>> And since you have the Lattice book look at section 10.7 'Controlling the
>>> appearance of strips"
>>
>>
>> Thanks very much!
>>
>> Rich
David Winsemius, MD
Alameda, CA, USA
More information about the R-help
mailing list