Closed longhaivo closed 3 years ago
Is this in RStudio server or a local RStudio instance?
Hi Tyler, Sorry for the delay rep, I got tied up with work. This is done in a local RStudio session. The code works fine outside of a markdown environment. When knitting it, an rgl viewer window pops up when the 3D plot is created. But in the resulting html file there is no embedded plot. Also here is the session info:
R version 3.4.1 (2017-06-30) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1 Matrix products: default locale: [1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252
[3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C
[5] LC_TIME=English_Australia.1252
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages: [1] rgl_0.100.19 viridis_0.5.1 viridisLite_0.3.0 ggplot2_3.2.0
[5] sf_0.7-5 rayshader_0.11.1 sp_1.3-1
loaded via a namespace (and not attached): [1] Rcpp_1.0.1 lattice_0.20-38 prettyunits_1.0.2
[4] png_0.1-7 class_7.3-15 assertthat_0.2.1
[7] digest_0.6.18 foreach_1.4.4 mime_0.6
[10] R6_2.4.0 imager_0.41.2 tiff_0.1-5
[13] plyr_1.8.4 ggpmisc_0.3.1 evaluate_0.13
[16] e1071_1.7-2 pillar_1.4.2 rlang_0.3.4
[19] progress_1.2.2 lazyeval_0.2.2 rstudioapi_0.10
[22] miniUI_0.1.1.1 bmp_0.3 DT_0.5
[25] rmarkdown_1.12.8 labeling_0.3 webshot_0.5.1
[28] stringr_1.4.0 htmlwidgets_1.3 igraph_1.2.4.1
[31] munsell_0.5.0 shiny_1.3.2 compiler_3.4.1
[34] httpuv_1.5.1 xfun_0.7 pkgconfig_2.0.2
[37] htmltools_0.3.6 readbitmap_0.1.5 tidyselect_0.2.5
[40] gridExtra_2.3 tibble_2.1.1 codetools_0.2-16
[43] crayon_1.3.4 dplyr_0.8.0.1 withr_2.1.2
[46] later_0.8.0 grid_3.4.1 jsonlite_1.6
[49] xtable_1.8-4 gtable_0.3.0 DBI_1.0.0
[52] magrittr_1.5 units_0.6-3 scales_1.0.0
[55] KernSmooth_2.23-15 stringi_1.4.3 promises_1.0.1
[58] doParallel_1.0.14 iterators_1.0.10 tools_3.4.1
[61] manipulateWidget_0.10.0 glue_1.3.1 purrr_0.3.2
[64] hms_0.4.2 crosstalk_1.0.0 jpeg_0.1-8
[67] rsconnect_0.8.13 yaml_2.2.0 parallel_3.4.1
[70] colorspace_1.4-1 classInt_0.3-3 knitr_1.22
To embed the plot into an RMarkdown document, you need to call rgl::rglwidget()
after bringing up your plot. If you're embedding multiple plots, you will also have to close to previous plot using rgl::rgl.close()
before plotting the next one.
Do you mind sharing what the final code looks like? Still struggling a bit with what goes into rgl::rglwidget()
Apologies if this issue may be irrelevant to this package.
As the title indicated, I'm trying to put the interactive plot_gg objects into Rmarkdown. In the help file of plot_gg, I take it that it produces an rgl object, but somehow the code attached does not work (i.e. no interactive plot is shown).
title: "Untitled" author: "blah" date: "12/07/2019" output: html_document
Helps are much appreciated.
Long