简体   繁体   中英

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. However, nothing showed up below the code chunk after I upload the Jupyter Notebook to one of my repositories on 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. GitHub doesn't execute code from users or permit user-provided JavaScript when rendering files, because doing so is a security risk. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM