R - Embed plotly plot in Wordpress post


So Im lost how to embed a plotly plot made in R in html output into a Wordpress post…how do I do this? Do I need to extract the html code and paste it into a post for example?

The only way it works is to upload the html file into the media library and use an iframe…but I dont want that…I want to really have it embedded into the post

Hi @keepbtcsimple

Plotly has created a worpdress plugin for you to embed your graphs.

Check out this plugin: Plotly – WordPress plugin | WordPress.org

Hi @sparkmaddy

Yeah Ive found that one…but the plotly plot is in html output…so it should be doable to embed the plot as a post too correct i.o using the plugin?

I think you have got to create the same chart in Chart Studio in Plotly and create a link where it is referencing to the hosted plot in Chart Studio to embed using the WP Plugin. Otherwise, using HTML Code would be the other option if you are a not a fan of iframe.

Yeah I tried Chart Studio which works but I really want to to hve the plotly plot embedded

About tusing the html code: how do I extract that from the plotly plot in R?

Btw that plugin does look really old…

Anyone knows how to extract the html code from a plotly plot?

Someone from plotly maybe?

I did find this for Phyton :plotly.io.to_html — 4.14.3 documentation with the function full_html

Really…like on one on the web knows how to tackle this issue…I hardly van believe

Have you tried these code here:

1 Like

thx! I havent found these posts yet

It worked kinda…I got the html code extracted and works in worpdress witha regular ggplot plt…however the plotly which is interactive doenst work…

1 Like