tofigure: output figures to different formats

View source: R/toFigure.R

tofigureR Documentation

output figures to different formats

Description

output figures to different formats

Usage

tofigure(figure, format = NULL, filename = "temp.pdf")

Arguments

figure

output figure function, set NULL output the current figure

format

output format (could be ingored)

filename

output filename with different format as suffix

Author(s)

Kai Guo

Examples

require(ggplot2)
p <- ggplot(mtcars, aes(mpg, disp, color = factor(cyl))) + geom_point()
tofigure(p,filename = file.path(tempdir(), "mtcars.pdf"))
## or use ggplot directly
tofigure(ggplot(mtcars, aes(mpg, disp, color = factor(cyl))) +
geom_point(), filename = file.path(tempdir(), "mtcars.eps"))

## if you use basic plot function or other plot function you
## need first use convertplot to convert it to ggplot object
## when you are working on the platform without GUI
p <- convertplot(plot(1:10))
tofigure(p, filename = file.path(tempdir(), "mtcars.pdf"))
topptx(p, filename = file.path(tempdir(), "mtcars.pptx"))


eoffice documentation built on Oct. 5, 2022, 9:05 a.m.