如何在wordpress网站上嵌入绘图图?

我试图将在R中创建的绘图图嵌入到wordpress网站上。似乎比应做的要困难得多。也许我缺少明显的东西。这是我尝试过的:

solution 1: saved the graph as an html using htmlwidgets::saveWidget(as_widget(Basic_Spending_Graph), file = "Basic_Spending_Graph.html"). Then use that html to either embed the whole file or html source code into the website. There are numerous problems with this approach. Firstly if I embed file it embeds a link to the file where you can open the page rather than fully embedding the graph within the page. Secondly the file is 3 Mbs, which over time could put a strain on website speed which is using shared hosting.

解决方案2:将绘图从R导出到Chart Studio,这使您可以在其服务器上托管图形并生成html嵌入代码段。这似乎是一个很好的解决方案,但是我一直在努力寻找一种从R导出到Chart Studio的简单方法,因为我已经花了很多时间在R中创建图表。显然,有一种方法可以将图表导出到Chart工作室,但似乎没人解释如何?

考虑到plotly是在网络上设计的,我可能会遗漏一些非常明显的东西!任何建议将不胜感激。在网页上获取图表的最佳方法是什么?

谢谢!