HTML widgets on a Jupyter R laptop

Im can't display HTML widgets in Jupyter Notebooks when using R (works when using python). For example, none of the graphical charts work on a Jupyter R. laptop. Is there any solution for this?

library(plotly) set.seed(100) d <- diamonds[sample(nrow(diamonds), 1000), ] plot_ly(d, x = carat, y = price, text = paste("Clarity: ", clarity), mode = "markers", color = carat, size = carat) 

Code is running, but the graph is not displayed

+5
source share
1 answer

You need to call embed_notebook (see examples here ).

So change your code to:

 library(plotly) set.seed(100) d <- diamonds[sample(nrow(diamonds), 1000), ] myPlot <- plot_ly(d, x = carat, y = price, text = paste("Clarity: ", clarity), mode = "markers", color = carat, size = carat) embed_notebook(myPlot) 
+2
source

Source: https://habr.com/ru/post/1238280/


All Articles