Set Base Plot Regions        package:gridBase        R Documentation

_S_e_t _B_a_s_e _P_l_o_t_t_i_n_g _R_e_g_i_o_n_s _f_r_o_m _G_r_i_d _V_i_e_w_p_o_r_t

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

     These functions can be used to align base plotting regions with
     the current grid viewport.  This can be used to draw base plots
     within a grid viewport.

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

     gridOMI()
     gridFIG()
     gridPLT()
     gridPAR()

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

     For this to be useful, you will have to make liberal use of
     'par(new=TRUE)' to prevent base from moving to a new page.

     With care, these can even be used to draw multiple base plots
     within a grid viewport (see the examples below), but in general,
     base plotting functions that draw multiple panels (e.g., 'coplot')
     should not be expected to work.

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

     'gridOMI' returns a value that can be used to set the 'par(omi)'
     parameter.

     'gridFIG' returns a value that can be used to set the 'par(fig)'
     parameter.

     'gridPLT' returns a value that can be used to set the 'par(plt)'
     parameter.

     'gridPAR' returns a value that can be used to set some graphical
     parameters (currently, 'lwd', 'lty', and 'col').

_W_a_r_n_i_n_g:

     If you resize the device, all bets are off!

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

     Paul Murrell

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

     Grid, 'viewport'

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

     opar <- par(no.readonly=TRUE)
     # gridFIG
     grid.newpage()
     pushViewport(viewport(width=0.5, height=0.5))
     grid.rect(gp=gpar(col="grey", lty="dashed"))
     par(fig=gridFIG())
     par(new=TRUE)
     plot(1:10)
     # multiple plots
     # NOTE the use of par(mfg)
     # gridOMI
     par(opar)
     grid.newpage()
     pushViewport(viewport(width=0.5, height=0.5))
     grid.rect(gp=gpar(col="grey", lty="dashed"))
     par(omi=gridOMI())
     par(mfrow=c(2, 2), mfg=c(1, 1), mar=c(3, 3, 1, 0))
     for (i in 1:4) {
       plot(i)
     }
     # gridPLT
     par(opar)
     grid.newpage()
     pushViewport(viewport(width=0.5, height=0.5))
     grid.rect(gp=gpar(col="grey", lwd=5))
     par(plt=gridPLT())
     par(new=TRUE)
     plot(1:10)
     # gridFIG with par(omi) set
     par(opar)
     grid.newpage()
     par(omi=rep(1, 4))
     pushViewport(viewport(width=0.5, height=0.5))
     grid.rect(gp=gpar(col="grey", lwd=5))
     par(fig=gridFIG())
     par(new=TRUE)
     plot(1:10)
     # gridPLT with par(omi) set
     par(opar)
     grid.newpage()
     par(omi=rep(1, 4))
     pushViewport(viewport(width=0.5, height=0.5))
     grid.rect(gp=gpar(col="grey", lwd=5))
     par(plt=gridPLT())
     par(new=TRUE)
     plot(1:10)
     # gridPAR
     par(opar)
     grid.newpage()
     pushViewport(viewport(width=0.5, height=0.5,
       gp=gpar(col="red", lwd=3, lty="dotted")))
     grid.rect(gp=gpar(col="grey", lwd=5))
     par(fig=gridFIG())
     par(gridPAR())
     par(new=TRUE)
     plot(1:10, type="b")

