小编sar*_*123的帖子

使用 Kaleido 导出 Plotly 图表不起作用?

我在 Jupyter Notebook 中本地创建了绘图图表,我试图将其另存为 png 文件在本地计算机上。图表示例:

for table in EG_SD_pivots:
    df = EG_SD_pivots[table].reset_index()
    fig = make_subplots(specs=[[{"secondary_y": True}]])

    fig.add_trace(
            go.Scatter(x=df.iloc[:, 0], y=df['SD_Credibility'], name="Credibility", marker=dict(color=yellow)), secondary_y=True)

    fig.add_trace(
            go.Bar(x=df.iloc[:, 0], y=df['EG_LR_Rel'], name="EG Relativity", marker=dict(color=teal)), secondary_y=False)

    fig.add_trace(
            go.Bar(x=df.iloc[: ,0], y=df['SD_LR_Rel'], name="SD Relativity", marker=dict(color=indigo)), secondary_y=False)

    # Add figure title
    fig.update_layout(title_text=df.iloc[:0].columns[0], margin=dict(b=200))

    # Set x-axis title
    fig.update_xaxes(title_text=df.iloc[:0].columns[0])

    fig.update_yaxes(title_text="<b>Relativity</b>", secondary_y=False)
    fig.update_yaxes(title_text="<b>Credibility</b>", secondary_y=True)
    fig.show()
Run Code Online (Sandbox Code Playgroud)

我尝试了许多不同的解决方案,但它们都返回了各种错误...解决方案: fig.to_image(format="png")-->返回

ValueError: 
The orca executable is required to export figures as static images,
but it could not be found on the system …
Run Code Online (Sandbox Code Playgroud)

python charts plotly plotly-python

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

charts ×1

plotly ×1

plotly-python ×1

python ×1