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.
Before deleting the background.
**
After deleting the background.
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")