用pyecharts展示一些图表


from pyecharts import options as opts

from pyecharts.charts import Pie,Bar,Line

from pyecharts.faker import Faker

data = [['中药饮片',84],['中成药',23],['保健品',28],['其他',120]]

c = (

    Pie()

    .add("",data)

    )

                    

c.render_notebook()


from pyecharts import options as opts

from pyecharts.charts import Pie,Bar,Line

from pyecharts.faker import Faker

 

data = [['中药饮片',84],['中成药',23],['保健品',28],['其他',120]]

c = (

    Pie()

    .add("",data,

      radius=["25%","50%"]  #50%是画布的一半

        )

)

                    

c.render_notebook()

 


import pyecharts.options as opts

from pyecharts.charts import WordCloud

 

 

data = [

    ("保持热爱奔赴山海", "999"),

    ("铃不铃", "200"),

    ("你说翻阅那座天空会有谁在等着我", "233"),

    ("我曾难自拔于世界之大", "666"),

    ("maliao巨巨巨可爱", "2000"),

    ("我可爱不爱", "3000"),

  

]

 

 

wordcloud = (

    WordCloud()

    .add(series_name="热点分析", data_pair=data, word_size_range=[6, 66])

)

 

wordcloud.render_notebook()


import pyecharts.options as opts

from pyecharts.charts import Bar, Line

 

 

x_data = ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"]

 

bar = (

    Bar()

    .add_xaxis(xaxis_data=x_data)

    .add_yaxis(

        series_name="蒸发量",

        y_axis=[2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3],

        label_opts=opts.LabelOpts(is_show=False),

    )

    .add_yaxis(

        series_name="降水量",

        y_axis=[2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3],

        label_opts=opts.LabelOpts(is_show=False),

    )

    .extend_axis(

        yaxis=opts.AxisOpts(

            name="温度",

            type_="value",

            min_=0,

            max_=25,

            interval=5,

            axislabel_opts=opts.LabelOpts(formatter="{value} °C"),

        )

    )

    .set_global_opts(

        tooltip_opts=opts.TooltipOpts(

            is_show=True, trigger="axis", axis_pointer_type="cross"

        ),

        xaxis_opts=opts.AxisOpts(

            type_="category",

            axispointer_opts=opts.AxisPointerOpts(is_show=True, type_="shadow"),

        ),

        yaxis_opts=opts.AxisOpts(

            name="水量",

            type_="value",

            min_=0,

            max_=250,

            interval=50,

            axislabel_opts=opts.LabelOpts(formatter="{value} ml"),

            axistick_opts=opts.AxisTickOpts(is_show=True),

            splitline_opts=opts.SplitLineOpts(is_show=True),

        ),

    )

)

 

line = (

    Line()

    .add_xaxis(xaxis_data=x_data)

    .add_yaxis(

        series_name="平均温度",

        yaxis_index=1,#坐标索引

        y_axis=[2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2],

        label_opts=opts.LabelOpts(is_show=False),

    )

)

#overlap传入参数为直角坐标系类型图表

bar.overlap(line).render_notebook()#层叠

#bar.render_notebook()

from pyecharts import options as opts
from pyecharts.charts import Map
from pyecharts.faker import Faker

c = (
    Map()
    .add("商家A", [list(z) for z in zip(Faker.provinces, Faker.values())], "china")
    .set_global_opts(title_opts=opts.TitleOpts(title="Map-基本示例"))

)
c.render_notebook()

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值