Tree-基本示例

 import json
import os from pyecharts import options as opts
from pyecharts.charts import Page, Tree data = [
{
"children": [
{"name": "B"},
{
"children": [
{"children": [{"name": "I"}], "name": "E"},
{"name": "F"},
],
"name": "C",
},
{
"children": [
{"children": [{"name": "J"}, {"name": "K"}], "name": "G"},
{"name": "H"},
],
"name": "D",
},
],
"name": "A",
}
] tree=(
Tree()
.add("", data)
.set_global_opts(title_opts=opts.TitleOpts(title="Tree-基本示例"))
) tree.render()

 import json
import os from pyecharts import options as opts
from pyecharts.charts import Page, Tree data = [
{
"children": [
{"name": "B"},
{
"children": [
{"children": [{"name": "I"}], "name": "E"},
{"name": "F"},
],
"name": "C",
},
{
"children": [
{"children": [{"name": "J"}, {"name": "K"}], "name": "G"},
{"name": "H"},
],
"name": "D",
},
],
"name": "A",
}
] tree=(
Tree()
.add("", data,orient="RL")
.set_global_opts(title_opts=opts.TitleOpts(title="Tree-左右方向"))
)
tree.render()

更改orient="TB"/"BT"分别为上下,下上


Tree-Layout

 import json
import os from pyecharts import options as opts
from pyecharts.charts import Page, Tree data = [
{
"children": [
{"name": "B"},
{
"children": [
{"children": [{"name": "I"}], "name": "E"},
{"name": "F"},
],
"name": "C",
},
{
"children": [
{"children": [{"name": "J"}, {"name": "K"}], "name": "G"},
{"name": "H"},
],
"name": "D",
},
],
"name": "A",
}
] tree=(
Tree()
.add("",data,collapse_interval=2, layout="radial")
.set_global_opts(title_opts=opts.TitleOpts(title="Tree-Layout"))
)
tree.render()

TreeMap-基本示例
 import json
import os from pyecharts import options as opts
from pyecharts.charts import Page, TreeMap data = [
{"value": 40, "name": "我是A"},
{
"value": 180,
"name": "我是B",
"children": [
{
"value": 76,
"name": "我是B.children",
"children": [
{"value": 12, "name": "我是B.children.a"},
{"value": 28, "name": "我是B.children.b"},
{"value": 20, "name": "我是B.children.c"},
{"value": 16, "name": "我是B.children.d"},
],
}
],
},
] treemap = (
TreeMap()
.add("演示数据", data)
.set_global_opts(title_opts=opts.TitleOpts(title="TreeMap-基本示例"))
) treemap.render()

小白学Python(15)——pyecharts 绘制树形图表 Tree的更多相关文章

  1. 小白学 Python 数据分析(21):pyecharts 好玩的图表(系列终篇)

    人生苦短,我用 Python 前文传送门: 小白学 Python 数据分析(1):数据分析基础 小白学 Python 数据分析(2):Pandas (一)概述 小白学 Python 数据分析(3):P ...

  2. 小白学 Python 数据分析(19):Matplotlib(四)常用图表(下)

    人生苦短,我用 Python 前文传送门: 小白学 Python 数据分析(1):数据分析基础 小白学 Python 数据分析(2):Pandas (一)概述 小白学 Python 数据分析(3):P ...

  3. 小白学 Python 数据分析(20):pyecharts 概述

    人生苦短,我用 Python 前文传送门: 小白学 Python 数据分析(1):数据分析基础 小白学 Python 数据分析(2):Pandas (一)概述 小白学 Python 数据分析(3):P ...

  4. 小白学 Python 数据分析(15):数据可视化概述

    人生苦短,我用 Python 前文传送门: 小白学 Python 数据分析(1):数据分析基础 小白学 Python 数据分析(2):Pandas (一)概述 小白学 Python 数据分析(3):P ...

  5. 小白学 Python 数据分析(18):Matplotlib(三)常用图表(上)

    人生苦短,我用 Python 前文传送门: 小白学 Python 数据分析(1):数据分析基础 小白学 Python 数据分析(2):Pandas (一)概述 小白学 Python 数据分析(3):P ...

  6. 小白学 Python(15):基础数据结构(集合)(下)

    人生苦短,我选Python 前文传送门 小白学 Python(1):开篇 小白学 Python(2):基础数据类型(上) 小白学 Python(3):基础数据类型(下) 小白学 Python(4):变 ...

  7. 小白学 Python 爬虫(15):urllib 基础使用(五)

    人生苦短,我用 Python 前文传送门: 小白学 Python 爬虫(1):开篇 小白学 Python 爬虫(2):前置准备(一)基本类库的安装 小白学 Python 爬虫(3):前置准备(二)Li ...

  8. 小白学 Python 数据分析(17):Matplotlib(二)基础操作

    人生苦短,我用 Python 前文传送门: 小白学 Python 数据分析(1):数据分析基础 小白学 Python 数据分析(2):Pandas (一)概述 小白学 Python 数据分析(3):P ...

  9. 小白学 Python(24):Excel 基础操作(下)

    人生苦短,我选Python 前文传送门 小白学 Python(1):开篇 小白学 Python(2):基础数据类型(上) 小白学 Python(3):基础数据类型(下) 小白学 Python(4):变 ...

随机推荐

  1. Arduino-LiquidCrystal_I2C 液晶库

    I2C转接板上[PCF8574T转接板]VCC接5V,GND接GND,SCL接SCL(即A05),SDA接SDA(即A04) 常用的函数是 lcd.init(),lcd初始化 setCursor(x, ...

  2. man cal

    CAL(1)                                                                  CAL(1) NAME       cal - 显示一个 ...

  3. 使用Spring.Net进行Webservice开发&发布遇到的问题

    发布遇到的问题1: HTTP 错误 404.17 - Not Found 请求的内容似乎是脚本,因而将无法由静态文件处理程序来处理. 最终解决时IIS的设置情况: 1.应用程序池的高级设置中 启用32 ...

  4. 51nod1820 长城之旅

    题目描述 BB 痛失一血(打了场Comet OJ回来就没了) 不过后来又刷了一道水题 题解 LCM+取模=结论题 结论1 \(gcd(k^{2^i}+1,k^{2^j}+1)=1 (i\neq j 且 ...

  5. mybatis insert update delete返回都是整型 0,1,增,删,改要提交事物

    mybatis insert update delete返回都是整型 0,1, 没有扔 增,删,改要提交事物

  6. Ajax中浏览器的缓存问题解决方法

    我们在做项目中,一般提交请求都会通过ajax来提交,但是测试的时候发现,每次提交后得到的数据都是一样的,调试可以排除后台代码的问题,所以问题肯定是出在前台 每次清除缓存后,就会得到一个新的数据,所以归 ...

  7. 【bzoj2724】[Violet 6]蒲公英

    *题目描述: *输入: 修正一下 l = (l_0 + x - 1) mod n + 1, r = (r_0 + x - 1) mod n + 1 *输出: *样例输入: 6 3 1 2 3 2 1 ...

  8. linux 阿里云oss命令ossutil64 同步文件

    官方使用文档: https://help.aliyun.com/document_detail/120057.html?spm=a2c4g.11186623.4.2.1c35448ak8Ez8e [r ...

  9. uva live 7639 Extreme XOR Sum (暴力+二项式)

    题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_ ...

  10. Zipf's law

    w https://www.bing.com/knows/search?q=马太效应&mkt=zh-cn&FORM=BKACAI 马太效应(Matthew Effect),指强者愈强. ...