2

我在将 ggplots 转换为 rayshader 3d 图形时遇到问题。我在 Rayshader 主页上测试了许多不同的示例,但它不起作用。例如我从官方主页的演示示例中获得的这段代码:

library(rayshader)
library(ggplot2)

mtplot = ggplot(mtcars) +
 geom_point(aes(x=mpg,y=disp,color=cyl)) +
 scale_color_continuous(limits=c(0,8))

plot_gg(mtplot, width=3.5, multicore = TRUE, windowsize = c(1400,866), sunangle=225,
       zoom = 0.60, phi = 30, theta = 45)

当我执行此代码时,x11 窗口打开,但它是空白的,看起来像这样。当我使用preview=T它时,它工作正常,因为 x11 窗口没有打开。当我关闭这个空白窗口时,我的 R 会话被中止,并在控制台中显示:
调用纯虚拟方法。我不知道如何解决这个问题,到目前为止我在互联网上找不到任何东西。

这是我的会话信息:

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=German_Germany.1252  LC_CTYPE=German_Germany.1252    LC_MONETARY=German_Germany.1252
[4] LC_NUMERIC=C                    LC_TIME=German_Germany.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] ggplot2_3.3.3     rayshader_0.24.11

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.6              pillar_1.6.1            compiler_4.1.0          later_1.2.0            
 [5] prettyunits_1.1.1       iterators_1.0.13        tools_4.1.0             progress_1.2.2         
 [9] digest_0.6.27           tibble_3.1.2            jsonlite_1.7.2          lifecycle_1.0.0        
[13] gtable_0.3.0            pkgconfig_2.0.3         rlang_0.4.11            foreach_1.5.1          
[17] DBI_1.1.1               shiny_1.6.0             crosstalk_1.1.1         parallel_4.1.0         
[21] xfun_0.23               fastmap_1.1.0           withr_2.4.2             dplyr_1.0.6            
[25] knitr_1.33              generics_0.1.0          vctrs_0.3.8             htmlwidgets_1.5.3      
[29] hms_1.1.0               tidyselect_1.1.1        manipulateWidget_0.10.1 webshot_0.5.2          
[33] grid_4.1.0              glue_1.4.2              R6_2.5.0                fansi_0.4.2            
[37] rgl_0.106.8             purrr_0.3.4             magrittr_2.0.1          scales_1.1.1           
[41] codetools_0.2-18        promises_1.2.0.1        ellipsis_0.3.2          htmltools_0.5.1.1      
[45] assertthat_0.2.1        mime_0.10               xtable_1.8-4            colorspace_2.0-1       
[49] httpuv_1.6.1            utf8_1.2.1              miniUI_0.1.1.1          doParallel_1.0.16      
[53] munsell_0.5.0           crayon_1.4.1           
4

0 回答 0