plotly.py icon indicating copy to clipboard operation
plotly.py copied to clipboard

Surface with opacity=1.0 and Scatter3d breaks export in Kaleido

Open jeffreybliang opened this issue 8 months ago • 2 comments

When exporting a Plotly figure to PDF/png/jpg/svg (these are the ones I've tried) using Kaleido, combining a Surface trace with opacity=1.0 and a Scatter3d trace in the same scene causes the mesh surface to disappear or render incorrectly. However, rendering in HTML is perfectly fine (as it looks in my Python notebook).

Lowering the Surface trace opacity slightly (e.g., to 0.99) or removing the Scatter3d trace entirely resolves the issue, however I prefer the look when it has full opacity and the points are included.

I have uploaded the json files for the plot when it is full opacity and when it is 0.99 opacity. When saving with full opacity the image looks like Image full_opacity.json

To test, just run the code:

fig = pio.read_json("full_opacity.json")
fig.write_image("full_opacity.png")
fig.show()

I have also attached a json with 0.99 opacity, which looks like: Image not_full_opacity.json

This is what it saves as without the points:

Image no_scatter.json

Environment: plotly==5.21.0 (I also tried on latest version too) kaleido==0.2.1 Python 3.12 macOS

jeffreybliang avatar May 10 '25 12:05 jeffreybliang

cc @emilykl @ayjayt

gvwilson avatar May 20 '25 14:05 gvwilson

Hi @jeffreybliang, there is a new version of kaleido v1.0.0, which works somewhat different than the version you're using.

ayjayt avatar May 21 '25 23:05 ayjayt