Table write_image (png) - how to delete white space around table in png


We’ve just started using plotly and have I guess a simple question:
we use this command to save Table as png:

fig.write_image("fig1.png", width=1400, height=600)

Once we open a png file we see white space around table.
Is it possible to revemove white space, probably to set some parametres/attributes while write_image command? Or even on the first step while we create table

We work in jupyterlab, probably it is also important to point out.

Thanks in advance!

this is our table (hidden stats)

Hey community,

I figure out what can be done here:

layout = go.Layout( autosize=True, **margin={'l': 0, 'r': 0, 't': 20, 'b': 0}**)

fig = go.Figure(layout=layout, data=[go.Table(
            values=[a[k].tolist() for k in a.columns[0:]],
            align = "center"))

margin helps me to reduce this white space around my table.

Hope this helps anyone in future!

1 Like