davidgohel / rvg

https://davidgohel.github.io/rvg/
131 stars 15 forks source link

Are editable graph exports to Word by Officer and rgv possible? #42

Closed Biopticon closed 3 years ago

Biopticon commented 3 years ago

Similar to your pptx and xlsx exports, when I try the following

library(ggplot2)
library(officer)
library(rvg)

gg <- ggplot(mtcars, aes(x = mpg , y = wt, colour = qsec)) + geom_point() + theme_minimal()

my_vec_graph <- rvg::dml(ggobj = gg)

doc <- read_docx()
body_add_gg(doc, value  =  my_vec_graph, style  =  "centered")
print(doc, target  =  "vg.docx")

I get this error: Error in body_add_gg(doc, value = my_vec_graph, style = "centered") : inherits(value, "gg") is not TRUE

Does this mean that officer/rgv cannot produce editable vector graphics in Word?

davidgohel commented 3 years ago

I believe it's a duplicate of #37 and #36