我发现这是一种非常酷和有用的方法(我对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,有办法吗
只需使用
write_image()
函数。请参阅文档:https://plot.ly/python/static-image-export/那就是:
write_image("image.png")
您也可以将其保存为其他格式的加载,包括bmp、jpeg、pdf
相关问题 更多 >
编程相关推荐