Rev 26710 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{gpar}\alias{gpar}\alias{get.gpar}\title{Handling Grid Graphical Parameters}\description{\code{gpar()} should be used to create a set of graphicalparameter settings. It returns an object of class \code{"gpar"}. This isbasically a list of name-value pairs.\code{get.gpar()} can be used to query the currentgraphical parameter settings.}\usage{gpar(...)get.gpar(names = NULL)}\arguments{\item{\dots}{ Any number of named arguments. }\item{names}{A character vector of valid graphical parameter names.}}\details{All grid viewports and (predefined) graphical objects have a slotcalled \code{gp}, which contains a \code{"gpar"} object. Whena viewport is pushed onto the viewport stack and when a graphical objectis drawn, the settings in the \code{"gpar"} object are enforced.In this way, the graphical output is modified by the \code{gp}settings until the graphical object has finished drawing, or until theviewport is popped off the viewport stack, or until some otherviewport or graphical object is pushed or begins drawing.Valid parameter names are:\tabular{ll}{col \tab Colour for lines and borders. \crfill \tab Colour for filling rectangles, polygons, ... \crlty \tab Line type \crlwd \tab Line width \crfontsize \tab The size of text (in points) \crcex \tab Multiplier applied to fontsize \crfontfamily \tab The font family \crfontface \tab The font face (bold, italic, ...) \crlineheight \tab The height of a line as a multiple of the size of text \crfont \tab Font face (alias for fontface; forbackward compatibility) \cr}The size of text is \code{fontsize}*\code{cex}. The size of a lineis \code{fontsize}*\code{cex}*\code{lineheight}.For most devices, the \code{fontfamily} is specified when the deviceis first opened and may not be changed thereafter -- i.e., specifyinga different font family via \code{fontfamily} will be ignored. Thiswill hopefully change in future versions of R. Also, there is animportant exception: \code{fontfamily} may be used to specify oneof the Hershey Font families (e.g., \code{HersheySerif})and this specification will be honouredon all devices.The specification of \code{fontface} follows the R base graphicsstandard: 1 = plain, 2 = bold, 3 = italic, 4 = bold italic.Specifying the value \code{NULL} for a parameter is the same as notspecifying any value for that parameter, except for \code{col} and\code{fill}, where \code{NULL} indicates not to draw a border ornot to fill an area (respectively).All parameter values can be vectors of multiple values. (This willnot always make sense -- for example, viewports will only takenotice of the first parameter value.)\code{get.gpar()} returns all current graphical parameter settings.}\value{An object of class \code{"gpar"}.}\seealso{\code{\link{Hershey}}.}\author{Paul Murrell}\examples{get.gpar()gpar(col = "red")gpar(col = "blue", lty = "solid", lwd = 3, fontsize = 16)get.gpar(c("col", "lty"))grid.newpage()vp <- viewport(w = .8, h = .8, gp = gpar(col="blue"))grid.collection(grid.rect(gp = gpar(col="red"), draw = FALSE),grid.text(paste("The rect is its own colour (red)","but this text is the colour","set by the collection (green)", sep = "\n"),draw = FALSE),gp = gpar(col="green"), vp = vp)grid.text("This text is the colour set by the viewport (blue)",y = 1, just = c("center", "bottom"),gp = gpar(fontsize=20), vp = vp)grid.newpage()## example with multiple values for a parameterpushViewport(viewport())grid.points(1:10/11, 1:10/11, gp = gpar(col=1:10))popViewport()}\keyword{ dplot }