Re: [R] plot a vertical column of colored rectangles

2011-07-16 Thread baptiste auguie
Hi, You could try grid.colorstrip() from the gridExtra package, grid.colorstrip(ifelse(dat, "blue", "red")) or grid.raster(), which should be more efficient, grid.raster(matrix(ifelse(dat, "blue", "red")), interp=FALSE, width=unit(1,"npc"), height=unit(1,"npc")) HTH, baptiste On 15 July 201

Re: [R] plot a vertical column of colored rectangles

2011-07-16 Thread Ortiz, John
Hi Nacho, You should look grid.rect or grid.polygon function from "grid" library. I attach you an example, you can play with this: dat <- c(0,0,0,0,1,1,1,0,0,1) colour=ifelse(dat == 0, "red", "blue") library(grid) library(foreach) grid.newpage() vp1 <- grid.layout(nrow = 1, ncol = 1,