4

I am trying to save plotly plots generated within a for a loop into one pdf fil, but here is says we need to pay for it

Is there any updates on this feature? Do we really need to pay to save as pdf?

owise
  • 1,055
  • 16
  • 28
  • 2
    As a work around, you can write all of your charts to a ```.png``` [plotly docs](https://plot.ly/python/static-image-export/), then use [this SO answer](https://stackoverflow.com/questions/27327513/create-pdf-from-a-list-of-images) to read in all the ```.png``` files and combine them to write a ```.pdf```. – lwileczek Jun 20 '18 at 14:08

2 Answers2

7

For anyone else still looking for a quick answer 2 years later:

It is possible to export static plotly figures as pdf. Produce a plotly figure, say fig. This has the .write_image method to export to several formats. Simply do:

fig.write_image("your_image.pdf")

NOTE: you may need to install kaleido (plotly uses it to convert to static images).

pip install -U kaleido

Then:

fig.write_image("your_image.pdf", engine="kaleido")

Credits and references:

luco00
  • 501
  • 5
  • 9
0

I believe you do need to pay in order to save as a pdf:

py.plotly.image.save_as(fig, filename='file.pdf')

PlotlyRequestError: Hi there! Accounts on the Community Plan can only download PNG and JPEG (raster) images.

To download publication-quality vector images (SVG, PDF, and EPS), please upgrade your account.

UPGRADE HERE: https://plot.ly/products/cloud

you can save them as a jpeg or png:

py.plotly.image.save_as(fig, filename='file.png')
It_is_Chris
  • 13,504
  • 2
  • 23
  • 41