[英]How to run plotly package with R in Jupyter notebook from Google Colab
i'm R users我是 R 用户
I have tried to run the R code in Jupyter notebook from Google Colab.我试图在来自 Google Colab 的 Jupyter notebook 中运行 R 代码。 But the plotly package doesn't work despite of the well processing in Rmarkdown in Rstudio.
但是尽管在 Rstudio 的 Rmarkdown 中处理得很好,但 plotly 包不起作用。
Here is my problem.这是我的问题。 If I run like as
如果我像这样跑
X =c(1:3) Y=c(2:6) plot(X,Y) 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但是,当我使用 ggplot2 或 plotly 包运行代码时
gg<- ggplot(aes(x=X,y=Y))+geom_point() gg<- ggplot(aes(x=X,y=Y))+geom_point()
ggplotly(gg) ggplotly(gg)
It doesn't work.它不起作用。 Please to tell me what is wrong.
请告诉我出了什么问题。
There's an unresolved issue with plotly
in a Jupyter notebook with the IRKernel
.有有未解决的问题
plotly
在Jupyter笔记本采用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.这对你来说可能还不够好,但如果它有效,那就是一个开始。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.