zoomplot            package:TeachingDemos            R Documentation

_Z_o_o_m _o_r _u_n_z_o_o_m _a_n _e_x_i_s_t_i_n_g _p_l_o_t _i_n _t_h_e _p_l_o_t _w_i_n_d_o_w

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

     This function allows you to change the x and y ranges of the plot
     that is currently in the plot window.  This has the effect of
     zooming into a section of the plot, or zooming out (unzooming) to
     show a larger region than is currently shown.

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

     zoomplot(xlim, ylim=NULL )

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

xlim, ylim: The new x and y limits of the plot.  These can be passed in
          in any form understood by 'xy.coords'.  The range of xlim and
          ylim are actually used so you can pass in more than 2 points.

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

     This function recreates the current plot in the graphics window
     but with different xlim, ylim arguments.  This gives the effect of
     zooming or unzooming the plot.

     This only works with traditional graphics (not lattice/trellis).

     This function is a quick hack that should only be used for quick
     exploring of data.  For any serious work you should create a
     script with the plotting commands and adjust the xlim and ylim
     parameters to give the plot that you want.

     Only the x and y ranges are changed, the size of the plotting
     characters and text will stay the same.

_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:

     'plot.default', 'par', 'matplot', 'plot2script', 'source'

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

     ## Not run: 

     with(iris, plot(Sepal.Length, Petal.Width,
         col=c('red','green','blue')[Species]))
     text( 6.5, 1.5, 'test' )
     zoomplot( locator(2) ) # now click on 2 points in the plot to zoom in

     plot( 1:10, rnorm(10) )
     tmp <- rnorm(10,1,3)
     lines( (1:10) + 0.5, tmp, col='red' )
     zoomplot( c(0,11), range(tmp) )
     ## End(Not run)

