Skip to content
Prev 26008 / 398502 Next

Problems with segments and multiple graphs

Ross Darnell wrote:
OK. The par settings won't be resetted completely, but you can do so
manually:

 y <- rnorm(3000)
 par(mfrow=c(2,1))
 plot(y,type="l")
 rpar <- par()  # remember par settings
 plot(cumsum(y),type="l")
 segments(1000,min(cumsum(y)),1000,max(cumsum(y)))
 par(rpar)      # restore the settings to draw the line 
 par(mfg=c(1,1))
 segments(1000,min(y),1000,max(y), col="red")

In your case it is simpler to complete each plot before stepping to the
next one.
Yes. A simple but rather ugly solution:

  par(xpd = NA)
  abline(v = 1000)

Uwe Ligges