Colaboratoryを使う場合には次のセルのコメントを外して(Ctrl+/)実行します
# !pip install plotly==4.10.0
# !wget https://github.com/plotly/orca/releases/download/v1.2.1/orca-1.2.1-x86_64.AppImage -O /usr/local/bin/orca
# !chmod +x /usr/local/bin/orca
# !apt-get install xvfb libgtk2.0-0 libgconf-2-4
import plotly.graph_objects as go
fig = go.Figure([go.Scatter(x=[1, 2, 3], y=[5, 3, 2])])
fig.write_image("fig1.png")
from IPython.display import Image
img_bytes = fig.to_image(format="png")
Image(img_bytes)