packet.panel.default         package:lattice         R Documentation

_A_s_s_o_c_i_a_t_i_n_g _P_a_c_k_e_t_s _w_i_t_h _P_a_n_e_l_s

_D_e_s_c_r_i_p_t_i_o_n:

     When a '"trellis"' object is plotted, panels are always drawn in
     an order such that columns vary the fastest, then rows and then
     pages. An optional function can be specified that determines,
     given the column, row and page and other relevant information, the
     packet (if any) which should be used in that panel.  The function
     documented here implements the default behaviour, which is to
     match panel order with packet order, determined by varying the
     first conditioning variable the fastest, then the second, and so
     on.  This matching is performed after any reordering and/or
     permutation of the conditioning variables.

_U_s_a_g_e:

     packet.panel.default(layout, condlevels, page, row, column,
                          skip, all.pages.skip = TRUE) 

_A_r_g_u_m_e_n_t_s:

  layout: the 'layout' argument in high level functions, suitably
          standardized.  

condlevels: a list of levels of conditioning variables, after relevant
          permutations and/or reordering of levels 

page, row, column: the location of the panel in the coordinate system
          of pages, rows and columns.  

    skip: the 'skip' argument in high level functions 

all.pages.skip: whether 'skip' should be replicated over all pages.  If
          'FALSE', 'skip' will be replicated to be only as long as the
          number of positions on a page, and that template will be used
          for all pages. 

_V_a_l_u_e:

     A suitable combination of levels of the conditioning variables in
     the form of a numeric vector as long as the number of conditioning
     variables, with each element an integer indexing the levels of the
     corresponding variable.  Specifically, if the return value is 'p',
     then the 'i'-th conditioning variable will have level
     'condlevels[[i]][p[i]]'.

_A_u_t_h_o_r(_s):

     Deepayan Sarkar Deepayan.Sarkar@R-project.org

_S_e_e _A_l_s_o:

     'Lattice', 'xyplot'

_E_x_a_m_p_l_e_s:

     packet.panel.page <- function(n)
     {
         ## returns a function that when used as the 'packet.panel'
         ## argument in print.trellis plots page number 'n' only
         function(layout, page, ...) {
             stopifnot(layout[3] == 1)
             packet.panel.default(layout = layout, page = n, ...)
         }
     }

     data(mtcars)
     HP <- equal.count(mtcars$hp, 6)
     p <- 
         xyplot(mpg ~ disp | HP * factor(cyl),
                mtcars, layout = c(0, 6, 1))

     print(p, packet.panel = packet.panel.page(1))
     print(p, packet.panel = packet.panel.page(2))

