Closed lincj1994 closed 2 years ago
This error is not thrown directly by export
but seems rather linked to dependencies. I need more info to better understand your issue:
capabilities()
graph2ppt
? Would you have a small example that I could use to replicate the issue?sessionInfo()
Thanks for your reply. The output of
> capabilities()
jpeg png tiff tcltk X11 aqua http/ftp
TRUE TRUE TRUE TRUE FALSE FALSE TRUE
sockets libxml fifo cledit iconv NLS Rprof
TRUE TRUE TRUE TRUE TRUE TRUE TRUE
profmem cairo ICU long.double libcurl
TRUE TRUE TRUE TRUE TRUE
And the output of
> sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)
Matrix products: default
locale:
[1] LC_COLLATE=Chinese (Simplified)_China.936
[2] LC_CTYPE=Chinese (Simplified)_China.936
[3] LC_MONETARY=Chinese (Simplified)_China.936
[4] LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_China.936
attached base packages:
[1] grid stats graphics grDevices utils datasets methods base
other attached packages:
[1] magrittr_2.0.1 gsubfn_0.7 proto_1.0.0
[4] future.apply_1.7.0 future_1.21.0 tibble_3.1.2
[7] tidyr_1.1.3 dplyr_1.0.6 export_0.3.0
[10] ComplexHeatmap_2.6.2 pheatmap_1.0.12 ggsci_2.9
[13] viridis_0.6.1 viridisLite_0.4.0 hrbrthemes_0.8.0
[16] ggrepel_0.9.1 ggplot2_3.3.4 select_1.6
[19] maftools_2.6.05
loaded via a namespace (and not attached):
[1] readxl_1.3.1 uuid_0.1-4
[3] backports_1.2.1 circlize_0.4.13
[5] systemfonts_1.0.2 plyr_1.8.6
[7] igraph_1.2.6 splines_4.1.0
[9] listenv_0.8.0 crosstalk_1.1.1
[11] GenomeInfoDb_1.26.7 inline_0.3.19
[13] digest_0.6.27 foreach_1.5.1
[15] htmltools_0.5.1.1 fansi_0.5.0
[17] cluster_2.1.2 doParallel_1.0.16
[19] openxlsx_4.2.3 globals_0.14.0
[21] extrafont_0.17 matrixStats_0.59.0
[23] officer_0.3.18 extrafontdb_1.0
[25] colorspace_2.0-1 rrcov_1.5-5
[27] haven_2.4.1 xfun_0.23
[29] tcltk_4.1.0 jsonlite_1.7.2
[31] crayon_1.4.1 RCurl_1.98-1.3
[33] survival_3.2-11 zoo_1.8-9
[35] iterators_1.0.13 glue_1.4.2
[37] survminer_0.4.9 rvg_0.2.5
[39] gtable_0.3.0 zlibbioc_1.36.0
[41] XVector_0.30.0 GetoptLong_1.0.5
[43] DelayedArray_0.16.2 car_3.0-10
[45] Rttf2pt1_1.3.8 shape_1.4.6
[47] BiocGenerics_0.36.0 DEoptimR_1.0-9
[49] abind_1.4-5 survtype_1.6.0
[51] scales_1.1.1 mvtnorm_1.1-2
[53] DBI_1.1.1 rstatix_0.7.0
[55] miniUI_0.1.1.1 Rcpp_1.0.6
[57] xtable_1.8-4 clue_0.3-59
[59] foreign_0.8-81 mclust_5.4.7
[61] km.ci_0.5-2 stats4_4.1.0
[63] tsne_0.1-3 htmlwidgets_1.5.3
[65] RColorBrewer_1.1-2 ellipsis_0.3.2
[67] pkgconfig_2.0.3 utf8_1.2.1
[69] manipulateWidget_0.11.0 later_1.2.0
[71] tidyselect_1.1.1 rlang_0.4.11
[73] munsell_0.5.0 cellranger_1.1.0
[75] tools_4.1.0 generics_0.1.0
[77] clustvarsel_2.3.4 devEMF_4.0-2
[79] broom_0.7.6 fastmap_1.1.0
[81] evaluate_0.14 knitr_1.33
[83] zip_2.2.0 robustbase_0.93-8
[85] survMisc_0.5.5 rgl_0.106.8
[87] purrr_0.3.4 mime_0.10
[89] slam_0.1-48 leaps_3.1
[91] xml2_1.3.2 compiler_4.1.0
[93] curl_4.3.1 png_0.1-7
[95] ggsignif_0.6.1 pcaPP_1.9-74
[97] stringi_1.5.3 forcats_0.5.1
[99] gdtools_0.2.3 stargazer_5.2.2
[101] lattice_0.20-44 Matrix_1.3-4
[103] KMsurv_0.1-5 vctrs_0.3.8
[105] pillar_1.6.1 lifecycle_1.0.0
[107] GlobalOptions_0.1.2 data.table_1.14.0
[109] bitops_1.0-7 flextable_0.6.6
[111] httpuv_1.6.1 GenomicRanges_1.42.0
[113] R6_2.5.0 promises_1.2.0.1
[115] gridExtra_2.3 rio_0.5.26
[117] parallelly_1.26.0 IRanges_2.24.1
[119] codetools_0.2-18 assertthat_0.2.1
[121] SummarizedExperiment_1.20.0 BMA_3.18.15
[123] rjson_0.2.20 withr_2.4.2
[125] S4Vectors_0.28.1 GenomeInfoDbData_1.2.4
[127] parallel_4.1.0 hms_1.1.0
[129] rmarkdown_2.8 MatrixGenerics_1.2.1
[131] carData_3.0-4 Cairo_1.5-12.2
[133] ggpubr_0.4.0 BiRewire_3.22.0
[135] shiny_1.6.0 Biobase_2.50.0
[137] base64enc_0.1-3
I ran grapn2ppt after I have plot my graph.
> df <- data.frame(V1 = rnorm(100), V2 = rnorm(100))
> ggplot(df, aes(x = V1, y = V2)) + geom_point()
> graph2ppt(file = 'df.pptx', width = 6, height = 5)
Error in PPTX_(file, bg, width, height, offx = offx, offy = offy, pointsize = pointsize, :
Graphics API version mismatch
Hmm I don't see an obvious solution here... Do you get the same issue when you run this?
df <- data.frame(V1 = rnorm(100), V2 = rnorm(100))
gg <- ggplot(df, aes(x = V1, y = V2)) + geom_point()
graph2ppt(gg, file = 'df.pptx', width = 6, height = 5)
Yes :(
Ok let's try to find where the error exactly occurs. export
is depending on rvg
and officer
to generate ppt files. Do you have any error when running this example code (taken from the rvg
README)?
library(rvg)
library(ggplot2)
library(officer)
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")
Hi. Sorry for the late reply.
The R News for 4.1.0 state:
The graphics engine version, R_GE_version, has been bumped to 14 and so packages that provide graphics devices should be reinstalled.
I have reinstalled Cairo package and solved the problem.
Excellent, thanks for the update!
Hi. I used the graph2ppt and it returned an error: