[R] drawing a rectangle through multiple plots

Dr Carbon drcarbon at gmail.com
Tue Dec 14 20:41:23 CET 2004


How do I draw a rectangle across multiple plots on a device?

E.g.,

def.par <- par(no.readonly = TRUE)
par(mfrow = c(3, 1))
plot(1:10, rnorm(10), ylim = c(-4,4), type = "l")
plot(1:10, rnorm(10), ylim = c(-4,4), type = "l")
plot(1:10, rnorm(10), ylim = c(-4,4), type = "l")
rect(2, -4, 3, 4)
par(def.par)

I want the rectangle to extend across the whole device. How do I get
at those coordinates? Is this a case where I should be using grid or
gridBase?

Thanks.




More information about the R-help mailing list