HMSCelestia HMSCelestia - 3 months ago 14x
HTML Question

Getting <script> and <div> tags from Plotly using Python

I was wondering if anyone knew a good way (preferably a built in method, but I'm open to writing my own of course) to get the and tags from the HTML output of the Plotly offline client.

I'm already familiar with bokeh and really enjoy using it for 2D visualization, but would really like to integrate Plotly as well for its 3D visualization capabilities.

Let me know if you need any extra details about the project.


It turns out that Plotly also has a built in way of outputting the div tags.

This is done by specifying the keyword arg output_type to div. For example:

stuff = plot(fig, include_plotlyjs=False, output_type='div')

Would return a string containing the div tags containing all the information needed to display the plot.