Reputation: 145
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?
Upvotes: 4
Views: 3313
Reputation: 11605
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
Upvotes: 2