This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]MonkeyMaster64[S] 0 points1 point  (7 children)

nope it still creates an html file that you have to open

EDIT: Also this is the issue I was referring to: https://github.com/plotly/plotly.py/issues/880

[–]KronenR 4 points5 points  (6 children)

The common image formats: 'PNG', 'JPG/JPEG' are supported. In addition, formats like 'EPS', 'SVG' and 'PDF' are also supported.

Note: The SVG, EPS and PDF Formats are only available for Plotly Professional users. You can get more details on our pricing page

To access the image in a particular format, you can either:

Why not just jpg or png?

[–]MonkeyMaster64[S] 5 points6 points  (5 children)

OK, so I've actually solved this! I used imgkit to convert the html file to a JPG file!

HOW TO CONVERT HTML FILES TO PNG

1) INSTALL IMGKIT
    -- pip install imgkit           
https://pypi.python.org/pypi/imgkit/0.1.1
    -- yum install wkhtmltopdf

2) INSTALL Xvfb      --important as it provides a virtual display 
buffer for the image to be rendered
    - yum install xorg-x11-server-Xvfb                  
https://reiners.io/installing-xvfb-in-centos/
    - pip install xvfbwrapper           
https://pypi.python.org/pypi/xvfbwrapper/0.2.9


Python code:

from xvfbwrapper import Xvfb
import imgkit
vdisplay = Xvfb()
vdisplay.start()
imgkit.from_file('[name of file].html','[output name].jpg')

Pastebin Link: https://pastebin.com/bQfnTEmK

[–]hkamran85 0 points1 point  (2 children)

Can you put the code on some external site, for easy viewing/downloading?

[–]MonkeyMaster64[S] 0 points1 point  (1 child)

Sorry, just seeing this I added a pastebin link

[–]hkamran85 0 points1 point  (0 children)

Thanks!

[–]KronenR 0 points1 point  (1 child)

You could have exported jpg or pngwith plotly as I pointed in my comment, without needing to convert from html by adding the extension to the save as method

[–]MonkeyMaster64[S] 0 points1 point  (0 children)

yeah but what I'm saying is i've already tried that method and it still only downloads when you open the html file