[英]Plotly R not working with Jupyter notebook
你有一个阴谋户口吗? 您可能需要使用类似以下内容的内容在笔记本中登录它:
import plotly
plotly.tools.set_config_file(plotly_domain='domain')
from plotly import __version__
from plotly.offline import download_plotlyjs, init_notebook_mode, iplot
import plotly.plotly as py
print __version__ # requires version >= 1.9.0
import plotly.graph_objs as go
init_notebook_mode() # run at the start of every ipython notebook to use plotly.offline
# this injects the plotly.js source files into the notebook
py.sign_in(username='xxxx', api_key='xxxx')
我在MacOS中也有同样的问题。 在控制台中,可以看到它正在寻找.html.embed,但是创建的文件是.html。 我尝试过,1)重新安装Pandocs 2)由于软件包pbdZMQ无法正确安装,不得不重新安装Cairo。
这是我所做的解决方法,
p <- plot_ly(ds, x = x, y = y, mode = "markers", group = group, size = size)
htmlwidgets::saveWidget(as.widget(p), "index.html")
rawHTML <- paste(readLines("index.html"), collapse="\n")
display_html(rawHTML)
这不是最好的解决方案,但暂时对我有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.