Функция embed_notebook не работает для Plotly в R Jupyter Notebook - PullRequest
0 голосов
/ 08 марта 2020

Я пытаюсь встроить сюжетные графики в блокнот Jupyter, но получаю пустую белую коробку, в которой должен отображаться график. Я использую R 3.5.3 и pando c 2.9.2, см. Пример ниже:

library(dplyr)
library(plotly)
library(ggplot2)
library(rmarkdown)
sessionInfo()
R version 3.5.3 (2019-03-11)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

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

other attached packages:
[1] plotly_4.9.0  ggplot2_3.2.0 dplyr_0.8.3  

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.3        later_0.8.0       pillar_1.4.3      compiler_3.5.3   
 [5] base64enc_0.1-3   tools_3.5.3       digest_0.6.25     uuid_0.1-4       
 [9] jsonlite_1.6.1    evaluate_0.14     tibble_2.1.3      gtable_0.3.0     
[13] viridisLite_0.3.0 pkgconfig_2.0.2   rlang_0.4.5       shiny_1.3.1      
[17] IRdisplay_0.7.0   crosstalk_1.0.0   yaml_2.2.0        IRkernel_1.1     
[21] repr_1.1.0        withr_2.1.2       httr_1.4.0        htmlwidgets_1.3  
[25] grid_3.5.3        tidyselect_0.2.5  glue_1.3.1        data.table_1.12.2
[29] R6_2.4.0          pbdZMQ_0.3-3      purrr_0.3.2       tidyr_0.8.3      
[33] magrittr_1.5      promises_1.0.1    scales_1.0.0      htmltools_0.4.0  
[37] assertthat_0.2.1  xtable_1.8-3      mime_0.7          colorspace_1.4-1 
[41] httpuv_1.5.1      labeling_0.3      lazyeval_0.2.2    munsell_0.5.0    
[45] crayon_1.3.4     
pandoc_available()
pandoc_version()
TRUE
[1] '2.9.2'
g <- data.frame(a = c(1,2,3), b = c(4,5,6)) %>%
ggplot +
geom_line(aes(x = a, y = b))

g

ggplot works ggplot works

p <- data.frame(a = c(1,2,3), b = c(4,5,6)) %>%
plot_ly %>%
add_lines(x = ~a, y = ~b)

embed_notebook(p)

заговор не работает plotly doesnt work

...