Export graph objects as image

Hi,

I am trying to export a graph objects figure as an image (PNG, JPG or whatever). I am trying with a simple example as below

import plotly.graph_objects as go

fig = go.Figure(
    data=[go.Bar(x=[1, 2, 3], y=[1, 3, 2])],
    layout=go.Layout(
        title=go.layout.Title(text="A Figure Specified By A Graph Object")
    )
)

fig.show()

But when I try to save fig as an image it just seems to run forever with no errors

fig.write_image("fig1.png",engine='orca')

I have tried with orca (1.8) and kaleido(0.2.1) but none seem to work.

Any feedback would be appreciated.

Thanks,
J

Edit: I have also tried the code from plotly site (static-image-export.py)

Static image export

Same result (seems infinite loop).

Hey @jung_milan, welcome to the forums.

I guess youโ€™re using windows OS. This is a known issue, try using the search for this. The problem is related to kaleido.

See also

Hi @AIMPED, thanks for the reply. Does this mean it works just fine in Mac or Unix?

I think for now I have to do it manually (save as PNG/JPG in dash). I may try the savefig feature from the regular fig,axs.

Thanks! J