Rev 26109 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{windows}\alias{windows}\alias{win.graph}\alias{win.metafile}\alias{win.print}\alias{x11}\alias{X11}\alias{print.SavedPlots}\alias{[.SavedPlots}\title{Windows graphics devices}\usage{windows(width = 7, height = 7, pointsize = 12,record = getOption("graphics.record"),rescale = c("R", "fit", "fixed"), xpinch, ypinch,canvas = "white", gamma = getOption("gamma"),xpos = NA, ypos = NA, buffered = getOption("windowsBuffered"))win.graph(width = 7, height = 7, pointsize = 12)x11(width = 7, height = 7, pointsize = 12)X11(width = 7, height = 7, pointsize = 12)win.metafile(filename = "", width = 7, height = 7, pointsize = 12)win.print(width = 7, height = 7, pointsize = 12, printer = "")}\arguments{\item{filename}{the name of the output file: it will be an enhancedWindows metafile, usually given extension \code{.emf} or\code{.wmf}. Up to 511 characters are allowed.The page number is substituted if an integer format is includedin the character string. (The result must be less than 600characters long.)}\item{width}{the (nominal) width of the plotting window in inches.}\item{height}{the (nominal) height of the plotting window in inches.}\item{pointsize}{the default pointsize of plotted text. The allowedrange is \code{[6, 48]}: values outside that range are reset to 12.}\item{record}{logical: sets the initial state of the flag forrecording plots.}\item{rescale}{controls the action for resizing plots.}\item{xpinch, ypinch}{double. Pixels per inch, horizontally andvertically.}\item{canvas}{color. The color of the canvas which is visiblewhen the background color is transparent.}\item{gamma}{the gamma correction factor. This value is usedto ensure that the colors displayed are linearly related toRGB values. By default this is taken from\code{\link{options}("gamma"}, or is 1 (no correction) if that isunset. It sets \code{par("gamma")} for the device.}\item{xpos, ypos}{integer. Position of the top left of the window, inpixels. Negative values are taken from the opposite edge of themonitor. Missing values meant take the default from the\file{\link{Rconsole}} file, which in turn defaults to\code{xpos=-25, ypos=0}: this puts the right edge of the windows 25pixels from the right edge of the monitor.}\item{buffered}{logical. Should the screen output be double-buffered?}\item{printer}{The name of a printer as known to Windows. The defaultcauses a dialog box to come for the user to choose a printer.}}\description{A graphics device is opened. For \code{win.graph}, \code{windows},\code{x11} and \code{X11} this is a graphics window on the currentWindows display: the multiple names are for compatibility with othersystems. \code{win.metafile} prints to a file and \code{win.print} tothe Windows print system.}\details{All these devices are implemented as \code{windows} devices, the\code{display} parameter selects which is actually used.The size of a window is computed from information provided about thedisplay: it depends on the system being configured accurately.By default a screen device asks Windows for the number of pixels perinch. This can be overridden (it is often wrong) by specifying\code{xpinch} and \code{ypinch} or the corresponding options\code{"xpinch"} and \code{"ypinch"}.A graphics window is not allowed to be specified at more that 85\% ofthe screen width or height: the width and height are rescaledproportionally. The window can be resized to a larger size.If the \code{filename} is omitted for a \code{win.metafile} device, theoutput is copied to the clipboard when the device is closed. A\code{win.metafile} device can only be used for a single page.If a screen device is re-sized, the default behaviour is to redraw theplot(s) as if the new size had been specified originally. Using\code{"fit"} will rescale the existing plot(s) to fit the new deviceregion, preserving the aspect ratio. Using \code{"fixed"} will leavethe plot size unchanged, adding scrollbars if part of theplot is obscured.A graphics window will never be created at more that 85\% ofthe screen width or height, but can be resized to a larger size.For the first two \code{rescale} options the width and height arerescaled proportionally if necessary, and if \code{rescale = "fit"}the plot(s) are rescaled accordingly. If \code{rescale = "fixed"}the initially displayed portion is selected within these constraints,separately for width and height.Using \code{\link{strwidth}} or \code{\link{strheight}} after a windowhas been rescaled (when using \code{"fit"}) gives dimensions in theoriginal units, but only approximately as they are derived from themetrics of the rescaled fonts (which are in integer sizes)The displayed region may be bigger than the \sQuote{paper} size, andareas outside the \sQuote{paper} are coloured in the Windowsapplication background colour. Graphics parameters such as\code{"din"} refer to the scaled plot if rescaling is in effect.The different colours need to be distinguished carefully. The areaoutside the device region is coloured in the Windows application backgroundcolour. The device region is coloured in the canvas colour. This isover-painted by the background colour of a plot when a new page iscalled for, but that background colour can be transparent (and is bydefault). The difference between setting the canvas colour and thebackground colour is that when the device is copied the backgroundcolour is copied but the canvas colour is not.Recorded plot histories are of class \code{"SavedPlots"}. They have a\code{print} method, and a subset method. As the individual plots areof class \code{"recordedplot"} they can be replayed by printing them:see \code{\link{recordPlot}}. The active plot history is stored invariable \code{.SavedPlots} in package \pkg{base}.When a screen device is double-buffered (the default from \R 1.8.0) thescreen is updated 100ms after last plotting call or every 500ms duringcontinuous plotting. These times can be altered by setting\code{options("windowsTimeout")} to a vector of two integers beforeopening the device.}\value{A plot device is opened: nothing is returned to the \R interpreter.}\seealso{\code{\link{savePlot}}, \code{\link{bringToTop}},\code{\link{Devices}}, \code{\link{postscript}}}\examples{\dontrun{## A series of plots written to a sequence of metafileswin.metafile("Rplot\%02d.wmf", pointsize = 10)}}\keyword{device}