dev2                  package:base                  R Documentation

_C_o_p_y _G_r_a_p_h_i_c_s _B_e_t_w_e_e_n _M_u_l_t_i_p_l_e _D_e_v_i_c_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     `dev.copy' copies the graphics contents of the current device to
     the device specified by `which' or to a new device which has been
     created by the function specified by `device' (it is an error to
     specify both `which' and `device').

     `dev.print' copies the graphics contents of the current device to
     a new device which has been created by the function specified by
     `device' and then shuts the new device.  This is most useful for
     producing a postscript print from an on-screen device.  Unless
     `file' is specified, the plot will be printed.  Unless `width',
     `height' and `pointsize' are specified the plot dimensions will be
     taken from the current device, shrunk if necessary to fit on the
     paper. (`pointsize' is rescaled if the plot is shrunk.)  If
     `horizontal' is not specified and the plot can be printed at full
     size by switching its value this is done instead of shrinking the
     plot region.

     `dev.copy2eps' is similar to `dev.print' but produces an EPSF
     output file.  Unless otherwise specified `width' and `height' are
     taken from the current device, but `pointsize' is taken from
     `ps.options'.

     `dev.control' allows the user to control the recording of graphics
     operations in a device.  If `displaylist' is "inhibit" then
     recording is turned off.

_U_s_a_g_e:

     dev.copy(device, ..., which=dev.next())
     dev.print(device=postscript, ...)
     dev.copy2eps(...)
     dev.control(displaylist)

_A_r_g_u_m_e_n_t_s:

  device: A device function (e.g., `x11', `postscript', ...)

     ...: Arguments to the `device' function above. For `dev.print',
          this includes `which' and by default any `postscript'
          arguments.

   which: A device number specifying the device to copy to

displaylist: A character string

_V_a_l_u_e:

     `dev.copy' returns the name and number of the device which has
     been copied to.

     `dev.print' and `dev.copy2eps' return the name and number of the
     device which has been copied from.

_N_o_t_e:

     Most devices (including all screen devices) have a display list
     which records all of the graphics operations that occur in the
     device. `dev.copy' copies graphics contents by copying the display
     list from one device to another device.  Also, automatic redrawing
     of graphics contents following the resizing of a device depends on
     the contents of the display list.

     After the command `dev.control("inhibit")', graphics operations
     are not recorded in the display list so that `dev.copy' and
     `dev.print' will not copy anything and the contents of a device
     will not be redrawn automatically if the device is resized.

     The recording of graphics operations is relatively expensive in
     terms of memory so the command `dev.control("inhibit")' can be
     useful if memory usage is an issue.

_S_e_e _A_l_s_o:

     `dev.cur' and other `dev.xxx' functions

_E_x_a_m_p_l_e_s:

     x11()
     plot(rnorm(10), main="Plot 1")
     dev.copy(device=x11)
     mtext("Copy 1", 3)
     dev.print(width=6, height=6, horizontal=FALSE) # prints it
     dev.off(dev.prev())
     dev.off()

