When using officer and the rvg graphics I want my images to not have the background white square. The reason for this is that some functions leave a lot of empty space up at the top and often this will overlap with the header. I can go in and delete each one but when making 20 or more plots this gets tedious fast.
Specifically I want to use this with the forest function in metafor used here in the example.
**
library(officer)
doc <- read_pptx()
doc <- add_slide(doc, "Title and Content", "Office Theme")
doc <- ph_with_vg_at(doc, code = barplot(1:5, col = 2:6),
left = 1, top = 2, width = 6, height = 4)
library(metafor)
library(gemtc)
network <-mtc.network(smoking$data.ab)
data(dat.bcg)
plot(network)
res <- rma(ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg, measure="RR",
slab=paste(author, year, sep=", "), method="REML")
forest(res)
doc <- add_slide(doc, "Title and Content", "Office Theme")
doc <- ph_with_vg(doc, code = plot(network), type = "body", width = 8, height = 6)
doc <- add_slide(doc, "Title and Content", "Office Theme")
doc <- ph_with_vg(doc, code = forest(res), type = "body", width = 8, height = 6)
print(doc, target = "vg.pptx")
This is now possible using the latest rvg update and setting the background to "NA".
anyplot = dml(code = barplot(1:5, col = 2:6), bg = "NA")
doc <- read_pptx()
doc <- add_slide(doc)
doc <- ph_with(doc, anyplot, location = ph_location_fullsize())
print(doc, target = "bg.pptx")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.