Python pyecharts模块安装与入门教程
作者:Shewyoo 时间:2023-09-11 06:52:41
pyecharts产生背景
Echarts是由百度开源的数据可视化,凭借良好的交互性和精巧的图表设计,得到众多开发者的认可,而python很适合用于数据处理,数据分析遇到数据可视化时pyecharts就产生了。
官网链接:https://pyecharts.org/#/
画廊pyecharts-gallery
pyecharts支持的图表众多,官方提供了画廊用于参考。
画廊链接:https://gallery.pyecharts.org/#/
一、pyecharts模块安装
使用pip命令快速安装:
pip install pyecharts
此处省略,跟前面的文章安装第三方包的操作一样。
二、pyecharts入门
1、基础折线图
①导包Line
from pyecharts.charts import Line
②得到折线图对象
line = Line()
③添加x轴数据
line.add_xaxis(["中国","美国","英国"])
④添加y轴数据
line.add_yaxis("GDP",[30,20,10])
⑤生成图表
line.render()
运行后出现一个html文件,打开html文件会出现可视化图表。
2、pyecharts配置选项
全局配置选项
可通过set_global_opts方法配置
更多配置选项可前往官网参考。
例:
from pyecharts.options import TitleOpts,LegendOpts,ToolboxOpts,VisualMapOpts
line.set_global_opts(
title_opts=TitleOpts("GDP展示","center","1%"),
legend_opts=LegendOpts(True),
toolbox_opts=ToolboxOpts(True),
visualmap_opts=VisualMapOpts(True)
)
来源:https://blog.csdn.net/Tir_zhang/article/details/126739936
标签:Python,pyecharts,模块,安装
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
通过底层源码理解YOLOv5的Backbone
2023-07-15 20:37:01
![](https://img.aspxhome.com/file/2023/5/103005_0s.jpg)
基于python实现坦克大战游戏
2023-01-29 01:48:30
![](https://img.aspxhome.com/file/2023/9/133539_0s.jpg)
SQL server高级应用 收藏版
2024-01-18 06:38:34
Django + Taro 前后端分离项目实现企业微信登录功能
2023-05-31 18:48:46
![](https://img.aspxhome.com/file/2023/2/109632_0s.png)
数据库 关键字一览表
2024-01-22 23:27:21
python字典进行运算原理及实例分享
2023-02-16 14:17:14
Vue中列表渲染指令v-for的基本用法详解
2024-05-28 15:52:06
![](https://img.aspxhome.com/file/2023/6/123156_0s.png)
原生js封装的一些jquery方法(详解)
2024-04-19 09:47:01
Python爬取三国演义的实现方法
2022-12-11 20:07:37
Python Pandas学习之数据离散化与合并详解
2022-09-28 20:12:07
![](https://img.aspxhome.com/file/2023/3/128513_0s.png)
Python之Selenium自动化浏览器测试详解
2022-08-19 00:04:55
![](https://img.aspxhome.com/file/2023/2/131102_0s.png)
详解Python做一个名片管理系统
2021-03-17 05:56:17
用python绘制彩色螺旋线代码
2023-04-30 15:32:18
![](https://img.aspxhome.com/file/2023/4/77894_0s.jpg)
ChatGpt无法访问或错误码1020的几种解决方案
2023-03-03 05:58:36
vue全局自定义指令-元素拖拽的实现代码
2024-04-30 08:46:16
JavaScript中的this指针用法
2007-08-26 17:29:00
mysql 实现互换表中两列数据方法简单实例
2024-01-24 07:11:04
python写的一个文本编辑器
2021-10-12 08:38:04
关于windows下Tensorflow和pytorch安装教程
2023-06-09 07:35:54
![](https://img.aspxhome.com/file/2023/5/70695_0s.png)
MySQL的时间差函数TIMESTAMPDIFF、DATEDIFF的用法
2024-01-25 04:39:33