是否可以将plotly表格保存为png?

2024-05-21 04:34:06 发布

您现在位置:Python中文网/ 问答频道 /正文

我发现这是一种非常酷和有用的方法(我对Python非常陌生)来处理表

import plotly.graph_objects as go

fig = go.Figure(data=[go.Table(
    header=dict(values=['Column1', 'Column2'],
                line_color='rgb(255,255,255)',
                fill_color='rgb(230,100,100)',
                align='left'),
    cells=dict(values=[[100, 90, 80, 90], # 1st column
                       [95, 85, 75, 95]], # 2nd column
               line_color='rgb(255,255,255)',
               fill_color= 'rgb(255,255,255)',
               align='left'))
])

fig.update_layout(width=500, height=300)
fig.show()

不幸的是,我找不到一种方法将其保存为png,有办法吗


Tags: 方法importgolinefigcolumnrgbleft