我想设置我正在使用officer打印到powerpoint的ggplot的边框颜色(不是ggplot对象的plot.border元素,而是Powerpoint中该对象的实际边框线颜色)。
我不知道如何通过军官API来做这件事!
例如,在这段可重现的代码中,我希望plot对象有一个“红色”边框--我该怎么做呢?谢谢!
library(officer)
library(magrittr)
library(ggplot2)
p <- ggplot(data.frame(x = seq(10), y = rnorm(10)), aes(x, y)) + geom_col()
my_pres <- read_pptx() %>%
add_slide() %>%
ph_with(value = p, location = ph_location_type(type = "body"))
print(my_pres, "~/Desktop/new_example.pptx")发布于 2021-05-21 05:07:10
这就是你要找的东西吗?
library(officer)
library(magrittr)
library(ggplot2)
p <- ggplot(data.frame(x = seq(10), y = rnorm(10)), aes(x, y)) + geom_col() +
theme(
plot.margin = margin(0.5, 0.5, 0.5, 0.5, "cm"),
plot.background = element_rect(
colour = "red",
size = 1
)
)
my_pres <- read_pptx() %>%
add_slide() %>%
ph_with(value = p, location = ph_location_type(type = "body"))
print(my_pres, "~/Desktop/new_example.pptx")

https://stackoverflow.com/questions/67627565
复制相似问题