R_GE_gcontext-class {unknown}R Documentation

Information about the current graphics settings/context

Description

This is a one-to-one mapping of the C-level data structure used in R graphics devices and passed to device routines and it describes the current settings or state of the graphics "pen". It provides alues for the color, the background color, the line width, and line type, how lines are joined and ended, the character expansion factor, the size of a the font and line height, and font information. These are set and reset frequently and are stored in this context object rather than "globally" (across calls) within the device.

Objects from the Class

We rarely construct objects of this type directly in R but rather are passed them in calls to R functions from the graphics engine. These functions are those implementing R graphics device facilities.

We might explicitly coerce the C-level reference to an R structure to have access to all of the fields in a single R object using as(obj, "R_GE_gcontext"). However, this is not necessary as we can access the individual fields as obj$col as easily as obj@col. There may be marginal benefits in speed if one is accessing the values of all the fields many, many times within the single R function call. But this requires measurement as the slot access of an S4 object may incur overheads comparable or exceeding that of the method dispatch and C interface.

Slots

col:
Object of class "integer" the color to draw text, lines, paths. This is the "foreground" color.
fill:
Object of class "integer" the background color used to fill regions such as rectangles, circles and polygons
gamma:
Object of class "numeric" the
lwd:
Object of class "numeric" the width of a rendered line, typically in units of 1/96.
lty:
Object of class "integer" the type of line, e.g. solid, dotted, dashed
lend:
Object of class "R_GE_lineend" one of ROUND_CAP, BUTT_CAP and SQUARE_CAP (currently integers at present and not enumeration types)
ljoin:
Object of class "R_GE_linejoin" how lines are joined. One of ROUND_JOIN, MITRE_JOIN, BEVEL_JOIN. (Currently these are integers. You should coerce them to R_GE_linejoin.)
lmitre:
Object of class "numeric" controls mitreing of lines
cex:
Object of class "numeric" character expansion factor with font size = fontsize * cex
ps:
Object of class "numeric" font size in points
lineheight:
Object of class "numeric" height of a line which should be multiplied by the font size
fontface:
Object of class "integer" font face such as plain, italic, bold. These are given by integers.
fontfamily:
Object of class "character" a character vector currently with 201 elements each of which is a single character, i.e. string of length 1. But this is may become a single string with 201 characters.

Extends

Class "CStruct-class", directly.

Methods

No methods defined with class "R_GE_gcontext" in the signature.

Author(s)

Duncan Temple Lang

References

“The R Internals Manual”, R Development Core Team.

See Also

graphicsDevice RDevDescMethods-class

Examples

showClass("R_GE_gcontext")

[Package Index]