n2mfrow               package:graphics               R Documentation

_C_o_m_p_u_t_e _D_e_f_a_u_l_t _m_f_r_o_w _F_r_o_m _N_u_m_b_e_r _o_f _P_l_o_t_s

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

     Easy setup for plotting multiple figures (in a rectangular layout)
     on one page.  This computes a sensible default for 'par(mfrow)'.

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

     n2mfrow(nr.plots)

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

nr.plots: integer; the number of plot figures you'll want to draw.

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

     A length two integer vector 'nr, nc' giving the number of rows and
     columns, fulfilling 'nr >= nc >= 1' and 'nr * nc >= nr.plots'.

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

     Martin Maechler

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

     'par', 'layout'.

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

     n2mfrow(8) # 3 x 3

     n <- 5 ; x <- seq(-2,2, len=51)
     ## suppose now that 'n' is not known {inside function}
     op <- par(mfrow = n2mfrow(n))
     for (j in 1:n)
        plot(x, x^j, main = substitute(x^ exp, list(exp = j)), type='l', col="blue")

     sapply(1:10, n2mfrow)

