本文講述了乙個非常炫酷的視覺化工具以及本萌新試驗中遇到的問題和解決方法。
git clone
cd pyecharts
pip install -r requirements.txt
python setup.py install
import sys
from pyecharts.charts import bar
from pyecharts import options as opts
bar = (
bar()
.add_xaxis(["襯衫", "毛衣", "領帶", "褲子", "風衣", "高跟鞋", "襪子"])
.add_yaxis("商家a", [114, 55, 27, 101, 125, 27, 105])
.add_yaxis("商家b", [57, 134, 137, 129, 145, 60, 49])
.set_global_opts(title_opts=opts.titleopts(title="某商場銷售情況"))
)bar.render()
import sys
from snapshot_selenium import snapshot as driver
from pyecharts import options as opts
from pyecharts.charts import bar
from pyecharts.render import make_snapshot
def bar_chart() -> bar:
c = (
bar()
.add_xaxis(["襯衫", "毛衣", "領帶", "褲子", "風衣", "高跟鞋", "襪子"])
.add_yaxis("商家a", [114, 55, 27, 101, 125, 27, 105])
.add_yaxis("商家b", [57, 134, 137, 129, 145, 60, 49])
.reversal_axis()
.set_series_opts(label_opts=opts.labelopts(position="right"))
.set_global_opts(title_opts=opts.titleopts(title="bar-測試渲染"))
)return c
# 需要安裝 snapshot_selenium
make_snapshot(driver, bar_chart().render(), "bar.png")
執行後生成乙個render.html和bar.png,如下,很炫酷,引數可以隨意修改。
使用selenium時出現 " filenotfounderror: [winerror 2] 系統找不到指定的檔案。"
修改subprocess.py檔案中__init__中的shell=false,如圖找到_init_並修改false為true
pyecharts資料視覺化
pip install pyecharts u 安裝selenium pip install snapshot selenium 程式 from pyecharts import options as opts from pyecharts.charts import bar from pyecha...
資料視覺化之pyecharts
pyecharts乙個讓你變得強大的學習 首先來開始繪製你的第乙個圖表 from pyecharts.charts import bar bar bar bar.add xaxis 可樂 雪碧 礦泉水 咖啡 冰紅茶 涼白開 bar.add yaxis 商家a 5,20,36,10,75,90 ren...
matplot pandas 實現資料視覺化 基礎
import pandas as pd import numpy as np import matplotlib.pyplot as plt e file pd.excelfile 7月下旬入庫表.xlsx 開啟的sheet表名稱 data e file.parse 7月下旬入庫表 行首 列頭 數值...