我用plotly在Jupyter笔记本上创建了我的数据的交互式时间线。笔记本上的绘图看起来很完美,工作正常,但是,当我将笔记本作为html文件下载时,我看不到绘图
出于隐私原因,我不会共享原始数据帧,因为它并不真正相关
下面是我用来制作图表的代码:
#Interactive Line Plot
import plotly
import plotly.graph_objects as go
#Create figure
fig = go.Figure()
fig.add_trace(
go.Scatter(x=list(df.Date), y=list(df.Transactions), marker=dict(size=20, color="blue")))
#Set title
fig.update_layout(title_text="Total Number of Transactions per Date", title_font_size=20)
#Add range slider
fig.update_layout(
xaxis=dict(
rangeselector=dict(
buttons=list([
dict(count=1,
label="1m",
step="month",
stepmode="backward"),
dict(count=6,
label="6m",
step="month",
stepmode="backward"),
dict(count=1,
label="YTD",
step="year",
stepmode="todate"),
dict(count=1,
label="1y",
step="year",
stepmode="backward"),
dict(step="all")
])
),
rangeslider=dict(
visible=True
),
type="date"
)
)
fig.show()
在Jupyter笔记本中,我得到一个如下图:
但是,当我将笔记本下载为html文件时,绘图是空白的,不会出现。我该怎么办
谢谢
目前没有回答
相关问题 更多 >
编程相关推荐