clip                package:graphics                R Documentation

_S_e_t _C_l_i_p_p_i_n_g _R_e_g_i_o_n

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

     Set clipping region in user coordinates

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

     clip(x1, x2, y1, y2)

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

x1, x2, y1, y2: user coordinates of clipping rectange

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

     How the clipping rectangle is set depends on the setting of
     'par("xpd")': this function changes the current setting until the
     next high-level plotting command resets it.

     Exactly when the clipping region will be reset can be hard to
     predict.  'plot.new' always resets it. Functions such as 'lines'
     and 'text' only reset it if 'par("xpd")' has been changed. 
     However, functions such as 'box', 'mtext', 'title' and
     'plot.dendrogram' can manipulate the 'xpd' setting.

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

     'par'

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

     x <- rnorm(1000)
     hist(x, xlim=c(-4,4))
     usr <- par("usr")
     clip(usr[1], -2, usr[3], usr[4])
     hist(x, col = 'red', add = TRUE)
     clip(2, usr[2], usr[3], usr[4])
     hist(x, col = 'blue', add = TRUE)
     do.call("clip", as.list(usr))  # reset to plot region

