包 rvg 中 officer::ph_location_fullsize( ) 的等价物是什么?

What is the equivalent of officer::ph_location_fullsize( ) in the package rvg?

我想将多个 edible 图和 tables 从 R 导出到 PowerPoint。

下面是我拥有的代码片段以及我正在使用的包:

library(ggplot2)
library(dplyr)
library(tidyr)
library(gridExtra)
library(grid)
library(officer)
library(rvg)

read_pptx() %>%
   add_slide(layout = "Title and Content", master = "Office Theme") %>%
   ph_with_vg(code = grid.arrange(plot, table, col = 1), type = "body") %>%
   print(target = path)

在输出中,导出的图形和 table 仅覆盖幻灯片底部的 2/3。 如何修改我的代码,以便我尝试导出的内容可以占据整张幻灯片?

补充一个问题: 如果我想为我的幻灯片添加标题,我该如何指定文本的对齐方式(首选左对齐)、大小和颜色?默认对齐方式是居中,我还没有找到绕过它的方法。

谢谢。

使用 ph_location_fullsize() 就可以了。

library(officer)
library(magrittr)
library(rvg)

read_pptx() %>%
  add_slide(layout = "Title and Content", master = "Office Theme") %>%
  ph_with(value = dml(barplot(1:5)), location = ph_location_fullsize()) %>%
  print(target = "test.pptx")