Open Viech opened 2 years ago
I also have plotly v5.5.0, but it saves a transparent pdf file of 300dpi, width=5cm (1.9685inches), heigth=3cm (1.1811inches):
pio.write_image(fig, "transparent.pdf", width=300*1.9685, height=300*1.1811, scale=1)
transparent.pdf Before setting transparent bg_color, the corresponding png image looks like this:
This indeed removes the grey canvas, but I still see a white background with every viewer I tested (firefox, geeqie, gimp, mupdf, evince, \includegraphics
in latex occludes a watermark).
I also had the same issue as you, I wanted to export as a PDF without background. I could only manage to do it by using the engine "orca".
fig.write_image(file, engine= "orca")
But this require you to install plenty additional packages and to use a conda environment, which is less convenient than using "Kaleido" (default).
Would be great if someone with background knowledge could chime in to explain how much work adding transparency support to kaleido
would be.
The recommended way to produce figures with transparent backround appears to be the following:
When I export such a figure using the
kaleido
backend (version0.2.1
), I obtain a transparent background for SVG images, but not for the PDF format, even though PDF supports transparent backgrounds:This is using
plotly 5.5.0
.