PYTHON基于Pyecharts绘制常见的直角坐标系图表


Posted in Python onApril 28, 2022

1.直方图

# -*-coding:utf-8 -*-
# @Time :  21:02
# @Author: 黄荣津
# @File : 1.直方图.py
# @Software: PyCharm
 
from pyecharts.charts import *
from pyecharts.components import Table
from pyecharts import options as opts
from pyecharts.commons.utils import JsCode
import random
import datetime
from pyecharts.globals import CurrentConfig
CurrentConfig.ONLINE_HOST = "https://cdn.kesci.com/lib/pyecharts_assets/"
 
x_data = ['python', 'java', 'c','c++', 'R', 'excel']
y_data = [143, 123, 69, 107, 90, 73]
bar = (Bar()
       .add_xaxis(x_data)
       .add_yaxis('', y_data)
      )
bar.render("1.直方图.html")

PYTHON基于Pyecharts绘制常见的直角坐标系图表

2.折线图

# -*-coding:utf-8 -*-
# @Time :  21:19
# @Author: 黄荣津
# @File : 2.折线图.py
# @Software: PyCharm
 
from pyecharts.charts import *
from pyecharts.components import Table
from pyecharts import options as opts
from pyecharts.commons.utils import JsCode
import random
import datetime
from pyecharts.globals import CurrentConfig
CurrentConfig.ONLINE_HOST = "https://cdn.kesci.com/lib/pyecharts_assets/"
 
x_data = ['python', 'java', 'c','c++', 'R', 'excel']
y_data = [143, 123, 69, 107, 90, 73]
line = (Line()
       .add_xaxis(x_data)
       .add_yaxis('', y_data)
      )
line.render("2.折线图.html")

PYTHON基于Pyecharts绘制常见的直角坐标系图表

3.箱形图

# -*-coding:utf-8 -*-
# @Time :  21:25
# @Author: 黄荣津
# @File : 3.箱型图.py
# @Software: PyCharm
 
from pyecharts.charts import *
from pyecharts.components import Table
from pyecharts import options as opts
from pyecharts.commons.utils import JsCode
import random
import datetime
from pyecharts.globals import CurrentConfig
CurrentConfig.ONLINE_HOST = "https://cdn.kesci.com/lib/pyecharts_assets/"
 
x_data = ['python', 'java', 'c','c++', 'R', 'excel']
y_data = [[random.randint(100, 150) for i in range(20)] for item in x_data]
 
class Box:
    pass
 
box =( Boxplot()
.add_xaxis(x_data)
.add_yaxis("", (y_data))
)
box.render("3.箱型图.html")

PYTHON基于Pyecharts绘制常见的直角坐标系图表

4.散点图

# -*-coding:utf-8 -*-
# @Time :  21:58
# @Author: 黄荣津
# @File : 4.散点图.py
# @Software: PyCharm
 
 
from pyecharts.charts import *
from pyecharts.components import Table
from pyecharts import options as opts
from pyecharts.commons.utils import JsCode
import random
import datetime
from pyecharts.globals import CurrentConfig
CurrentConfig.ONLINE_HOST = "https://cdn.kesci.com/lib/pyecharts_assets/"
x_data = ['python', 'java', 'c','c++', 'R', 'excel']
y_data = [143, 123, 69, 107, 90, 73]
Scatter=(Scatter()
       .add_xaxis(x_data)
       .add_yaxis('', y_data)
      )
Scatter.render("4.散点图.html")

PYTHON基于Pyecharts绘制常见的直角坐标系图表

5.带涟漪效果散点图

# -*-coding:utf-8 -*-
# @Time :  22:23
# @Author: 黄荣津
# @File : 5.带涟漪效果散点图.py
# @Software: PyCharm
 
 
from pyecharts.charts import *
from pyecharts.components import Table
from pyecharts import options as opts
from pyecharts.commons.utils import JsCode
import random
import datetime
from pyecharts.globals import CurrentConfig
CurrentConfig.ONLINE_HOST = "https://cdn.kesci.com/lib/pyecharts_assets/"
x_data = ['python', 'java', 'c','c++', 'R', 'excel']
y_data = [143, 123, 69, 107, 90, 73]
 
effectScatter = (EffectScatter()
           .add_xaxis(x_data)
           .add_yaxis('', y_data)
           )
 
effectScatter.render("5.带涟漪效果散点图.html")

PYTHON基于Pyecharts绘制常见的直角坐标系图表

6.k线图

# -*-coding:utf-8 -*-
# @Time :  22:27
# @Author: 黄荣津
# @File : 6.k线图.py
# @Software: PyCharm
 
from pyecharts.charts import *
from pyecharts.components import Table
from pyecharts import options as opts
from pyecharts.commons.utils import JsCode
import random
import datetime
from pyecharts.globals import CurrentConfig
CurrentConfig.ONLINE_HOST = "https://cdn.kesci.com/lib/pyecharts_assets/"
 
date_list = ["2022/4/{}".format(i + 1) for i in range(30)]
y_data = [[random.randint(200, 350) for i in range(20)] for item in date_list]
 
kline = (Kline()
         .add_xaxis(date_list)
         .add_yaxis('', y_data)
         )
 
kline.render("6.k线图.html")

PYTHON基于Pyecharts绘制常见的直角坐标系图表

7.热力图

# -*-coding:utf-8 -*-
# @Time :  22:36
# @Author: 黄荣津
# @File : 7.热力图.py
# @Software: PyCharm
 
from pyecharts.charts import *
from pyecharts.components import Table
from pyecharts import options as opts
from pyecharts.commons.utils import JsCode
import random
import datetime
from pyecharts.globals import CurrentConfig
CurrentConfig.ONLINE_HOST = "https://cdn.kesci.com/lib/pyecharts_assets/"
 
data = [[i, j, random.randint(0, 100)] for i in range(24) for j in range(7)]
hour_list = [str(i) for i in range(24)]
week_list = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']
 
heat = (HeatMap()
        .add_xaxis(hour_list)
        .add_yaxis("", week_list, data)
        )
 
heat.render("7.热力图.html")

PYTHON基于Pyecharts绘制常见的直角坐标系图表

8.象型图

# -*-coding:utf-8 -*-
# @Time :  22:46
# @Author: 黄荣津
# @File : 8.象型图.py
# @Software: PyCharm
 
from pyecharts.charts import *
from pyecharts.components import Table
from pyecharts import options as opts
from pyecharts.commons.utils import JsCode
import random
import datetime
from pyecharts.globals import CurrentConfig
CurrentConfig.ONLINE_HOST = "https://cdn.kesci.com/lib/pyecharts_assets/"
 
x_data = ['python', 'java', 'c','c++', 'R', 'excel']
y_data = [143, 123, 69, 107, 90, 33]
pictorialBar = (PictorialBar()
                .add_xaxis(x_data)
                .add_yaxis('', y_data)
                )
 
pictorialBar.render("8.象型图.html")

PYTHON基于Pyecharts绘制常见的直角坐标系图表

9.层叠图

# -*-coding:utf-8 -*-
# @Time :  23:02
# @Author: 黄荣津
# @File : 9.层叠图.py
# @Software: PyCharm
 
from pyecharts.charts import *
from pyecharts.components import Table
from pyecharts import options as opts
from pyecharts.commons.utils import JsCode
import random
import datetime
from pyecharts.globals import CurrentConfig
CurrentConfig.ONLINE_HOST = "https://cdn.kesci.com/lib/pyecharts_assets/"
 
x_data = ['python', 'java', 'c','c++', 'R', 'excel']
y_data = [143, 123, 69, 107, 90, 73]
bar = (Bar()
       .add_xaxis(x_data)
       .add_yaxis('', y_data)
       )
 
line = (Line()
        .add_xaxis(x_data)
        .add_yaxis('', y_data)
        )
 
overlap = bar.overlap(line) #利用第一个图表为基础,往后的数据都将会画在第一个图表上
overlap.render("9.层叠图.html")

PYTHON基于Pyecharts绘制常见的直角坐标系图表

总结

到此这篇关于如何基于Pyecharts绘制常见的直角坐标系图表的文章就介绍到这了!


Tags in this post...

Python 相关文章推荐
详解Python中__str__和__repr__方法的区别
Apr 17 Python
Python中max函数用于二维列表的实例
Apr 03 Python
儿童学习python的一些小技巧
May 27 Python
python爬取网页内容转换为PDF文件
Jul 28 Python
解决pyinstaller打包pyqt5的问题
Jan 08 Python
python try except返回异常的信息字符串代码实例
Aug 15 Python
Python 进程操作之进程间通过队列共享数据,队列Queue简单示例
Oct 11 Python
用python的turtle模块实现给女票画个小心心
Nov 23 Python
python程序文件扩展名知识点详解
Feb 27 Python
PyCharm 2020 激活到 2100 年的教程
Mar 25 Python
使用Keras实现简单线性回归模型操作
Jun 12 Python
Python3.9新特性详解
Oct 10 Python
PYTHON 使用 Pandas 删除某列指定值所在的行
Apr 28 #Python
详解PyTorch模型保存与加载
Apr 28 #Python
Python 图片添加美颜效果
Python 视频画质增强
python 单机五子棋对战游戏
python井字棋游戏实现人机对战
Apr 28 #Python
Python开发五子棋小游戏
You might like
几种显示数据的方法的比较
2006/10/09 PHP
php操作excel文件 基于phpexcel
2010/07/02 PHP
PHP中模拟处理HTTP PUT请求的例子
2014/07/22 PHP
php制作简单模版引擎
2016/04/07 PHP
php原生导出excel文件的两种方法(推荐)
2016/11/19 PHP
PHP的mysqli_stmt_init()函数讲解
2019/01/24 PHP
解决Laravel5.x的php artisan migrate数据库迁移创建操作报错SQLSTATE[42000]
2020/04/06 PHP
JavaScript学习点滴 call、apply的区别
2010/10/22 Javascript
js 程序执行与顺序实现详解
2013/05/13 Javascript
Javascript变量作用域详解
2013/12/06 Javascript
jQuery选择器源码解读(六):Sizzle选择器匹配逻辑分析
2015/03/31 Javascript
javascript实现的固定位置悬浮窗口实例
2015/04/30 Javascript
jQuery实现的调整表格行tr上下顺序
2016/01/10 Javascript
对js eval()函数的一些见解
2016/08/15 Javascript
Webpack 服务器端代码打包的示例代码
2017/09/19 Javascript
JavaScript canvas实现围绕旋转动画
2017/11/18 Javascript
利用JS判断客户端类型你应该知道的四种方法
2017/12/22 Javascript
如何从零开始利用js手写一个Promise库详解
2018/04/19 Javascript
vue的token刷新处理的方法
2018/07/17 Javascript
angular4自定义表单控件[(ngModel)]的实现
2018/11/23 Javascript
微信小程序自定义底部导航带跳转功能
2018/11/27 Javascript
Vee-validate 父组件获取子组件表单校验结果的实例代码
2019/05/20 Javascript
js实现图片跟随鼠标移动效果
2019/10/16 Javascript
openLayer4实现动态改变标注图标
2020/08/17 Javascript
element-ui中dialog弹窗关闭按钮失效的解决
2020/09/22 Javascript
pygame学习笔记(5):游戏精灵
2015/04/15 Python
Python+django实现文件上传
2016/01/17 Python
python同时遍历数组的索引和值的实例
2018/11/15 Python
Django 解决model 反向引用中的related_name问题
2020/05/19 Python
Python 无限级分类树状结构生成算法的实现
2021/01/21 Python
Urban Outfitters美国官网:美国生活方式品牌
2016/08/26 全球购物
2015年工商所工作总结
2015/05/21 职场文书
2016廉洁教育心得体会
2016/01/20 职场文书
pytorch中[..., 0]的用法说明
2021/05/20 Python
一文搞懂Python Sklearn库使用
2021/08/23 Python
Python数据处理的三个实用技巧分享
2022/04/01 Python