
png("state.png", width=300, height=180)
pushViewport(viewport(width=unit(3, "inches"),
                      layout=grid.layout(8, 3,
                        heights=unit(rep(1, 8), "lines"))))
label <- function(lab, row=NULL, col=NULL,
                  x=unit(2, "mm"), 
                  y=unit(1, "npc") - unit(0.5, "lines"),
                  just="left", 
                  header=FALSE, title=FALSE) {
  pushViewport(viewport(layout.pos.col=col,
                         layout.pos.row=row))
  if (title)
    grid.rect(gp=gpar(fill="grey"))
  else
    grid.rect()
  if (header)
    grid.text(lab, x=x, y=y, just=just, gp=gpar(fontface="bold"))
  else
    grid.text(lab, x=x, y=y, just=just)
  popViewport()
}
label("base", 1, 1:2, x=0.5, just="centre", title=TRUE)
label("grid", 1, 3, x=0.5, just="centre", title=TRUE)
label("plot.c\nplot3D.c\nplotmath.c", 2:4, 1, y=0.5)
label("Graphics.h", 5, 1, header=TRUE)
label("graphics.c", 6, 1)
label("base.c", 2:6, 2)
label("*.c", 2:6, 3)
label("GraphicsEngine.h", 7, x=0.5, just="centre", header=TRUE)
label("engine.c", 8, x=0.5, just="centre")
popViewport()
dev.off()
