新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)Python教程:python中pyg2plot如何使用?
1、渲染出完整的 HTML

這種情況可以用于:
服務端 html 直出的場景
生成可交互可視化分享
Excel 等工具嵌入的場景
from pyg2plot import Plot
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. render html file named plot.html
line.render("plot.html")
# 2. render html string
line.render_html()2、在 Jupyter notebook 中預覽
from pyg2plot import Plot
line = Plot("Line")
line.set_options({
"height": 400, # set a default height in jupyter preview
"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()在我們做數(shù)據(jù)分析教程的過程中,可以將我們的數(shù)據(jù)使用 PyG2Plot 進行可視化并預覽出來,十分方便!
以上就是python中pyg2plot的使用,希望能對大家有所幫助。更多Python學習指路:創(chuàng)新互聯(lián)Python教程
標題名稱:創(chuàng)新互聯(lián)Python教程:python中pyg2plot如何使用?
網(wǎng)頁網(wǎng)址:http://fisionsoft.com.cn/article/djgisog.html


咨詢
建站咨詢
