The goal of tgppt is to provide handy functions to plot directly to Powerpoint in R. It is based on the magnificent officer package by David Gohel.
You can install tgppt with:
remotes::install_github("tanaylab/tgppt")
Plot base R directly to a Powerpoint presentation:
library(tgppt)
temp_ppt <- tempfile(fileext = ".pptx")
plot_base_ppt({plot(mtcars$mpg, mtcars$drat)}, temp_ppt)
Plot ggplot to a Powerpoint presentation:
library(tgppt)
library(ggplot2)
gg <- ggplot(mtcars, aes(x=mpg, y=drat)) + geom_point()
temp_ppt <- tempfile(fileext = ".pptx")
plot_gg_ppt(gg, temp_ppt)
Create a new Powerpoint file:
library(tgppt)
new_ppt("myfile.pptx")
Use “Arial” font based ggplot theme:
ggplot2::theme_set(theme_arial(8))
Powerpoint might crash when plotting a large number of points. To avoid
that, set rasterize_plot
to TRUE
:
plot_gg_ppt(gg, temp_ppt, rasterize_plot = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.