\Header{n2mfrow}{Compute Default mfrow From Number of Plots}
\keyword{dplot}{n2mfrow}
\keyword{utilities}{n2mfrow}
\begin{Description}\relax
Easy setup for plotting multiple figures (in a rectangular layout) on
one page.  This computes a sensible default for
\code{\Link{par}(mfrow)}.
\end{Description}
\begin{Usage}
\begin{verbatim}
n2mfrow(nr.plots)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{nr.plots}] integer; the number of plot figures you'll want to draw.
\end{ldescription}
\end{Arguments}
\begin{Value}
A length two integer vector \code{nr, nc} giving the number of rows
and columns, fulfilling \code{nr >= nc >= 1} and \code{nr * nc >= nr.plots}.
\end{Value}
\begin{Author}\relax
Martin Maechler
\end{Author}
\begin{SeeAlso}\relax
\code{\Link{par}}, \code{\Link{layout}}.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
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)
\end{ExampleCode}
\end{Examples}

