python绘图pyecharts+pandas

pyecharts介绍

pyecharts 是一个用于生成 Echarts 图表的类库。Echarts 是百度开源的一个数据可视化 JS 库。用 Echarts 生成的图可视化效果非常棒

为避免绘制缺漏,建议全部安装

为了避免下载缓慢,作者全部使用镜像源下载过了

  • pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ echarts-countries-pypkg
  • pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ echarts-china-provinces-pypkg
  • pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ echarts-china-cities-pypkg
  • pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ echarts-china-counties-pypkg
  • pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ echarts-china-misc-pypkg
  • pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ echarts-united-kingdom-pypkg
    在这里插入图片描述

基础案例

from pyecharts.charts import Bar
bar = Bar()
bar.add_xaxis(['小嘉','小琪','大嘉琪','小嘉琪'])
bar.add_yaxis('得票数',[60,60,70,100])
#render会生成本地HTML文件,默认在当前目录生成render.html
# bar.render()
#可以传入路径参数,如 bar.render("mycharts.html")
#可以将图形在jupyter中输出,如 bar.render_notebook()
bar.render_notebook()

在这里插入图片描述

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

# 示例数据
cate = ['Apple', 'Huawei', 'Xiaomi', 'Oppo', 'Vivo', 'Meizu']
data1 = [123, 153, 89, 107, 98, 23]
data2 = [56, 77, 93, 68, 45, 67]

# 1.x版本支持链式调用
bar = (Bar()
       .add_xaxis(cate)
       .add_yaxis('渠道', data1)
       .add_yaxis('门店', data2)
       .set_global_opts(title_opts=opts.TitleOpts(title="示例", subtitle="副标"))
      )
bar.render_notebook()

在这里插入图片描述


```python
from pyecharts.charts import Pie
from pyecharts import options as opts

# 示例数据
cate = ['Apple', 'Huawei', 'Xiaomi', 'Oppo', 'Vivo', 'Meizu']
data = [153, 124, 107, 99, 89, 46]

pie = 
  • 3
    点赞
  • 40
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值