図形描画ツールecharts——散点図、漏斗図、計器盤図、水球図、餅状図
1596 ワード
散点図例:北京の3月の毎日の昼間の最高気温統計 例:4本の映画興行収入 を統計する例:CPU使用率 を記録するケース: ケース:
from pyecharts import EffectScatter, Scatter, Scatter3D
x_march = list(range(1, 32))
y_temp_march = [11, 17, 16, 11, 12, 11, 12, 6, 6, 7, 8, 9, 12, 15, 14, 17, 18, 21, 16, 17, 20, 14, 15, 15, 15, 19, 21, 22, 22, 22, 23]
# scatter= EffectScatter(" 3 ( ) ")
scatter= Scatter(" 3 ", subtitle="xxxx")
# symbol_size ;
scatter.add("3 ", x_march, y_temp_march, symbol_size=10, line_color='red')
scatter.add("4 ", x_march, y_temp_march, symbol_size=30)
scatter.render()
漏斗図from pyecharts import Funnel
x_movies_name = [" ", " ", " ", " 2"]
y_16 = [20, 40, 60, 80]
funnel = Funnel("xxxx")
funnel.add(" ", x_movies_name, y_16)
funnel.render()
ダッシュボード図from pyecharts import Gauge
import psutil
cpu_percent = psutil.cpu_percent()
print(cpu_percent)
gauge = Gauge("CPU ")
gauge.add("cpu", "CPU ", cpu_percent)
gauge.render()
水球図from pyecharts import Liquid
import psutil
liquid = Liquid("xxxx")
liquid.add("Liquid", [0.6, 0.5, 0.4, 0.3], shape='pin')
liquid.render()
円グラフfrom pyecharts import Pie
attr = [" ", ' ', ' ']
data = [100, 180, 2]
pie = Pie("example")
# label
pie.add("", attr, data, is_label_show=True)
pie.render()