1
votes

i'm R users

I have tried to run the R code in Jupyter notebook from Google Colab. But the plotly package doesn't work despite of the well processing in Rmarkdown in Rstudio.

Here is my problem. If I run like as

X =c(1:3) Y=c(2:6) plot(X,Y)

It works and shows the plot in below

But, When I run the code with ggplot2 or plotly package like

gg<- ggplot(aes(x=X,y=Y))+geom_point()

ggplotly(gg)

It doesn't work. Please to tell me what is wrong.

1
In what way does it not work?samblake
First, thanks for your consideration. The screen doesn't show me any thing though the code is well recognisedNguyen Bui

1 Answers

1
votes

There's an unresolved issue with plotly in a Jupyter notebook with the IRKernel. If you call it twice, you should see the plot.

library(plotly)
library(ggplot2)
df = data.frame(X =c(1:5),  Y=c(2:6) )
gg <- ggplot(df, aes(x=X,y=Y))+geom_point()
ggplotly(gg)
ggplotly(gg)

This may not be good enough for you but if it works, it's a start.enter image description here