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)

