you could either define a plotting function which passes your arguments to plot() two times, with different devices active. this function plots the given arguments two times: pl<- function(...){ X11() #or pdf() plot(...) # dev.off() if pdf() is used X11() # open second graphics device plot(...) }
pl(1:10,pch=10) or you make a function evaluate your plotting arguments two times if you're using other plotting functions like lines(), points(), abline() etc. In this case you have to escape your plotting code with expression() so it is only executed when you explicitly demand it by using eval() Best regards! plEval <- function(e){ X11() eval(e) X11() eval(e) } plEval( expression({ plot(1:10,pch=5) abline(h=3,col="red") }) ) ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.