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