plot2script          package:TeachingDemos          R Documentation

_C_r_e_a_t_e _a _s_c_r_i_p_t _f_r_o_m _t_h_e _c_u_r_r_e_n_t _p_l_o_t

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

     This function attempts to create a script that will recreate the
     current plot (in the graphics window).  You can then edit any
     parts of the script that you want changed and rerun to get the
     modified plot.

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

     plot2script(file='clipboard')

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

    file: The filename (the clipboard by default) for the script to
          create or append to.

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

     This function works with the graphics window and mainly
     traditional graphics (it may work with lattice or other graphics,
     but has not really been tested with those).

     This function creates a script file (or puts it on the clipboard
     so that you can past into a script window or text editor) that
     will recreate the current graph in the current graph window.  The
     script consists of very low level functions (calls to
     'plot.window' and 'axis' rather than letting 'plot' handle all
     this).

     If you want the higher level functions that were actually used,
     then use the 'history' or 'savehistory' commands (this will
     probably be the better method for most cases).

     Some of the low level plotting functions use different arguments
     to the internal version than the user callable version ('box' for
     example), the arguments to these functions may need to be editted
     before the full script will run correctly.

     The lengths of command lines between the creation of the script
     and what can be run in R do not always match, you may need to
     manually wrap long lines in the script before it will run
     properly.

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

     This function is run for its side effects and does not return
     anything meaningful.

_N_o_t_e:

     For any serious projects it is best to put your code into a script
     to begin with and edit the original script rather than using this
     function.

     This function depends on the 'recordPlot' function which can
     change in any version.  Therefore this function should not be
     considered stable.

_A_u_t_h_o_r(_s):

     Greg Snow greg.snow@intermountainmail.org

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

     'history', 'savehistory', 'recordPlot', 'source'

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

     ## Not run: 

     # create a plot
     plot(runif(10),rnorm(10))
     lines( seq(0,1,length=10), rnorm(10,1,3) )

     # create the script
     plot2script()

     # now paste the script into a script window or text processor.
     # edit the ranges in plot.window() and change some colors or
     # other options.  Then run the script.
      ## End(Not run)

