Windows Metafiles Graphics Device

DESCRIPTION:

Creates a Windows metafile file that can be inserted into a variety of Microsoft Windows documents.

USAGE:

wmf.graph(file, horizontal=F, width=7, height=5.4, 
          pointsize=14, fonts=character(0), color=T, 
          colorspec=if(color) pdf.colors else pdf.grays,
          colormap=colorspec$colormap, 
          text.colors=colorspec$text.colors, 
          polygon.colors=colorspec$polygon.colors,
          line.colors=colorspec$line.colors,
          image.colors=colorspec$image.colors, 
          background.color=colorspec$background.color, 
          region=c(0, 0, paper), paper=pdf.paper, command, 
          paint.background=T, line.width.factor=15,
          text.line.spacing.factor=0.8)

REQUIRED ARGUMENTS:

file
template for the names of the WMF files. Each file can only contain one page of output. A template of the form "file####.wmf" will have numbers, starting with 0001, replacing the # signs. If you do not put any # signs in, numbers, starting with 2 will be prepended to "file" after the first graph.

OPTIONAL ARGUMENTS:

horizontal
this argument is not implemented now.
width
width of plotting region in inches.
height
height of plotting region in inches.
pointsize
size in 1/72s of inch of text when par("cex") is 1.
font
The names of the fonts to use when a plotting command uses font=number. The names are the "face names" in Windows terminology. Commonly available fonts include "Arial" (the default, given also by character(0)) and "Symbol" (includes Greek letters).
color
a logical value, if TRUE use colors, if FALSE use grayscale.
colorspec
a list containing color information. This argument is ignored unless either use.device.palette(TRUE) or use.legacy.graphics(TRUE) has been called. S-PLUS uses a global color palette and global image color palette.

This list contains a colormap and 4 vectors of indices into that colormap, one vector each for use when drawing lines, text, polygons, and images. The components must be named colormap, line.colors, text.colors, polygon.colors , and image.colors. You may give those components as individual arguments to wmf.graph, if you do they override the corresponding component of colorspec. See below for their detailed descriptions. See the datasets pdf.grays and pdf.colors for examples.

colormap
a numeric vector or matrix. This argument is ignored unless either use.device.palette(TRUE) or use.legacy.graphics(TRUE) has been called.

For grayscale, a vector of numbers between 0 (black) and 1 (white). For color, a 3 column by ncolor row matrix of numbers between 0 and 1. Each row represents a color and its entries give the intensity of its red, green, and blue components. (Instead of this matrix you may also use a ncolor long list of 3 long vectors.)

text.colors
Indices into the colormap giving the colors to use for text. This argument is ignored unless either use.device.palette(TRUE) or use.legacy.graphics(TRUE) has been called.

The color in colormap[text.colors[par("col")]] (or corresponding row of colormap if it is a matrix) will be used when drawing text. Typically, text.colors, line.colors, and polygon.colors will point to contrasting colors.

polygon.colors
indices into colormap for filled polygon colors. This argument is ignored unless either use.device.palette(TRUE) or use.legacy.graphics(TRUE) has been called.
line.colors
indices into colormap for line colors. This argument is ignored unless either use.device.palette(TRUE) or use.legacy.graphics(TRUE) has been called.
image.colors
indices into colormap for image colors. Typically, image.colors will point to a smoothly changing sequence of colors. This argument is ignored unless either use.device.palette(TRUE) or use.legacy.graphics(TRUE) has been called. S-PLUS uses a global image color palette.
background.color
index into colormap for background color. This argument is ignored unless either use.device.palette(TRUE) or use.legacy.graphics(TRUE) has been called. Set the background color by calling par to set the bg graphics parameter.
region
This argument is not implemented now.
paper
This argument is not implemented now.
command
This argument is not implemented now.
paint.background
If TRUE paint the page in the background color before rendering any other graphics. Otherwise do not. Painting the background will cause the graph to obscure anything it is over when inserted into a document. If you do not paint the background and the background is a different color than paper (or slide) then using col=0 to erase things will produce a colored erasure.
line.width.factor
Lines will be drawn par("lwd")*line.width.factor/1000 inches wide.
text.line.spacing.factor
Vertically adjacent lines of text will be par("cex")*pointsize/72*text.line.spacing.factor inches apart. Reducing text.line.spacing.factor or pointsize will reduce the default margin size and increase the size of the default plotting region.

SIDE EFFECTS:

Initializes device driver for creating graphics in the Windows Metafile format.

DETAILS:

You cannot view the output file until you end a page of graphics, either with a new plot() command or with the frame() command. You can use this device with Trellis Graphics by starting the device with trellis.device(wmf.graph, file="t####.wmf").

By default, S-PLUS uses a global color palette and global image color palette to map color indices to specific colors. Color arguments can have integer values that map into the color palette, or they can be specified by RGB values or color names. For more information on color specification, see the chapter "Graphics Enhancements" in the Guide to Graphics.

The Windows metafile graph device is for 16-bit Windows applications, whereas the enhanced metafile graph device is for 32-bit Windows applications.

SEE ALSO:

See the chapter "S-PLUS Graphic Device Support" in the Guide to Graphics. , , . . .

EXAMPLES:

wmf.graph(file="test####.wmf", color=T) 
par(mfrow=c(2, 1)) 
pie(rep(1, 20)) 
plot(state.x77[,"Frost"], state.x77[,"Murder"], type="n") 
reg <- factor(state.region) 
for(i in seq(along=levels(reg))) { 
        w <- reg == levels(reg)[i] 
        points(state.x77[w,"Frost"], state.x77[w,"Murder"], pch=i, col=i) 
} 
image(voice.five, ylim=c(0, 80)) 
image.legend(voice.five$z, x=range(voice.five$x), y=c(70,80), 
        cex=.5, mgp=c(3,.25,0)) 
tsplot(hstart) 
dev.off() 
# now use Microsoft Word and use the Insert/Picture menu item
# to insert each picture in your document.