tofigure | R Documentation |
output figures to different formats
tofigure(figure, format = NULL, filename = "temp.pdf")
figure |
output figure function, set NULL output the current figure |
format |
output format (could be ingored) |
filename |
output filename with different format as suffix |
Kai Guo
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"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.