davidgohel / rvg

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

Not able to produce any plots in R on Mac Studio #54

Open jamesjiadazhan opened 10 months ago

jamesjiadazhan commented 10 months ago

I tried to use the function, but it does not work. I think it is because I cannot use font_family_exists() on my icloud, which has two users. Or because I am using Mac Studio. Anyway to solve this? I am very frustrated about this. Thanks a lot.

r$> library(rvg)
    library(ggplot2)
    library(officer)

r$> my_vec_graph <- dml(code = barplot(1:5, col = 2:6))

    doc <- read_pptx()
    doc <- add_slide(doc, layout = "Title and Content", master = "Office Theme")
    doc <- ph_with(doc, my_vec_graph, location = ph_location_fullsize() )
    print(doc, target = "my_plot.pptx")

 *** caught segfault ***
address 0x0, cause 'invalid permissions'

Traceback:
 1: system_fonts_c()
 2: system_fonts()
 3: sys_fonts()
 4: FUN(X[[i]], ...)
 5: lapply(def_fonts, font_family_exists)
 6: unlist(lapply(def_fonts, font_family_exists))
 7: default_fontname()
 8: validate_fonts(fonts)
 9: dml_pptx(offx = 0L, offy = 0L, width = 10, height = 7.5, bg = "white",     fonts = list(), pointsize = 12, editable = TRUE, file = "/var/folders/r7/g81tj9ds70bdmgdbnp49ddn80000gn/T//RtmpuD95Yx/file57a159673765",     id = 0L, last_rel_id = 1, raster_prefix = "/var/folders/r7/g81tj9ds70bdmgdbnp49ddn80000gn/T//RtmpuD95Yx/file57a11170246c/raster-",     standalone = FALSE)
10: do.call("dml_pptx", pars)
11: ph_with.dml(doc, my_vec_graph, location = ph_location_fullsize())
12: ph_with(doc, my_vec_graph, location = ph_location_fullsize())

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace