[R] Using dev.copy

Dan Davison davison at stats.ox.ac.uk
Mon Mar 22 16:28:16 CET 2010


I'm working over an ssh connection without X11 graphics. I'm making a
plot, the first stage of drawing which takes a long time. I want to
experiment with adding details. Here is what I was hoping to do, which
results in error.

## Draw the master plot on png dev 2
png(file="master.png")
plot(1:10)

## Save a copy on png dev 3
png(file="copy1.png")
dev.set(2)
dev.copy(which=3)

## Add details to copy, write to disk and view
abline(v=5)
Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...) : 
  plot.new has not been called yet

Can someone tell me how to do this correctly?

Thanks a lot,

Dan



More information about the R-help mailing list