python中pyg2plot如何使用?

1、渲染出完整的 HTML

这种情况可以用于:

服务端 html 直出的场景

生成可交互可视化分享

Excel 等工具嵌入的场景

frompyg2plotimportPlot

line=Plot("Line")

line.set_options({
"data":[
{"year":"1991","value":3},
{"year":"1992","value":4},
{"year":"1993","value":3.5},
{"year":"1994","value":5},
{"year":"1995","value":4.9},
{"year":"1996","value":6},
{"year":"1997","value":7},
{"year":"1998","value":9},
{"year":"1999","value":13},
],
"xField":"year",
"yField":"value",
})

#1.renderhtmlfilenamedplot.html
line.render("plot.html")

#2.renderhtmlstring
line.render_html()

2、在 Jupyter notebook 中预览

frompyg2plotimportPlot

line=Plot("Line")

line.set_options({
"height":400,#setadefaultheightinjupyterpreview
"data":[
{"year":"1991","value":3},
{"year":"1992","value":4},
{"year":"1993","value":3.5},
{"year":"1994","value":5},
{"year":"1995","value":4.9},
{"year":"1996","value":6},
{"year":"1997","value":7},
{"year":"1998","value":9},
{"year":"1999","value":13},
],
"xField":"year",
"yField":"value",
})

line.render_notebook()

在我们做数据分析教程的过程中,可以将我们的数据使用 PyG2Plot 进行可视化并预览出来,十分方便!

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。