python pyecharts 绘图

柱状图

from pyecharts.charts import Bar
from pyecharts import options as opts


columns = ["10.224.105.230","10.224.105.231","10.224.105.234","10.224.105.235","10.224.105.236","10.224.105.237","10.224.105.239","10.224.105.240","10.224.105.241","10.224.105.242","10.224.105.243","10.224.105.244","10.224.105.245","10.224.105.246","10.224.105.248","10.224.105.249","10.224.105.250","10.224.105.251","10.224.105.252","10.224.105.253"]

columns=columns[::-1]
data1 = [104.86, 28.8, 56.89, 73.51, 8.88, 46.98, 42.23, 54.11, 59.63, 33.85, 24.09, 59.97,39.93, 53.58, 16.56, 64.15, 8.41, 21.70, 46.04, 56.73]
data2 = [91.19, 62.28, 85.11, 91.47, 30.20, 82.38, 90.97, 74.78, 62.13, 76.71, 81.08, 65.45,86.66, 72.37, 86.13, 93.22, 67.17, 68.85, 50.98, 95.20]
bar = (
    Bar()
    .add_xaxis(columns)
    .add_yaxis("CPU", data1)
    .add_yaxis("Storage", data2)
    .set_global_opts(title_opts=opts.TitleOpts(title=""),
                         xaxis_opts=opts.AxisOpts(name_rotate=50, axislabel_opts={"rotate": 35}),yaxis_opts=opts.AxisOpts(
            splitline_opts=opts.SplitLineOpts(is_show=True),
            split_number=10))
    .set_series_opts(label_opts=opts.LabelOpts(is_show=False)
            ))
bar.render()

官网

https://zhuanlan.zhihu.com/p/111330795

https://blog.csdn.net/zc666ying/article/details/105095620

https://blog.csdn.net/qq_37176126/article/details/89281596

https://zhuanlan.zhihu.com/p/63236019

https://zhuanlan.zhihu.com/p/139551727

你可能感兴趣的:(Python)