无法在JupyterLab中内嵌显示绘图图

时间:2019-11-19 09:18:51

标签: python plotly data-visualization

当我运行以下代码时:

init_notebook_mode(connected=True)
from plotly.offline import plot
import plotly.graph_objects as go
colors = ['gold', 'mediumturquoise', 'darkorange', 'lightgreen']

fig = go.Figure(data=[go.Pie(labels=['Oxygen','Hydrogen','Carbon_Dioxide','Nitrogen'],
                             values=[4500,2500,1053,500])])
fig.update_traces(hoverinfo='label+percent', textinfo='value', textfont_size=20,
                  marker=dict(colors=colors, line=dict(color='#000000', width=2)))
plot(fig)

该图显示了,但是它在新选项卡中显示。我希望该图在同一笔记本(内联)中打开。我想念什么吗?

0 个答案:

没有答案