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 相关文章推荐
Linux下使用python自动修改本机网关代码分享
May 21 Python
对Python3中的input函数详解
Apr 22 Python
详解Django解决ajax跨域访问问题
Aug 24 Python
详解将Django部署到Centos7全攻略
Sep 26 Python
Python匿名函数及应用示例
Apr 09 Python
python实现二分类的卡方分箱示例
Nov 22 Python
解决Tensorflow 内存泄露问题
Feb 05 Python
python调用有道智云API实现文件批量翻译
Oct 10 Python
详解Pycharm第三方库的安装及使用方法
Dec 29 Python
python引入其他文件夹下的py文件具体方法
May 23 Python
Python学习之os包使用教程详解
Mar 21 Python
Python实现仓库管理系统
May 30 Python
PYTHON 使用 Pandas 删除某列指定值所在的行
Apr 28 #Python
详解PyTorch模型保存与加载
Apr 28 #Python
Python 图片添加美颜效果
Python 视频画质增强
python 单机五子棋对战游戏
python井字棋游戏实现人机对战
Apr 28 #Python
Python开发五子棋小游戏
You might like
PHP遍历目录函数opendir()、readdir()、closedir()、rewinddir()总结
2014/11/18 PHP
10个对初学者非常有用的PHP技巧
2016/04/06 PHP
ThinkPHP和UCenter接口冲突的解决方法
2016/07/25 PHP
让whoops帮我们告别ThinkPHP6的异常页面
2020/03/02 PHP
[原创]来自ImageSee官方 JavaScript图片浏览器
2008/01/16 Javascript
jquery.cookie.js 操作cookie实现记住密码功能的实现代码
2011/04/27 Javascript
js控制表单不能输入空格的小例子
2013/11/20 Javascript
jQuery动态显示和隐藏datagrid中的某一列的方法
2013/12/11 Javascript
通过jquery 获取URL参数并进行转码
2014/08/18 Javascript
Nodejs极简入门教程(三):进程
2014/10/27 NodeJs
Jquery实现简单的轮播效果(代码管用)
2016/03/14 Javascript
微信小程序 页面之间传参实例详解
2017/01/13 Javascript
ES6新特性二:Iterator(遍历器)和for-of循环详解
2017/04/20 Javascript
bootstrap table插件的分页与checkbox使用详解
2017/07/23 Javascript
详解jquery选择器的原理
2017/08/01 jQuery
JS中跳出循环的示例代码
2017/09/14 Javascript
基于vue 添加axios组件,解决post传参数为null的问题
2018/03/05 Javascript
webpack4 css打包压缩问题的解决
2018/05/18 Javascript
vue.js将时间戳转化为日期格式的实现代码
2018/06/05 Javascript
函数式编程入门实践(一)
2019/04/20 Javascript
[16:19]教你分分钟做大人——风暴之灵
2015/03/11 DOTA
一百行python代码将图片转成字符画
2021/02/19 Python
Python实现根据日期获取当天凌晨时间戳的方法示例
2019/04/09 Python
flask 使用 flask_apscheduler 做定时循环任务的实现
2019/12/10 Python
Python While循环语句实例演示及原理解析
2020/01/03 Python
浅谈keras通过model.fit_generator训练模型(节省内存)
2020/06/17 Python
基于K.image_data_format() == 'channels_first' 的理解
2020/06/29 Python
Otticanet澳大利亚:最顶尖的世界名牌眼镜, 能得到打折季的价格
2018/08/23 全球购物
爱尔兰最大的体育零售商:Life Style Sports
2019/06/12 全球购物
do you have any Best Practice for testing
2016/06/04 面试题
化妆师职业生涯规划书
2014/02/16 职场文书
学雷锋志愿服务月活动总结
2014/03/09 职场文书
运动会广播稿200字(10篇)
2014/10/12 职场文书
厉害!这是Redis可视化工具最全的横向评测
2021/07/15 Redis
 Python 中 logging 模块使用详情
2022/03/03 Python
详解OpenCV获取高动态范围(HDR)成像
2022/04/29 Python