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"))

