[R] Mixing grid and base graphics--need help understanding this quirk
Kevin Wright
kwright68 at gmail.com
Tue Jun 27 22:31:02 CEST 2006
My setup: Windows 2000, R 2.3.1
When I start a brand new session of R and paste the code below into R,
the graphic device shows "Some text" in the lower left corner. If I
paste the code into the command window again, then "Some text" does
not appear in the lower left corner. Why is this?
require(grid)
par(mfrow=c(1,2))
plot(1:10)
plot(-10:1)
par(mfrow=c(1,1))
pushViewport(viewport(.04, .04, width=stringWidth("Some text"),
height=unit(2,"lines"),
name="pagenum", gp=gpar(fontsize=10)))
grid.text("Some text", gp=gpar(col="gray30"),
just=c("left","bottom"))
popViewport()
Kevin Wright
More information about the R-help
mailing list