ps.slide {Hmisc}R Documentation

Postscript and Adobe PDF Setup for 35mm Slides and Other Formats

Description

The ps.slide function has nice defaults to create postscript images with larger font, thicker lines, and better axis labeling. These images can be used to make nice slides. There is an option to view the constructed postscript file using ghostview, and an option to initiate a background process to convert the postscript file to a PC Paintbrush .pcx file for importing into various PC presentation graphics packages although with a significant loss in resolution. This option assumes you have installed various public-domain unix image conversion programs. You can preview .pcx files using e.g. xli file.pcx &. Specify type=1 to make nice fullsize graphs or type=3 for making 5 x 7" landscape graphs using 14-point type (useful for submitting to journals). type=2 (the default) is for color 35mm slides. Use type=4 to make nice black and white overhead projection transparancies (portrait mode). This uses line thickness 4, pointsize 14, height 8, width 7. For type=3, numbers on the y-axis are written horizontally (las defaults to 1 for type=3).

ps.slide calls mgp.axis.labels in Hmisc set up axis-specific defaults for the 2nd mgp graphical parameter. See Overview for Hmisc for help. This is only used automatically for select high-level graphics functions in Hmisc and Design, as S-Plus only supports a single distance between tick marks and tick mark labels using par, and when las=1 a larger distance is needed for the y-axis.

See the body of the function for type-specific default values for many of the parameters. This function has not been tested for color output on Windows systems.

setps is a function that makes small postscript plots with minimal surrounding white space, suitable for inclusion in books and reports. Internally setps uses (and defines) the psfig function by Antonio Possolo (antonio@atc.boeing.com). setps is especially good for including plots in LaTeX. setps creates a temporary function in the session database that when invoked will convert a completed postscript graphics file to a Adobe Acrobat .pdf if you have Ghostscript installed and in your path (so that the gs command is available in UNIX or gswin32c is available for Windows/NT). Invoke topdf by the command topdf(), or, if you want to convert a graphic other than the last one created, run topdf(filename) to convert filename.ps to filename.pdf. If trellis=TRUE, setps invokes trellis.device with a postscript device argument, and it does not set any of the par parameters. Arguments 3, 4, 5, 7, 9, and 10 to setps are ignored if trellis=TRUE. If options(setpsPrefix="name") is defined, the "name" string will be prefixed to the file name used by setps. setpdf uses a similar option setpdfPrefix. setps and setpdf set par(mgp=c(2,0.4,0)) if trellis=FALSE.

setpdf is similar to setps but for making Adobe Acrobat PDF graphics files directly. There are a few problems with the S-Plus pdf.graph function used by setpdf, though: (1) the default for points (open circle) is too large, (2) graphs are not centered properly, (3) gray scale does not work, and (4) there is some wasted space at the bottom of the graph. When drawing points, the user may want to specify cex=0.7. It may be better to use setps followed by topdf().

tex is a little function to save typing when including \tex commands in graphs that are used with the psfrag package in LaTeX to typeset any LaTeX text inside a postscript graphic. tex surrounds the input character string with \tex[options]{}. This is especially useful for getting Greek letters and math symbols in postscript graphs. By default tex returns a string with psfrag commands specifying that the string be centered, not rotated, and not specially enlarged or shrunk.

showPsfrag is used to display (using ghostview) a postscript image that contained psfrag LaTeX strings, by building a small LaTeX script and running latex and dvips.

Usage

ps.slide(file, background = if (type != 2) "white" else "navy blue",
         foreground = if (type == 2) "yellow" else
                     (if(background == "white") "black" else "white"),
         font = "Helvetica", pointsize = c(24, 28, 14, 14)[type],
         hor = type != 4, lwd = c(2, 5, 2, 4)[type],
         mgp = if(under.unix) list(c(1.8, 0.4, 0), c(1.5, 0.2, 0),
                 c(2, 0.4, 0), c(1.5, 0.2, 0))[[type]] else
                 list(c(1.8, 0.5, 0), c(1.5, 0.4, 0), c(2, 0.5, 0),
                 c(1.5, 0.4, 0))[[type]],
         mar = list(c(4, 3, 2, 1) + 0.1, c(5, 4, 2.25, 2) + 0.1,
                 c(3, 3, 1, 1) + 0.1, c(5, 4, 2.25, 2) + 0.1)[[type]],
         pch = 202, view = FALSE, pcx = FALSE, tiff = FALSE,
         close = view | pcx | tiff, bty = "l",
         type = 2, height = switch(type, NULL, NULL, 5, 8),
         width = switch(type, NULL, NULL, 7, 7),
         tck = if (type == 3 || !under.unix) -0.013 else par("tck"),
         las = if (type == 3) 1 else 0, eps =  FALSE, ...)

setps(filename, w=0, h=3, pointsize=10, sublines=0, toplines=0,
      type="symbol", lwd=2, font="Helvetica",
      leftlines=0, las=1,
      trellis=!(missing(setTrellis.) & missing(strip.blank) &
                missing(lty.dot.line) & missing(lwd.dot.line)), 
      setTrellis.=TRUE, 
      strip.blank =TRUE, lty.dot.line = 1, lwd.dot.line = 1,
      seqno=NULL, color=FALSE)

setpdf(filename, w=0, h=4, pointsize=10, sublines=0, toplines=0,
       type="symbol", lwd=1.5, font=if(.R.)"Helvetica" else 1,
       ratio= if(.R.) 4/3 else (1 + sqrt(5))/2,
       leftlines=0, las=1, bty='l', hor=FALSE, 
       trellis=!(missing(setTrellis.) & missing(strip.blank) &
                 missing(lty.dot.line) & missing(lwd.dot.line)), 
       setTrellis.=TRUE, 
       strip.blank =TRUE, lty.dot.line = 1, lwd.dot.line =1,
       region=c(0, 0, h, w), color=FALSE, seqno=NULL, ...)

tex(string, lref='c', psref='c', scale=1, srt=0)

showPsfrag(filename)

Arguments

file
filename name or character string or character vector specifying file prefix. For setps or setpdf specify type="char" if this is a character vector or a quote-delimited character string.
string a character string to be processed by psfrag in LaTeX.
background default is yellow on navy blue background (black on white for type=1,3. background may also be set to any legitimate background color listed in the S-supplied object ps.colors.rgb.
foreground foreground color. See background for allowable values.
font font for text. Replaces the first font in the standard list of fonts in ps.options("fonts"). If font="Times-Roman", the fifth font (normally Helvetica-Bold) is set to Times-Bold. For setpdf, font is a number, and the default is 1 for Helvetica. All default fonts are Helvetica for setps, psfig, and ps.slide.
pointsize postscript point size. Set to a larger number if using multiple plots via par(mfrow=).
hor default is TRUE to make a horizontal graph
lwd line width
mgp see par. Defaults are chosen according to type.
mar margins (see par)
pch see par
view set to TRUE to initiate a ghostview run string.wild('this is a cat','is a*', 'Z') qualify <- function(x) x==' 1.5 ' | x==' 2.5 ' replace.substring.wild('He won 1.5 million $','won*million', 'lost*million', test=qualify) replace.substring.wild('He won 1 million $','won*million', 'lost*million', test=qualify) replace.substring.wild('He won 1.2 million $','won*million', 'lost*million', test=numeric.string) x <- c('a = b','c < d','hello') sedit(x, c('=','he*o'),c('==','he*')) sedit('x23', '*$', '[*]', test=numeric.string) sedit('23xx', '^*', 'Y_{*} ', test=all.digits) replace.substring.wild("abcdefabcdef", "d*f", "xy") x <- "abcd" substring2(x, "bc") <- "BCX" x substring2(x, "B*d") <- "B*D" x
[Package Hmisc version 3.4-3 Index]
./usr/lib/R/site-library/Hmisc/html/partition.html0000644000000000000000000000366211023547354021020 0ustar rootroot R: Patitions an object into different sets
partition {Hmisc}R Documentation

Patitions an object into different sets

Description

Partitions an object into subsets of length defined in the sep argument.

Usage

partition.vector(x, sep, ...)
partition.matrix(x, rowsep, colsep, ...)

Arguments

x object to be partitioned.
sep determines how many elements should go into each set. The sum of sep should be equal to the length of x.
rowsep determins how many rows should go into each set. The sum of rowsep must equal the number of rows in x.
colsep determins how many columns should go into each set. The sum of colsep must equal the number of columns in x.
... arguments used in other methods of partition.

Value

A list of equal length as sep containing the partitioned objects.

Author(s)

Charles Dupont

See Also

split

Examples

a <- 1:7
partition.vector(a, sep=c(1,3,2,1))

[Package Hmisc version 3.4-3 Index]
./usr/lib/R/site-library/Hmisc/html/pstamp.html0000644000000000000000000000310511023547357020306 0ustar rootroot R: Date/Time/Directory Stamp the Current Plot
pstamp {Hmisc}R Documentation

Date/Time/Directory Stamp the Current Plot

Description

Date-time stamp the current plot in the extreme lower right corner. Optionally add the current working directory and arbitrary other text to the stamp.

Usage

pstamp(txt, pwd = FALSE, time. = TRUE)

Arguments

txt an optional single text string
pwd set to TRUE to add the current working directory name to the stamp
time. set to FALSE to use the date without the time

Details

Certain functions are not supported for S-Plus under Windows. For R, results may not be satisfactory if par(mfrow=) is in effect.

Author(s)

Frank Harrell

Examples

plot(1:20)
pstamp(pwd=TRUE, time=FALSE)

[Package Hmisc version 3.4-3 Index]
./usr/lib/R/site-library/Hmisc/html/ps.slide.html0000644000000000000000000004365011023547356020533 0ustar rootroot R: Postscript and Adobe PDF Setup for 35mm Slides and Other Formats
ps.slide {Hmisc}R Documentation

Postscript and Adobe PDF Setup for 35mm Slides and Other Formats

Description

The ps.slide function has nice defaults to create postscript images with larger font, thicker lines, and better axis labeling. These images can be used to make nice slides. There is an option to view the constructed postscript file using ghostview, and an option to initiate a background process to convert the postscript file to a PC Paintbrush .pcx file for importing into various PC presentation graphics packages although with a significant loss in resolution. This option assumes you have installed various public-domain unix image conversion programs. You can preview .pcx files using e.g. xli file.pcx &. Specify type=1 to make nice fullsize graphs or type=3 for making 5 x 7" landscape graphs using 14-point type (useful for submitting to journals). type=2 (the default) is for color 35mm slides. Use type=4 to make nice black and white overhead projection transparancies (portrait mode). This uses line thickness 4, pointsize 14, height 8, width 7. For type=3, numbers on the y-axis are written horizontally (las defaults to 1 for type=3).

ps.slide calls mgp.axis.labels in Hmisc set up axis-specific defaults for the 2nd mgp graphical parameter. See Overview for