R 在ShinyApp中绘制相关散点图

R 在ShinyApp中绘制相关散点图,r,ggplot2,shiny,cairoplot,R,Ggplot2,Shiny,Cairoplot,当我尝试使用ggplot在Shining应用程序中渲染相关散点图时,出现以下错误:未能创建Cairo后端 output$model <- renderPlot({ k <- dataIn() cormat <- round(cor(k),2) library(reshape2) melted_cormat <- melt(cormat) wyk3 <- ggplot(data = melted_

当我尝试使用ggplot在Shining应用程序中渲染相关散点图时,出现以下错误:
未能创建Cairo后端

   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)
    }) 
我参加晚会迟到了。 通常,发生此错误是因为ui中存在一些问题。 我解决这个问题的方法是在ui中添加以下代码:
plotOutput('ggPlot',inline=F)

使用
plotOutput('ggPlot',inline=T)
,我得到了相同的错误。

代码中肯定存在问题,尽管我没有得到您描述的任何错误。您能否提供您的
sessionInfo()
以查看这是否有帮助?您还需要在调用
ggplot
时提供
geom
。如果没有这些,您将无法获得任何数据,但我不认为这会导致您的问题,我无法复制这些问题。
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
'> 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