grid.layout               package:grid               R Documentation

_C_r_e_a_t_e _a _G_r_i_d _L_a_y_o_u_t

_D_e_s_c_r_i_p_t_i_o_n:

     This function returns a Grid layout, which describes a subdivision
     of a rectangular region.

_U_s_a_g_e:

     grid.layout(nrow = 1, ncol = 1,
             widths = unit(rep(1, ncol), "null"),
             heights = unit(rep(1, nrow), "null"),
             default.units = "null", respect = FALSE,
             just="centre")

_A_r_g_u_m_e_n_t_s:

    nrow: An integer describing the number of rows in the layout.

    ncol: An integer describing the number of columns in the layout.

  widths: A numeric vector or unit object describing the widths of the
          columns in the layout.

 heights: A numeric vector or unit object describing the heights of the
          rows in the layout.

default.units: A string indicating the default units to use if 'widths'
          or 'heights' are only given as numeric vectors.

 respect: A logical value or a numeric matrix. If a logical, this
          indicates whether row heights and column widths should
          respect each other. If a matrix, non-zero values indicate
          that the corresponding row and column should be respected
          (see examples below). 

    just: A string vector indicating how the layout should be justified
          if it is not the same size as its parent viewport. If there
          are two values, the first value specifes horizontal
          justification and the second value specifies vertical
          justification.  Possible values are: '"left"', '"right"',
          '"centre"', '"center"', '"bottom"', and '"top"'.  NOTE that
          in this context, '"left"', for example, means align the left
          edge of the left-most layout column with the left edge of the
          parent viewport.

_D_e_t_a_i_l_s:

     The unit objects given for the 'widths' and 'heights' of a layout
     may use a special 'units' that only has meaning for layouts.  This
     is the '"null"' unit, which indicates what relative fraction of
     the available width/height the column/row occupies.  See the
     reference for a better description of relative widths and heights
     in layouts.

_V_a_l_u_e:

     A Grid layout object.

_W_A_R_N_I_N_G:

     This function must NOT be confused with the base R graphics
     function 'layout'.  In particular, do not use 'layout' in
     combination with Grid graphics.  The documentation for 'layout'
     may provide some useful information and this function should
     behave identically in comparable situations.  The 'grid.layout' 
     function has _added_ the ability to specify a broader range of
     units for row heights and column widths, and allows for nested
     layouts (see 'viewport').

_A_u_t_h_o_r(_s):

     Paul Murrell

_R_e_f_e_r_e_n_c_e_s:

     Murrell, P. R. (1999), Layouts: A Mechanism for Arranging Plots on
     a Page, _Journal of Computational and Graphical Statistics_, *8*,
     121-134.

_S_e_e _A_l_s_o:

     Grid, 'grid.show.layout', 'viewport', 'layout'

_E_x_a_m_p_l_e_s:

     ## A variety of layouts (some a bit mid-bending ...)
     layout.torture()
     ## Demonstration of layout justification
     grid.newpage()
     testlay <- function(just="centre") {
       pushViewport(viewport(layout=grid.layout(1, 1, widths=unit(1, "inches"),
                               height=unit(0.25, "npc"),
                               just=just)))
       pushViewport(viewport(layout.pos.col=1, layout.pos.row=1))
       grid.rect()
       grid.text(paste(just, collapse="-"))
       popViewport(2)
     }
     testlay()
     testlay(c("left", "top"))
     testlay(c("right", "top"))
     testlay(c("right", "bottom"))
     testlay(c("left", "bottom"))
     testlay(c("left"))
     testlay(c("right"))
     testlay(c("bottom"))
     testlay(c("top"))

