| 61044 |
murrell |
1 |
% File src/library/grid/man/makeContent.Rd
|
| 68948 |
ripley |
2 |
% Part of the R package, https://www.R-project.org
|
| 61044 |
murrell |
3 |
% Copyright 1995-2007 R Core Team
|
|
|
4 |
% Distributed under GPL 2 or later
|
|
|
5 |
|
|
|
6 |
\name{makeContent}
|
|
|
7 |
\alias{makeContent}
|
|
|
8 |
\alias{makeContext}
|
|
|
9 |
\title{ Customised grid Grobs }
|
|
|
10 |
\description{
|
|
|
11 |
These generic hook functions are called whenever a grid grob is drawn.
|
|
|
12 |
They provide an opportunity for customising the drawing context
|
|
|
13 |
and drawing content of a
|
|
|
14 |
new class derived from grob (or gTree).
|
|
|
15 |
}
|
|
|
16 |
\usage{
|
|
|
17 |
makeContext(x)
|
|
|
18 |
makeContent(x)
|
|
|
19 |
}
|
|
|
20 |
\arguments{
|
|
|
21 |
\item{x}{ A grid grob. }
|
|
|
22 |
}
|
|
|
23 |
\details{
|
|
|
24 |
These functions are called by the \code{grid.draw} methods for grobs
|
|
|
25 |
and gTrees.
|
| 61433 |
ripley |
26 |
|
| 61044 |
murrell |
27 |
\code{makeContext} is called first during the drawing of a grob.
|
|
|
28 |
This function should be used to \emph{modify} the \code{vp} slot
|
|
|
29 |
of \code{x} (and/or the \code{childrenvp} slot if \code{x}
|
|
|
30 |
is a gTree). The function \emph{must} return the modified \code{x}.
|
|
|
31 |
Note that
|
|
|
32 |
the default behaviour for grobs is to push any viewports in the
|
|
|
33 |
\code{vp} slot, and for gTrees is to also push and up any viewports in the
|
|
|
34 |
\code{childrenvp} slot, so this function is used to customise the
|
|
|
35 |
drawing context for a grob or gTree.
|
| 61433 |
ripley |
36 |
|
| 61044 |
murrell |
37 |
\code{makeContent} is called next and is where any additional
|
|
|
38 |
calculations should occur and graphical content should
|
|
|
39 |
be generated (see, for example,
|
| 74363 |
maechler |
40 |
\code{grid:::makeContent.xaxis}).
|
| 61044 |
murrell |
41 |
This function should be used to \emph{modify} the \code{children}
|
|
|
42 |
of a gTree.
|
|
|
43 |
The function \emph{must} return the modified \code{x}.
|
|
|
44 |
Note that the default behaviour
|
|
|
45 |
for gTrees is to draw all grobs in the \code{children} slot,
|
|
|
46 |
so this function is used to customise the drawing content for a gTree.
|
|
|
47 |
It is also possible to customise the drawing content for a simple
|
|
|
48 |
grob, but more care needs to be taken; for example, the function
|
|
|
49 |
should return a standard grid primitive with a \code{drawDetails()}
|
|
|
50 |
method in this case.
|
|
|
51 |
|
|
|
52 |
Note that these functions should be \emph{cumulative} in their
|
|
|
53 |
effects, so that the \code{x} returned by \code{makeContent()}
|
|
|
54 |
\emph{includes} any changes made by \code{makeContext()}.
|
|
|
55 |
|
|
|
56 |
Note that \code{makeContext} is
|
|
|
57 |
also called in the calculation of \code{"grobwidth"} and
|
|
|
58 |
\code{"grobheight"} units.
|
|
|
59 |
}
|
|
|
60 |
\value{
|
|
|
61 |
Both functions are expected to return a grob or gTree
|
|
|
62 |
(a modified version of \code{x}).
|
|
|
63 |
}
|
|
|
64 |
\author{ Paul Murrell }
|
|
|
65 |
\seealso{ \code{\link{grid.draw}} }
|
|
|
66 |
\keyword{ dplot }
|