[英]What is the equivalent of officer::ph_location_fullsize( ) in the package rvg?
I would like to export multiple edible plots and tables from R to PowerPoint. 我想将多个可食用的地块和桌子从R导出到PowerPoint。
Below is a snippet of the code that I have, and the packages I'm using: 以下是我拥有的代码片段以及我正在使用的软件包:
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)
In the output, the exported graph and table only covers the bottom 2/3 of the slide. 在输出中,导出的图形和表格仅覆盖幻灯片的底部2/3。 How can I modify my code so that the content I'm trying to export could occupy the entire slide? 如何修改我的代码,以便我尝试导出的内容可以占据整个幻灯片?
An additional question: If I would like to add a title to my slide, how do I specify the alignment (left preferred), size and color of the text? 另一个问题:如果我想在幻灯片上添加标题,如何指定文本的对齐方式(首选),大小和颜色? The default alignment is center, and I have not found a way to go around it. 默认对齐方式是居中,但我还没有找到解决方法。
Thank you. 谢谢。
Use ph_location_fullsize()
and it will work. 使用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")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.