Is it possible to save plotly table as png?

KingDingeling :

I found this very cool and usefull way ( I am very new to Python) to do tables.

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()

Unfortunately I could not find a way to save this as a png, is there a way?

Simon :

Simply use the write_image() function. See the documentation: https://plot.ly/python/static-image-export/

So that would be: write_image("image.png")

You can save it as loads of other formats too including bmp, jpeg, pdf

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=350801&siteId=1