README.md

tgppt

CRAN
status Codecov test
coverage

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.

Installation

You can install tgppt with:

remotes::install_github("tanaylab/tgppt")

Example

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))

rasterize ggplot plotting area

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)


tanaylab/tgppt documentation built on Aug. 25, 2023, 5:46 a.m.