# NOT RUN {
## See the examples in the help files, the demo files, and in the
## examples subdirectory.
## The example here shows how to locate the generated .tex file and the displayed .pdf file.
## The .tex file can be brought into a larger .tex file with an \include statement.
## The .pdf file can be brought into a larger .tex file with an \includegraphics statement.
# }
# NOT RUN {
## These are the settings for my machines
## Set options for Hmisc::latex
latexSetOptions()
mpgGraph <- lattice::xyplot(mpg ~ wt, group=factor(cyl), data=mtcars,
xlim=c(.8, 6.2), ylim=c(9,37),
pch=as.character(levels(factor(mtcars$cyl))), cex=2)
mpgGraph ## on your interactive device
mpgLatex <-
latex(mpgGraph,
height.panel=2, width.panel=3, ## inch. pick numbers that look right to you.
height.x.axis=.37, width.y.axis=.44, ## inch. these require trial and error.
height.xlab=.18, width.ylab=.27, ## inch. these require trial and error.
rowname=NULL, ## suppress rownames, see ?latex
colheads=FALSE) ## suppress colnames, see ?latex
print.default(mpgLatex) ## file is in your working directory
mpgPdf <- dvi(mpgLatex)
print.default(mpgPdf) ## File is in a temporary directory.
## If Macintosh shows "//", replace by "/" before using.
mpgPdf
# }
# NOT RUN {
## Sweave users can bring the generated files directly into their
## document. See the discussion of the \code{file} argument in
## \code{\link[Hmisc]{latex}} to learn how to use this feature with
## Sweave.
# }
Run the code above in your browser using DataLab