require(pixmap) require(grid) x <- read.pnm('cruise.pnm') pdf('output.pdf', width=6, height=4, version="1.4") par(mar=c(0,0,0,0)) plot(x) # base graphics y <- c(6, 6.5, 7, 8, 8.5, 8.2, 10, 9.6, 9.7, 9) # some data like in the picture you gave # now the grid stuff pushViewport(viewport(xscale=c(0,10), yscale=c(0,10))) grid.rect(x=0:9, y=0, width=1, height=y, default.units="native", gp=gpar(fill="white", alpha=0.7, col="gray", lwd=2), just=c("left","bottom")) grid.rect(x=0:9, y=y, width=1, height= unit(1, "npc") - unit(y, "native") , default.units="native" , gp=gpar(fill="white", col="white"), just=c("left","bottom")) grid.lines(x=c(0,10), y=c(5, 5), default.units="native", gp=gpar(lwd=2, col="white", lty="dotted")) grid.lines(x=c(0,10), y=c(10, 10), default.units="native", gp=gpar(lwd=2, col="gray", lty="dotted")) popViewport() dev.off()