plot_gg_ppt: Plot ggplot object to ppt

View source: R/ppt-utils.R

plot_gg_pptR Documentation

Plot ggplot object to ppt

Description

Plot ggplot object to ppt

Usage

plot_gg_ppt(
  gg,
  out_ppt,
  height = 6,
  width = 6,
  left = 5,
  top = 5,
  inches = FALSE,
  sep_legend = FALSE,
  transparent_bg = TRUE,
  rasterize_plot = FALSE,
  rasterize_legend = FALSE,
  res = 300,
  new_slide = FALSE,
  overwrite = FALSE,
  legend_height = NULL,
  legend_width = NULL,
  legend_left = NULL,
  legend_top = NULL,
  tmpdir = tempdir()
)

Arguments

gg

ggplot object

out_ppt

output pptx file

height

height in cm

width

width in cm

left

left alignment in cm

top

top alignment in cm

inches

measures are given in inches

sep_legend

plot legend and plot separately

transparent_bg

make background of the plot transparent

rasterize_plot

rasterize the plotting panel

rasterize_legend

rasterize the legend panel. Works only when sep_legend=TRUE and rasterize_plot=TRUE

res

resolution of png used to generate rasterized plot

new_slide

add plot to a new slide

overwrite

overwrite existing file

legend_height, legend_width, legend_left, legend_top

legend position and size in case sep_legend=TRUE. Similar to to height,width,left and top. By default - legend would be plotted to the right of the plot.

tmpdir

temporary directory to store the rasterized png intermediate files

Examples


library(ggplot2)
gg <- ggplot(mtcars, aes(x = mpg, y = drat)) +
    geom_point()
temp_ppt <- tempfile(fileext = ".pptx")
plot_gg_ppt(gg, temp_ppt)

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