gpar {grid}R Documentation

Function to produce a Graphical Parameter Object

Description

This function returns an object of class "gpar". This is basically a list of name-value pairs.

Usage

gpar(...)

Arguments

... Any number of named arguments.

Details

All grid viewports and (predefined) graphical objects have a slot called gp, which contains a "gpar" object. When a viewport is pushed onto the viewport stack and when a graphical object is drawn, the settings in the "gpar" object are enforced. In this way, the graphical output is modified by the gp settings until the graphical object has finished drawing, or until the viewport is popped off the viewport stack, or until some other viewport or graphical object is pushed or begins drawing.

Valid parameter names are:
col Colour for lines and borders.
fill Colour for filling rectangles, polygons, ...
lty Line type
lwd Line width
fontsize The size of text (in points)
lineheight The height of a line as a multiple of fontsize
font Font face

Specifying the value NULL for a parameter is the same as not specifying any value for that parameter, except for col and fill, where NULL indicates not to draw a border or not to fill an area (respectively).

Value

An object of class "gpar".

Author(s)

Paul Murrell

Examples

gpar(col="red")
gpar(col="blue", lty="solid", lwd=3, fontsize=16)
grid.newpage()
vp <- viewport(w=.8, h=.8, gp=gpar(col="blue"))
grid.collection(grid.rect(gp=gpar(col="red"), draw=FALSE),
                grid.text("The rect is its own colour (red)\nbut this text is the colour\nset by the collection (green)", 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)

[Package Contents]