如何将matplotlib绘图导出为iFrame

如何将matplotlib绘图导出为iFrame,matplotlib,iframe,google-sites,Matplotlib,Iframe,Google Sites,我想用Matplotlib生成一些绘图,然后生成iFrame嵌入到Google站点中 我想,如果图像的变化,变化反映在我的谷歌网站 我试过: from matplotlib.pyplot import figure import mpld3 fig = figure() ax = fig.gca() ax.plot([1,5,3,4]) hola= mpld3.save_html(fig,'myfig.html',template_type='simple') 如果我在浏览器上打开myf

我想用Matplotlib生成一些绘图,然后生成iFrame嵌入到Google站点中

我想,如果图像的变化,变化反映在我的谷歌网站

我试过:

from matplotlib.pyplot import figure
import mpld3

fig = figure()
ax = fig.gca()
ax.plot([1,5,3,4])


hola= mpld3.save_html(fig,'myfig.html',template_type='simple')
如果我在浏览器上打开myfig.html并转到查看页面源代码,我可以看到

<script type="text/javascript" src="https://mpld3.github.io/js/d3.v3.min.js"></script>
<script type="text/javascript" src="https://mpld3.github.io/js/mpld3.v0.3.js"></script>

<style>

</style>

<div id="fig_el190911208844747686822225975"></div>
<script type="text/javascript">

  !function(mpld3){

       mpld3.draw_figure("fig_el190911208844747686822225975", {"width": 432.0, "height": 288.0, "axes": [{"bbox": [0.125, 0.125, 0.775, 0.755], "xlim": [-0.15000000000000002, 3.15], "ylim": [0.8, 5.2], "xdomain": [-0.15000000000000002, 3.15], "ydomain": [0.8, 5.2], "xscale": "linear", "yscale": "linear", "axes": [{"position": "bottom", "nticks": 9, "tickvalues": null, "tickformat": null, "scale": "linear", "fontsize": 10.0, "grid": {"gridOn": false}, "visible": true}, {"position": "left", "nticks": 11, "tickvalues": null, "tickformat": null, "scale": "linear", "fontsize": 10.0, "grid": {"gridOn": false}, "visible": true}], "axesbg": "#FFFFFF", "axesbgalpha": null, "zoomable": true, "id": "el19091120884476504", "lines": [{"data": "data01", "xindex": 0, "yindex": 1, "coordinates": "data", "id": "el19091120885398384", "color": "#1F77B4", "linewidth": 1.5, "dasharray": "none", "alpha": 1, "zorder": 2, "drawstyle": "default"}], "paths": [], "markers": [], "texts": [], "collections": [], "images": [], "sharex": [], "sharey": []}], "data": {"data01": [[0.0, 1.0], [1.0, 5.0], [2.0, 3.0], [3.0, 4.0]]}, "id": "el19091120884474768", "plugins": [{"type": "reset"}, {"type": "zoom", "button": true, "enabled": false}, {"type": "boxzoom", "button": true, "enabled": false}]});
  }(mpld3);

!功能(mpld3){
mpld3.绘制图形(“图el190911208844747686822225975”,{“宽度”:432.0,“高度”:288.0,“轴”:[{“bbox”:[0.125,0.125,0.775,0.755],“xlim”:[-0.1500000000000002,3.15],“ylim”:[0.8,5.2],“xdomain”:[-0.1500000000000002,3.15],“xdomain”:[0.8,5.2],“xscale”:“线性”、“线性刻度”;“线性位置”;“底部位置”;“{,“tickvalues”:null,“tickformat”:null,“scale”:“linear”,“fontsize”:10.0,“grid”:{“gridOn”:false},“visible”:true},{“position”:“left”,“nticks”:11,“tickvalues”:null,“tickformat”:null,“scale”:“linear”,“fontsize”:10.0,“grid”:{“gridOn”:false},“visible”:true},“axesbg”:“FFFFFF”,“axesbgalpha”:null,“zoomable”:true,“id”:el19091120884476504,“线条”:[{“数据”:“数据01”,“xindex”:0,“yindex”:1,“坐标”:“数据”,“id”:“el19091120885398384”,“颜色”:“#1F77B4”,“线宽”:1.5,“dasharray”:“无”,“alpha”:1,“zorder”:2,“绘图样式”:“默认”}],“路径”:[],“标记”:[],“文本”:[],“集合”:[],“图像”:[],“sharex”:[],“sharey”:],“数据[]“:{“data01”:[[0.0,1.0],[1.0,5.0],[2.0,3.0],[3.0,4.0]},id:“el19091120884474768”,“插件”:[{“类型”:“重置”},{“类型”:“缩放”,“按钮”:true,“启用”:false:“类型”:“框缩放”,“按钮”:true,“启用”:false});
}(mpld3);
因此,如果我在我的谷歌网站上复制这段代码,我就能看到图片

但是如果我在
myfig.html
中保存一张新图片,我需要它,这样我就可以在站点中看到这些更改