Search code examples
javascriptrblogdown

Embed Flourish Visualization in Blogdown


Flourish is a company that enables you to make dynamic visualizations.

I have a blog using R Studio, blogdown, github and Netlify.

After creating a chart, Flourish provides a URL and some embed code.

https://public.flourish.studio/visualisation/56290/

<div class="flourish-embed" data-src="visualisation/56290"></div><script src="https://public.flourish.studio/resources/embed.js"></script>

I see how I can roughly place the treemap on my blog using an iframe. But that is not ideal.

Is it possible to embed the code Flourish provides in blogdown? If so, how?

I was hoping it could look as clean as a leaflet-R map.


Solution

  • Isn't it just a matter of cut-and-paste? That is, paste the code in your blog post:

    <div class="flourish-embed" data-src="visualisation/56290"></div><script src="https://public.flourish.studio/resources/embed.js"></script>
    

    FWIW, Flourish does not recommend using iframes:

    enter image description here