Learn R Programming

eoffice (version 0.1.6)

tofigure: 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

Examples

Run this code
# NOT RUN {
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"))
# }
# NOT RUN {
## 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"))
# }

Run the code above in your browser using DataLab