Skip to content
Prev 58568 / 398502 Next

I: a coloured band within each panel of a lattice bwplot

On Friday 05 November 2004 05:05, 8rino-Luca Pantani wrote:
Generally speaking, you want to draw a polygon . There is no lattice 
wrapper for the 'grid.polygon' function, so you will have to use it 
directly. Check out
For this simpler case though, 'grid.rect' should be sufficient, e.g.

       panel= function(x, y){
           m <- mean(x, na.rm = T)
           grid.rect(x = unit(m, "native"),
                     w = unit(m * 0.04, "native"),
                     gp = gpar(fill = "lightgrey", col = "transparent"))
           panel.bwplot(x, y)
       }

Make sure to do a 'library(grid)' before this.

Deepayan