Embed Plotly graph into a webpage with Bottle

前端 未结 1 446
予麋鹿
予麋鹿 2020-12-29 12:54

Hi i am using plotly to generate graphs using Python, Bottle. However, this returns me a url. Like:

https://plot.ly/~abhishek.mitra.963/1

相关标签:
1条回答
  • 2020-12-29 13:18

    Yes, embedding is possible. Here's an iframe snippet you can use (with any Plotly URL):

    <iframe width="800" height="600" frameborder="0" seamless="seamless" scrolling="no" src="https://plot.ly/~abhishek.mitra.963/1/.embed?width=800&height=600"></iframe>

    The plot gets embedded at a URL that is made especially for embedding the plot. So in this case your plot is https://plot.ly/~abhishek.mitra.963/1/. The URL to embed it is made by adding .embed to the URL: https://plot.ly/~abhishek.mitra.963/1.embed.

    You can change the width/height dimensions in that snippet. To get the iframe code and see different sizes, you can click the embed icon on a plot, or when you share it generate the code. Here's where the embed options are:

    enter image description here

    Here's how an embedded graph looks in the Washington Post. And here is a helpful tutorial someone made on developing with Plotly and Bottle.

    Let me know if that doesn't work, and I'm happy to help out.

    Disclosure: I'm on the Plotly team.

    0 讨论(0)
提交回复
热议问题