python数据分析图表展示_Python数据分析图形化结果怎么做web页面展示?

http://hplgit.github.io/web4sciapps/doc/pub/._part0013_web4sa_plain.html​hplgit.github.io

SVG plots

Inline figures in HTML, instead of using files, are most often realized by XML code with the figure data in SVG format. Plot strings in the SVG format are created very similarly to the PNG example:

figfile = StringIO()

plt.savefig(figfile, format='svg')

figdata_svg = figfile.buf

The figdata_svg string contains XML code text can almost be directly embedded in HTML5. However, the beginning of the text contains information before the svg tag that we want to remove:

<?xml version="1.0" encoding="utf-8" standalone="no"?>

/p>

"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

The removal is done with a little string manipulation:

figdata_svg = '

Now, figdata_svg can be directly inserted in HTML code without any surrounding tags. The file compute.py in the vib4_flask application directory contains all the details.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值