Surface with opacity=1.0 and Scatter3d breaks export in Kaleido
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 498
- Forks
- 62
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 2
Description
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
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:
not_full_opacity.json
This is what it saves as without the points:
Environment:
plotly==5.21.0 (I also tried on latest version too)
kaleido==0.2.1
Python 3.12
macOS
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with full_opacity.json and not_full_opacity.json, then run the reported fig = pio.read_json(...) and fig.write_image(...) reproduction with Kaleido. Compare exports for Surface opacity=1.0 with and without Scatter3d, and confirm that PDF/png/jpg/svg preserve both the surface and points while the HTML rendering remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- plotly, python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100