Python pyecharts绘制折线图
一、pyecharts绘制折线图line.add()方法简介
line.add()方法简介
add(name,x_axis,y_axis,is_symbol_show=True,
is_smooth=false,
is_stack=false,
is_step=false,**kwargs)
name->图例名称
x_axis->list x坐标轴数据
y_axis->list y坐标轴数据
is_symbol_show=True 是否显示标记图形默认为true
is_smooth 是否平滑曲线显示 默认为false
is_stack 数据堆叠,同个类目轴上系列配置相同的stack值可以堆叠放置。默认为false。
is_step 是否为阶梯线图。可以设置为true显示成阶梯线图。默认为false。
二、绘制折线图按平滑曲线和阶梯线图显示
attr = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
v1 = [5, 20, 36, 10, 10, 100]
v2 = [55, 60, 16, 20, 15, 80]
line = Line("折线图示例")
line.add("商家A", attr, v1, mark_point=["average"],is_step=True,is_label_show=True,is_more_utils=True) #is_step阶梯线图
line.add("商家B", attr, v2, is_smooth=True, mark_line=["max", "average"],is_label_show=True,is_more_utils=True) #is_smooth=True 平滑曲线显示
page.add(line)
三、绘制折线图添加标记点和标记线
attr = ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
line1 = Line("折线图示例")
line1.add(
"最高气温",
attr,
[11, 11, 15, 13, 12, 13, 10],
mark_point=["max", "min"],
mark_line=["average"],
mark_point_symbol="arrow",
mark_point_textcolor="#40ff27",
)
line1.add(
"最低气温",
attr,
[1, -2, 2, 5, 3, 2, 0],
mark_point=["max", "min"],
mark_line=["average"],
yaxis_formatter="°C",
mark_point_symbol="diamond",
mark_point_symbolsize=40,
)
page.add(line1)
四、完整代码如下所示
from pyecharts import Page
from pyecharts import Line
page = Page()
attr = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
v1 = [5, 20, 36, 10, 10, 100]
v2 = [55, 60, 16, 20, 15, 80]
line = Line("折线图示例")
line.add("商家A", attr, v1, mark_point=["average"],is_step=True,is_label_show=True,is_more_utils=True) #is_step阶梯线图
line.add("商家B", attr, v2, is_smooth=True, mark_line=["max", "average"],is_label_show=True,is_more_utils=True) #is_smooth=True 平滑曲线显示
page.add(line) attr = ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
line1 = Line("折线图示例")
line1.add(
"最高气温",
attr,
[11, 11, 15, 13, 12, 13, 10],
mark_point=["max", "min"],
mark_line=["average"],
mark_point_symbol="arrow",
mark_point_textcolor="#40ff27",
)
line1.add(
"最低气温",
attr,
[1, -2, 2, 5, 3, 2, 0],
mark_point=["max", "min"],
mark_line=["average"],
yaxis_formatter="°C",
mark_point_symbol="diamond",
mark_point_symbolsize=40,
)
page.add(line1)
page.render()
Python pyecharts绘制折线图的更多相关文章
- Python pyecharts绘制漏斗图
一.pyecharts绘制漏斗图方法简介 funnel.add()方法简介add(name, attr, value, funnel_sort="ascending", funne ...
- Python pyecharts绘制水球图
一.水球图Liquid.add()方法简介 Liquid.add()方法签名add(name, data, shape='circle', liquid_color=None, is_liquid_a ...
- python使用matplotlib绘制折线图教程
Matplotlib是一个Python工具箱,用于科学计算的数据可视化.借助它,Python可以绘制如Matlab和Octave多种多样的数据图形.下面这篇文章主要介绍了python使用matplot ...
- Python绘制折线图
一.Python绘制折线图 1.1.Python绘制折线图对应代码如下图所示 import matplotlib.pyplot as pltimport numpy as np from pylab ...
- 用canvas绘制折线图
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- php中用GD绘制折线图
php中用GD绘制折线图,代码如下: Class Chart{ private $image; // 定义图像 private $title; // 定义标题 private $ydata; // 定 ...
- UUChart的使用--iOS绘制折线图
UUChart是一个用于绘制图表的第三方,尤其适合去绘制折线图. 二.下载地址: https://github.com/ZhipingYang/UUChartView 三.使用 第一步.首先我们将下载 ...
- html5绘制折线图
html5绘制折线图详细代码 <html> <canvas id="a_canvas" width="1000" height="7 ...
- Android自己定义组件系列【9】——Canvas绘制折线图
有时候我们在项目中会遇到使用折线图等图形,Android的开源项目中为我们提供了非常多插件,可是非常多时候我们须要依据详细项目自己定义这些图表,这一篇文章我们一起来看看怎样在Android中使用Can ...
随机推荐
- GATK4.1 call SNP
GATK4.0 和之前的版本相比还是有较大的不同,更加趋于流程化. 软件安装 1 wget https://github.com/broadinstitute/gatk/releases/downlo ...
- 在R语言中使用Stringr进行字符串操作
今天来学习下R中字符串处理操作,主要是stringr包中的字符串处理函数的用法. 先导入stringr包,library(stringr),require(stringr),或者stringr::函数 ...
- Python基础之流程控制while循环
目录 1. 语法 2. while+break 3. while+continue 4. while+else 1. 语法 最简单的while循环如下: ''' while <条件>: & ...
- linux中chage命令的基本使用
在Linux中chage命令常用于设置系统用户的账户属性 Usage: chage [options] LOGIN Options: -d, --lastday LAST_DAY set date o ...
- CAN总线常见的两种编码格式(Intel/Motorola)
在汽车电子行业的开发或者测试中,我们经常会看到CAN总线信号的常见的两种编码格式:Intel格式与Motorola格式. 讲解这两种格式之前,我们先来了解一些大端模式和小端模式,会对后面理解这两种编码 ...
- postgresql安装部署
一.下载安装: 1.下载: 官网下载地址:https://www.postgresql.org/download/linux/redhat/ 也可以用这个:https://www.enterprise ...
- Spark(四)【RDD编程算子】
目录 测试准备 一.Value类型转换算子 map(func) mapPartitions(func) mapPartitions和map的区别 mapPartitionsWithIndex(func ...
- django中的filter(), all(), get()
1. 类名.objects中的get(), filter(), all() 的区别 结论: (1)all()返回的是QuerySet对象,程序并没有真的在数据库中执行SQL语句查询数据,但支持迭代,使 ...
- [Windows编程]模块遍历
模块遍历 整体思路 1.创建进程快照 2.遍历首次模块 3.继续下次遍历 4.模块信息结构体 相关API的调用 创建进程快照API HANDLE WINAPI CreateToolhelp32Snap ...
- 容器之分类与各种测试(三)——queue
queue是单端队列,但是在其实现上是使用的双端队列,所以在queue的实现上多用的是deque的方法.(只要用双端队列的一端只出数据,另一端只进数据即可从功能上实现单端队列)如下图 例程 #incl ...