Plotly after 6.0.0 changes how fig.write_image saves plots to PDF, JPG etc

I was happy with the way Plotly saved PDFs when I was using this environment:

  • Python 3.13.2 and 3.13.5

  • Plotly 6.0.0

  • kaleido 0.2.1

However, things have changes when using later versions of Plotly and the newer Kaleido library:

  • Python 3.13.2 and 3.13.5

  • Plotly 6.1.1 and 6.3.0

  • kaleido 1.0.0

The output generated using write_html looks great in both environments, whereas the PDF outputs are now scrambled and the plots and text labels all over the place.

Is there something I’m expected to change when using write_image in the latest Plotly versions? Thanks

(I’m using a Mac M4 mini with Sequoia 15.6.1)

Hi @spiky,

Could I trouble you for screenshots or the example PDFs? And even a code snippet might be helpful.

Thanks!

Hi @ajp ,

Thank you for coming back to me so quickly !!

While getting a code sample for you, I worked out that with newer Plotly versions, write_image defaults to using the height and width of a single page size.

Whereas in Plotly 6.0.0 write_image defaults to using the Plotly Figure height and width settings.

The only change I made to get it working again was to specify the height and/or width settings in my write_image calls e.g.:

fig.write_image(file=filename, format=file_format, height=height, width=width)

Thanks again.