\Header{grid.show.viewport}{Draw a Diagram of a Grid Viewport}
\keyword{dplot}{grid.show.viewport}
\begin{Description}\relax
This function uses Grid graphics to draw a diagram of
a Grid viewport.
\end{Description}
\begin{Usage}
\begin{verbatim}
grid.show.viewport(v, parent.layout = NULL, newpage = TRUE, vp = NULL)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{v}] A Grid viewport object.
\item[\code{parent.layout}] A grid layout object.  If this is not NULL and
the viewport given in \code{v} has its location specified relative
to the layout, then the diagram shows the layout and which cells
\code{v} occupies within the layout.
\item[\code{newpage}] A logical value to indicate whether to move to
a new page before drawing the diagram.
\item[\code{vp}] A Grid viewport object (or NULL).
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
A viewport is created within \code{vp} to provide a margin for
annotation, and the diagram is drawn within that new viewport.
The margin is filled with light grey, the new viewport is filled
with white and framed with a black border, and the viewport region
is filled with light blue and framed with a blue border.
The diagram is annotated with the width and height (including units)
of the viewport, the (x, y) location of the viewport, and
the x- and y-scales of the viewport, using red lines and text.
\end{Details}
\begin{Value}
None.
\end{Value}
\begin{Author}\relax
Paul Murrell
\end{Author}
\begin{SeeAlso}\relax
\link{Grid},
\code{\Link{viewport}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
## Diagram of a sample viewport
grid.show.viewport(viewport(x=0.6, y=0.6,
                            w=unit(1, "inches"), h=unit(1, "inches")))
grid.show.viewport(viewport(layout.pos.row=2, layout.pos.col=2:3),
                   grid.layout(3, 4))
\end{ExampleCode}
\end{Examples}

