当我尝试使用 ggplot 在 Shiny 应用程序中呈现相关散点图时,会出现以下错误:Failed to create Cairo backend!
output$model <- renderPlot({
k <- dataIn()
cormat <- round(cor(k),2)
library(reshape2)
melted_cormat <- melt(cormat)
wyk3 <- ggplot(data = melted_cormat, aes(x=Var1, y=Var2, fill=value))
return(wyk3)
})
这是我在控制台中得到的:
Warning: Error in Cairo: Failed to create Cairo backend!
128: Cairo
127: pngfun
126: startPNG
125: drawPlot
111: <reactive:plotObj>
95: drawReactive
82: origRenderFunc
81: output$model
1: shiny::runApp
我不知道可能是什么问题,其他 ggplot 散点图可以正确渲染,并且在常规 Rscript 中使用 x11() 散点图也会出现。
你能帮我,解释一下我在做什么有什么问题吗?
'> sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=Polish_Poland.1250 LC_CTYPE=Polish_Poland.1250 LC_MONETARY=Polish_Poland.1250
[4] LC_NUMERIC=C LC_TIME=Polish_Poland.1250
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] reshape_0.8.8 ggplot2_3.1.0 lattice_0.20-38 shiny_1.2.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.0 pillar_1.3.1 compiler_3.5.2 later_0.7.5 plyr_1.8.4
[6] bindr_0.1.1 tools_3.5.2 digest_0.6.18 jsonlite_1.6 tibble_2.0.1
[11] gtable_0.2.0 pkgconfig_2.0.2 rlang_0.3.1 rstudioapi_0.9.0 yaml_2.2.0
[16] bindrcpp_0.2.2 withr_2.1.2 dplyr_0.7.8 grid_3.5.2 tidyselect_0.2.5
[21] glue_1.3.0 R6_2.3.0 purrr_0.2.5 magrittr_1.5 scales_1.0.0
[26] promises_1.0.1 htmltools_0.3.6 assertthat_0.2.0 mime_0.6 xtable_1.8-3
[31] colorspace_1.3-2 httpuv_1.4.5.1 labeling_0.3 lazyeval_0.2.1 munsell_0.5.0
[36] crayon_1.3.4 Cairo_1.5-9