Skip to content
Prev 173416 / 398502 Next

Centering multi-line strip text in lattice

Hi
Mike Lawrence wrote:
Here's one way, by writing your own strip function that calls the
default strip function with blanked out labels then draws the labels
directly with 'grid' calls.


xyplot(
	y~x|z
	,data=a
	,par.strip.text = list(lines = 1.5),
	strip=function(which.panel, factor.levels, ...) {
                strip.default(which.panel=which.panel,
                              factor.levels=rep("",
                                                length(factor.levels)),
                              ...)
                pushViewport(viewport(clip="on"))
                grid.text(factor.levels[which.panel],
                          gp=gpar(cex=.75, lineheight=1))
                popViewport()
            }
)


Paul