Open drscotthawley opened 1 year ago
Update: I do have Kaleido installed but hadn't invoked the export settings. If I add the code
import plotly.io as pio
pio.kaleido.scope.default_format = "pdf"
and run it before the fig.write_image
call....nothing different happens. :-( The PDF is still "wrong".
Thanks for your interest in Kaleido. We are currently working on an overhaul that might address your issue - we hope to have news in a few weeks and will post an update then. Thanks - @gvwilson
Following the Plotly documentation for static image export: https://plotly.com/python/static-image-export/
When I try to save the figure using the suggested call to
fig.write_image
, it ignores my rotation and zoom adjustments and saves with some default orientation and a much larger marker size. The documentation says nothing about this, or how to fix it.As an example to reproduce this problem, let's take the 3D Scatter plots documentation example (I'll add a light height to it too):
If i execute this in a Jupyter cell, I can rotate the graph, press the "Download as PNG" button, and get exactly what I see. For example, this image:
But if I then run the recommended export code to save a PDF,
and then view the PDF file, I see something different: the orientation resets and the marker size is huge (screenshot):
Given that the docs don't address this, I'm wondering if it's a bug. Otherwise, there's quite an omission in the documentation.
Either way, my question is how can we export vector images that preserve orientation & marker size? Thanks.
(Workaround: Currently I'm trying to "guess" my camera controls to set them programmatically before the save, but it's a slow iterative process. If there's a way to query
fig.layout.scene.camera.whatever
to then go back to fix the camera for save, please let me know. And add it to the docs! Marker size is the same thing -- I know what markers I see, but have to keep re-saving and checking the size because it's a different size in the PDF. :-( )Version info: