Prints a trellis/lattice object to a file device

Share:

Description

This routine takes a lattice/trellis object and prints it to one of the following devices: jpg, tiff, eps, or pdf.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
hardcopyLattice(plt = NULL,
                fileName = '',
                filePath = file.path(getwd(),'figures'),
                eps2pdf = TRUE,
                family = 'Helvetica',
                pointsize.text = 16,
                runQuiet = FALSE,
                columnsPerRow = 2,
                pdf.height = 8,
                pdf.width = 8
               )

Arguments

plt

a list of lattice plot object of class 'trellis' OR a single object of class trellis that will be wrapped into a list for processing

fileName

character file name to send the output to; the extension determines the type of device to open

filePath

the complete path to fileName

eps2pdf

TRUE: convert eps to pdf; FALSE: leave as eps. This option requires the epstopdf utility to be installed on your system!

family

font family

pointsize.text

overall pointsize, not real discerning at this point (pun intended)

runQuiet

FALSE: let user know the file is being written; TRUE: run silently

columnsPerRow

number of columns for each row in output matrix

pdf.height

in inches; note that this can affect the way panels are presented. For example, if numPlts=4 and pdf.height=8, with 2 time periods (2 panels), they are side-by-side; but if pdf.height=10, they are one atop the other in each of the 4 split displays.

pdf.width

width of a pdf output; making this larger that pdf.height is one way to get "landscape" in pdf output

Details

This routine does the same thing for each device type (except when eps2pdf is in effect). After rescaling the font in the object, it simply opens an output device of the correct type and prints the lattice object to that device, then closes it.

It now allows one to pass a list of trellis plot objects for printing on a single page as arranged via columnsPerRow.

Value

Nothing is returned.

Author(s)

Jeffrey Gove

See Also

print.trellis, device, lattice

Examples

1
2
3
4
5
6
## Not run: 
  Depth <- equal.count(quakes$depth, number=8, overlap=.1)
  j = xyplot(lat ~ long | Depth, data = quakes)
  hardcopyLattice(j, 'j.pdf')

## End(Not run)