On 2013-02-28 04:20, Elaine Kuo wrote:
Hello



I am using lattice dotplot and I would like to put the strip under the
panel.

I found the code “strip” is for the strip above the panel, and “strip.left”
for the strip left to the panel.

Please kindly advise how to write the code for the strip under the panel

Thank you


Elaine


I don't think that this is trivial. I would just use panel.text() and
panel.rect() to create my own strips. [I do wonder why you would want
to have the strips at the bottom - seems unnatural to me.]

Here's a start, using the iris data:

  dotplot(Sepal.Length ~ Petal.Length | Species, data=iris,
     layout = c(3, 1),
     ylim = c(-2, 37),    ## adjust y-range to leave a bit
                          ##  of space at bottom
     strip = FALSE,       ## omit top strips
     panel = function(...){
       cp <- current.panel.limits()
       stripheight <- (cp$ylim[2] - cp$ylim[1]) / 25
                          ## may have to adjust the '25'
       xleft <- cp$xlim[1]
       xright <- cp$xlim[2]
       ybottom <- cp$ylim[1]
       ytop <- cp$ylim[1] + stripheight
       lab <- levels(iris$Species)[panel.number()]
       panel.dotplot(...)
       panel.rect(xleft, ybottom, xright, ytop, fill = "bisque")
       panel.text(x = (xleft + xright) / 2,
                  y = (ybottom + ytop) / 2,
                  labels = lab)
     })


Peter Ehlers

______________________________________________
R-help@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.

Reply via email to