Unable to save plot to pdf

Hi all

anyone else unable to save to pdf with the latest version and settings of plotly?

import plotly.graph_objects as go
import numpy as np
np.random.seed(1)

N = 100
x = np.random.rand(N)
y = np.random.rand(N)
colors = np.random.rand(N)
sz = np.random.rand(N) * 30

fig = go.Figure()
fig.add_trace(go.Scatter(
    x=x,
    y=y,
    mode="markers",
    marker=go.scatter.Marker(
        size=sz,
        color=colors,
        opacity=0.6,
        colorscale="Viridis"
    )
))

fig.show()
fig.write_image("images/fig1.pdf")

This does create the plot, but keeps running without saving the plot, any clues why?

Maybe related to this?

2 Likes

Fantastic, thanks Aimped

1 Like

hi @monitorcasalab

I copied your code and successfully saved the graph to pdf. I used dash==2.8.1 and I did pip install -U kaleido.

Can you try that and let me know if it works?

1 Like

When I was looking at the Kaleido github, there were comments that the issue is mainly on windows machines, but otherwise works. Out of curiosity, are you on windows?

yes, I’m on windows machine.

1 Like

Thanks Adam, it works now
was curious as I was coding on a new machine with the latest plotly library

1 Like