Plotly offlline figures in jupyter notebook -> plotly cloud -> embed to wordpress

I have a figure I’m looking to embed to wordpress, but to my understanding I would have to upload my figure to the plotly cloud server.

  1. my dataset is too large about 13mb and I would need to purchase a pricing plan, but I am a student and it doesn’t seem like I’m able to sign up for one without a non-free email.

  2. Is there a way to get the embeded link for my figure without having to redo the entirety of it using traces and the plotly cloud interface?

Use the offline plotting feature and export the figure as HTML. Embed the HTML in your Wordpress page using an iframe.

from plotly.offline import plot
import plotly.graph_objs as go

# create your plot....

fig = go.Figure(data, layout)

plot(fig, filename="plot.html")

Thanks!I had to use

py.plot(fig, filename = ‘plot’)

using import chart_studio
chart_studio.tools.set_credentials_file()

but now I’m trying to embed my iframe into my wordpress but nothing is previewing. just getting the text and no image

have you had this problem?

I"m able to use the html but the image is not responsive

First try embedding an iframe of a publicly available site like google to test if the iframe tag works. I think you need to change the editing environment of the Wordpress page to be the source rather than the normal WSIWYG editor otherwise it just interprets the iframe tag as normal text.

If that doesn’t work you might need to install a plugin to help embed the iframe and then use the plugin’s shortcode.

After that you need to make sure you put the html file in a location which is readable by wordpress/php. A good location is wp-content. So put the html file somewhere in wp-content. For example suppose your file is called plot.html your folder structure might be:

  • wordpress/
    • wp-content/
      • plot.html

You can then check that this works by navigating directly in your browser to https://mydatascience.com/wp-content/plot.html

Then just change the iframe tag to point to /wp-content/plot.html.

Thank you! But unfortunately the blog site is using wordpress on the browser so I’m not able to use any plugins

three reasons why you should buy plotly pro: support open source, get great support, host your plots and dashboards online