pyecharts基础制图操作

from pyecharts.charts import Bar        #导入pyecharts 包

  {Bar(柱状图)Line(折线图)Pie(饼图)Scatter(散点图) EffectScatter(涟漪散点图)Radar(雷达图)Funnel(漏斗图)Gauge(仪表盘)}

bar.add_xaxis() 增加X 轴                         #bar.add_xaxis(["苹果","橘子","香蕉","西瓜"]) 
 

bar.add_yaxis('系列名',[ ],color='颜色')增加Y轴            

例:bar.add_yaxis("水果店",[5,20,36,10,75],color ="red")

from pyecharts import options as opts   #标题包

bar.set_global_opts(title_opts=opts.TitleOpts(title="柱状图实例",pos_left="center",pos_bottom="1%")  )       增加标题和位置

参数:pos_leftpos_rightpos_top, 和 pos_bottom  center''left''right')或百分比

例子:bar.set_global_opts(title_opts= opts.TitleOpts(title='柱状图示列',pos_left="center",pos_bottom="1%")

增加小工具:

toolbox_opts=opts.ToolboxOpts(  # 添加工具箱
    is_show=True,  # 是否显示工具箱
    orient="horizontal",  # 工具箱方向,可选 "horizontal" 或 "vertical"
    pos_left="center",  # 工具箱位置
     feature=opts.ToolBoxFeatureOpts(  # 工具箱功能配置
        save_as_image=opts.ToolBoxFeatureSaveAsImageOpts(is_show=True),  # 保存为图片
        restore=opts.ToolBoxFeatureRestoreOpts(is_show=True),  # 重置
        data_view=opts.ToolBoxFeatureDataViewOpts(is_show=True),  # 数据视图
        magic_type=opts.ToolBoxFeatureMagicTypeOpts(is_show=True),  # 动态类型切换
        data_zoom=opts.ToolBoxFeatureDataZoomOpts(is_show=True),  # 数据
    )
)

from pyecharts.globals import ThemeType   背景颜色包

增加背景颜色:

bar=Bar(init_opts=op.InitOpts(theme=ThemeType.DARK))

()内更换有:

#ThemeType.LIGHT:默认亮色主题
#ThemeType.DARK:暗色主题
#ThemeType.CHALK:粉笔风格
#ThemeType.ESSOS:橙色风格
#ThemeType.INFOGRAPHIC:信息图风格

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值