Embedding Graphs in HTML in Python/v3

How to embed plotly graphs with an iframe in HTML.


Note: this page is part of the documentation for version 3 of Plotly.py, which is not the most recent version.
See our Version 4 Migration Guide for information about how to upgrade.
The version 4 version of this page is here.

Plotly graphs can be embedded in any HTML page. This includes IPython notebooks, Wordpress sites, dashboards, blogs, and more.


For more on embedding Plotly graphs in HTML documents, see our tutorial.


From Python, you can generate the HTML code to embed Plotly graphs with the plotly.tools.get_embed function.



import plotly.tools as tls

tls.get_embed('https://plotly.com/~chris/1638')