recordGraphics           package:grDevices           R Documentation

_R_e_c_o_r_d _g_r_a_p_h_i_c_s _o_p_e_r_a_t_i_o_n_s

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

     Records arbitrary code on the graphics engine display list. Useful
     for encapsulating calculations with graphical output that depends
     on the calculations. Intended _only_ for expert use.

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

     recordGraphics(expr, list, env)

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

    expr: object of mode 'expression' or 'call' or an "unevaluated
          expression".

    list: a list defining the environment in which 'expr' is to be
          evaluated.

     env: An 'environment' specifying where R looks for objects not
          found in 'envir'.

_D_e_t_a_i_l_s:

     The code in 'expr' is evaluated in an environment constructed from
     'list', with 'env' as the parent of that environment.

     All three arguments are saved on the graphics engine display list
     so that on a device resize or copying between devices, the
     original evaluation environment can be recreated and the code can
     be reevaluated to reproduce the graphical output.

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

     The value from evaluating 'expr'.

_W_a_r_n_i_n_g:

     This function is not intended for general use.  Incorrect or
     improper use of this function could lead to unintended and/or
     undesirable results.

     An example of acceptable use is querying the current state of a
     graphics device or graphics system setting and then calling a
     graphics function.

     An example of improper use would be calling the 'assign' function
     to performing assignments in the global environment.

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

     'eval'

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

     plot(1:10)
     # This rectangle remains 1inch wide when the device is resized
     recordGraphics(
       {
         rect(4, 2,
              4 + diff(par("usr")[1:2])/par("pin")[1], 3)
       },
       list(),
       getNamespace("graphics"))

