Rev 5111 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{C_01_trellis.device}\alias{trellis.device}\alias{standard.theme}\alias{canonical.theme}\alias{col.whitebg}\title{ Initializing Trellis Displays }\description{Initialization of a display device with appropriate graphicalparameters.}\usage{trellis.device(device = getOption("device"),color = !(dev.name == "postscript"),theme = lattice.getOption("default.theme"),new = TRUE,retain = FALSE,\dots)standard.theme(name, color)canonical.theme(name, color)col.whitebg()}\arguments{\item{device}{ function (or the name of one as a character string)that starts a device. Admissible values depend on the platform andhow \R was compiled (see \code{\link{Devices}}), but usually\code{"pdf"}, \code{"postscript"}, \code{"png"}, \code{"jpeg"} andat least one of \code{"X11"}, \code{"windows"} and \code{"quartz"}will be available.}\item{color}{ logical, whether the initial settings should be color orblack and white. Defaults to \code{FALSE} for postscript devices,\code{TRUE} otherwise. Note that this only applies to the initialchoice of colors, which can be overridden using \code{theme} orsubsequent calls to \code{\link{trellis.par.set}} (and by argumentssupplied directly in high level calls for some settings).}\item{theme}{ list of components that changes the settings of thedevice opened, or, a function that when called produces such alist. The function name can be supplied as a quoted string. Thesesettings are only used to modify the default settings (determined byother arguments), and need not contain all possible parameters.A possible use of this argument is to change the default settings byspecifying \code{lattice.options(default.theme = "col.whitebg")}.For back-compatibility, this is initially (when lattice is loaded)set to \code{options(lattice.theme)}.If \code{theme} is a function, it will not be supplied anyarguments, however, it is guaranteed that a device will already beopen when it is called, so one may use \code{.Device} inside thefunction to ascertain what device has been opened.}\item{new}{ logical flag indicating whether a new device should bestarted. If \code{FALSE}, the options for the current device arechanged to the defaults determined by the other arguments.}\item{retain}{logical. If \code{TRUE} and a setting for this device alreadyexists, then that is used instead of the defaults for thisdevice. By default, pre-existing settings are overwritten (andlost).}\item{name}{ name of the device for which the setting is required, asreturned by \code{.Device}}\item{\dots}{ additional parameters to be passed to the \code{device}function, most commonly \code{file} for non-screen devices, as wellas \code{height}, \code{width}, etc. See the help file forindividual devices for admissible arguments.}}\details{Trellis Graphics functions obtain the default values of variousgraphical parameters (colors, line types, fonts, etc.) from acustomizable \dQuote{settings} list. This functionality is analogousto \code{\link{par}} for standard \R graphics and, together with\code{\link{lattice.options}}, mostly supplants it (\code{\link{par}}settings are mostly ignored by Lattice). Unlike \code{\link{par}},Trellis settings can be controlled separately for each differentdevice type (but not concurrently for different instances of the samedevice). \code{standard.theme} and \code{col.whitebg} producepredefined settings (a.k.a. themes), while \code{trellis.device}provides a high level interface to control which \dQuote{theme} willbe in effect when a new device is opened. \code{trellis.device} iscalled automatically when a \code{"trellis"} object is plotted, andthe defaults can be used to provide sufficient control, so in aproperly configured system it is rarely necessary for the user to call\code{trellis.device} explicitly.The \code{standard.theme} function is intended to provide devicespecific settings (e.g. light colors on a grey background for screendevices, dark colors or black and white for print devices) which wereused as defaults prior to \R 2.3.0. However, these defaults are notalways appropriate, due to the variety of platforms and hardwaresettings on which \R is used, as well as the fact that a plot createdon a particular device may be subsequently used in many differentways. For this reason, a \dQuote{safe} default is used for alldevices from \R 2.3.0 onwards. The old behaviour can be reinstated bysetting \code{standard.theme} as the default \code{theme} argument,e.g. by putting \code{options(lattice.theme = "standard.theme")} in astartup script (see the entry for \code{theme} above for details).}\value{\code{standard.theme} returns a list of components defining graphicalparameter settings for Lattice displays. It is used internally in\code{trellis.device}, and can also be used as the \code{theme}argument to \code{trellis.par.set}, or even as \code{theme} in\code{trellis.device} to use the defaults for another device.\code{canonical.theme} is an alias for \code{standard.theme}.\code{col.whitebg} returns a similar (but smaller) list that issuitable as the \code{theme} argument to \code{trellis.device} and\code{\link{trellis.par.set}}. It contains settings values whichprovide colors suitable for plotting on a white background. Note thatthe name \code{col.whitebg} is somewhat of a misnomer, since itactually sets the background to transparent rather than white.}\note{Earlier versions of \code{trellis.device} had a \code{bg} argument toset the background color, but this is no longer supported. Ifsupplied, the \code{bg} argument will be passed on to the devicefunction; however, this will have no effect on the Trellis settings.It is rarely meaningful to change the background alone; if you feelthe need to change the background, consider using the \code{theme}argument instead.}\references{Sarkar, Deepayan (2008) "Lattice: Multivariate Data Visualization withR", Springer. \url{http://lmdvr.r-forge.r-project.org/}}\author{ Deepayan Sarkar \email{Deepayan.Sarkar@R-project.org}}\seealso{\code{\link{Lattice}} for an overview of the \code{lattice} package.\code{\link{Devices}} for valid choices of \code{device} on yourplatform.\code{\link{trellis.par.get}} and \code{\link{trellis.par.set}} can beused to query and modify the settings \emph{after} a device has beeninitialized. The \code{par.settings} argument to high levelfunctions, described in \code{\link{xyplot}}, can be used to attachtransient settings to a \code{"trellis"} object.}\keyword{dplot}