简体   繁体   English

为什么Plotly生成的plot在我上传到Github后在Jupyter Notebook中不显示?

[英]Why doesn't the plot generated by Plotly in a Jupyter Notebook display after I upload it on Github?

I plotted a figure in Jupyter Notebook using Plotly , and it displayed all right locally.我使用Plotly在 Jupyter Notebook 中绘制了一个图形,它在本地显示正常。 However, nothing showed up below the code chunk after I upload the Jupyter Notebook to one of my repositories on Github .但是,在我将Jupyter Notebook上传到Github上的一个存储库后,代码块下方没有显示任何内容。 Is this just the way it is, or did I miss something?就是这样,还是我错过了什么? How can I make the figure seen?我怎样才能看到这个数字?

import plotly.graph_objs as go

data = list()
COLORS = ["aqua","sienna","coral","darkgreen","darksalmon",
          "darkslateblue","greenyellow","maroon","violet"]

for county, col in zip(COUNTIES,COLORS):
    trace = go.Scatter(x = DF.columns,
                       y = DF.loc[county,:],
                       name = county,
                       line = dict(color = col),
                       opacity = 0.8)
    data.append(trace)

fig = go.Figure(data = data,
                layout = dict(title = "County-level (Normalized) Daily New Cases"))
fig.show()

If the image in the Jupyter Notebook is generated by running code, then GitHub won't render it.如果 Jupyter Notebook 中的图像是通过运行代码生成的,那么 GitHub 将不会渲染它。 GitHub doesn't execute code from users or permit user-provided JavaScript when rendering files, because doing so is a security risk. GitHub 在渲染文件时不会执行来自用户的代码或允许用户提供的 JavaScript,因为这样做存在安全风险。 User-provided code could be used to steal credentials, attack other servers, or otherwise do a wide variety of nefarious things.用户提供的代码可用于窃取凭据、攻击其他服务器或以其他方式进行各种邪恶的事情。

So the answer is that this is just the way it is.所以答案是,事情就是这样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Jupyter笔记本中显示以前生成的图? - How do I display a previously generated plot in a Jupyter notebook? 当我在 GitHub 上上传笔记本时,HMTL 格式的 jupyter markdown 无法正确显示 - HMTL formatted jupyter markdown doesn't show properly when I upload notebook on GitHub 如何在 github(来自 jupyter notebook)中显示 plotly 图形? - How to display plotly graph in github (from jupyter notebook)? Plotly 旭日形 plot 未在 Jupyter 笔记本中显示 - Plotly sunburst plot not showing in Jupyter notebook 为什么Jupyter Notebook无法打开笔记本? - Why doesn't Jupyter notebook command open notebook? jupyter notebook - 为什么 notebook 不能很好地格式化这本词典? - jupyter notebook - Why notebook doesn't format this dictionary well? 图没有在 Jupyter 笔记本中用 Matplotlib 填充交互式 plot 中的 canvas - Figure doesn't fill canvas in interactive plot with Matplotlib in Jupyter notebook 无法在 jupyter notebook 中绘图 - Can't plot in jupyter notebook Nbconvert 不显示来自 jupyter notebook 的 styler dataframe - Nbconvert doesn't display styler dataframe from jupyter notebook 我正在尝试使用Jupyter Notebook在Python 3.7.0中显示图像。 为什么不起作用? - I'm trying to display an image in Python 3.7.0 using Jupyter Notebook. Why isn't it working?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM