Hello_Pluto 2023-03-27 16:44 采纳率: 50%
浏览 19
已结题

pyecharts的graph增加节点不显示

在使用Pyecharts中的Graph时,没深入去了解,问题大概就是相同的代码,只是节点的增加,但数据就不显示,真的不是很理解,属实不知道怎么办了,求指点。

img

import json
from pyecharts import options as opts
from pyecharts.charts import Graph,Page

nodes = [
    {'name':'Java工程师','symbolSize':30,'value':36,'category':'java'},
    {'name':'JSP','symbolSize':10,'category':'java'},
    {'name':'Servlet','symbolSize':10,'category':'java'},
    {'name':'Spring','symbolSize':10,'category':'java'},
    {'name':'IoC','symbolSize':10,'category':'java'},
    {'name':'AOP','symbolSize':10,'category':'java'},
    {'name':'Hiberna','symbolSize':10,'category':'java'},
    {'name':'MyBatis','symbolSize':10,'category':'java'},
    {'name':'ORM','symbolSize':10,'category':'java'},
    {'name':'HTML','symbolSize':10,'category':'java'},
    {'name':'CSS','symbolSize':10,'category':'java'},
    {'name':'JavaScript','symbolSize':10,'category':'java'},
    {'name':'Query','symbolSize':10,'category':'java'},
    {'name':'Bootstrap','symbolSize':10,'category':'java'},

    {'name':'Python工程师','symbolSize':30,'value':36,'category':'python'},
    {'name':'Python','symbolSize':10,'category':'python'},
    {'name':'Linux','symbolSize':10,'category':'python'},
    {'name':'MySQL','symbolSize':10,'category':'python'},
    {'name':'scipy','symbolSize':10,'category':'python'},
    {'name':'SQL','symbolSize':10,'category':'python'},
    {'name':'re','symbolSize':10,'category':'python'},
    {'name':'Web','symbolSize':10,'category':'python'},
    {'name':'HelloDjango','symbolSize':10,'category':'python'},
    {'name':'Web-Flask','symbolSize':10,'category':'python'},
    {'name':'matpoltlib','symbolSize':10,'category':'python'},
    {'name':'机器学习算法','symbolSize':10,'category':'python'},
]

links = []
links.append({'source':'Java工程师','target':'Python工程师'})
for i in range(1,14):
    links.append({'source':'Java工程师','target':nodes[i].get('name')})
for i in range(15,26):
    links.append({'source':'Python工程师','target':nodes[i].get('name')})

categories = [{'name':'java'},{'name':'python'}]

graph = ( Graph()
    .add("",
        nodes,
        links,
        categories,
        repulsion=100,
        linestyle_opts=opts.LineStyleOpts( curve=0.3),    #curve线的弯曲程度
    )
)

graph.render('技能关系图2.html')

一旦再添加一些节点就没有任何显示了:

img


代码如下:

import json
from pyecharts import options as opts
from pyecharts.charts import Graph,Page

nodes = [
    {'name':'Java工程师','symbolSize':30,'value':36,'category':'java'},
    {'name':'JSP','symbolSize':10,'category':'java'},
    {'name':'Servlet','symbolSize':10,'category':'java'},
    {'name':'Spring','symbolSize':10,'category':'java'},
    {'name':'IoC','symbolSize':10,'category':'java'},
    {'name':'AOP','symbolSize':10,'category':'java'},
    {'name':'Hiberna','symbolSize':10,'category':'java'},
    {'name':'MyBatis','symbolSize':10,'category':'java'},
    {'name':'ORM','symbolSize':10,'category':'java'},
    {'name':'HTML','symbolSize':10,'category':'java'},
    {'name':'CSS','symbolSize':10,'category':'java'},
    {'name':'JavaScript','symbolSize':10,'category':'java'},
    {'name':'Query','symbolSize':10,'category':'java'},
    {'name':'Bootstrap','symbolSize':10,'category':'java'},
    {'name':'Ajax','symbolSize':10,'category':'java'},
    {'name':'MySQL','symbolSize':10,'category':'java'},
    {'name':'Oracle','symbolSize':10,'category':'java'},
    {'name':'SQL','symbolSize':10,'category':'java'},
    {'name':'PL','symbolSize':10,'category':'java'},
    {'name':'UML','symbolSize':10,'category':'java'},
    {'name':'TDD','symbolSize':10,'category':'java'},
    {'name':'DDD','symbolSize':10,'category':'java'},
    {'name':'Apache','symbolSize':10,'category':'java'},
    {'name':'NginX','symbolSize':10,'category':'java'},
    {'name':'Tomcat','symbolSize':10,'category':'java'},
    {'name':'WildFly','symbolSize':10,'category':'java'},
    {'name':'Weblogic','symbolSize':10,'category':'java'},
    {'name':'Axure','symbolSize':10,'category':'java'},
    {'name':'PowerDesigner','symbolSize':10,'category':'java'},
    {'name':'EnterpriseArchitect','symbolSize':10,'category':'java'},
    {'name':'Eclipse','symbolSize':10,'category':'java'},
    {'name':'IntelliJ','symbolSize':10,'category':'java'},
    {'name':'WebStorm','symbolSize':10,'category':'java'},
    {'name':'SVN','symbolSize':10,'category':'java'},
    {'name':'Git','symbolSize':10,'category':'java'},
    {'name':'Maven','symbolSize':10,'category':'java'},
    {'name':'Gradle','symbolSize':10,'category':'java'},

    {'name':'Python工程师','symbolSize':30,'value':24,'category':'python'},
    {'name':'Python','symbolSize':10,'category':'python'},
    {'name':'Linux','symbolSize':10,'category':'python'},
    {'name':'MySQL','symbolSize':10,'category':'python'},
    {'name':'SQL','symbolSize':10,'category':'python'},
    {'name':'re','symbolSize':10,'category':'python'},
    {'name':'Web','symbolSize':10,'category':'python'},
    {'name':'HelloDjango','symbolSize':10,'category':'python'},
    {'name':'Web-Flask','symbolSize':10,'category':'python'},
    {'name':'property','symbolSize':10,'category':'python'},
    {'name':'StringIO','symbolSize':10,'category':'python'},
    {'name':'BytesIO','symbolSize':10,'category':'python'},
    {'name':'MongoDB','symbolSize':10,'category':'python'},
    {'name':'Redis','symbolSize':10,'category':'python'},
    {'name':'Models','symbolSize':10,'category':'python'},
    {'name':'Templates','symbolSize':10,'category':'python'},
    {'name':'Views','symbolSize':10,'category':'python'},
    {'name':'Advanced','symbolSize':10,'category':'python'},
    {'name':'RESTful','symbolSize':10,'category':'python'},
    {'name':'爬虫','symbolSize':10,'category':'python'},
    {'name':'scrapy','symbolSize':10,'category':'python'},
    {'name':'numpy&pandas','symbolSize':10,'category':'python'},
    {'name':'scipy','symbolSize':10,'category':'python'},
    {'name':'matpoltlib','symbolSize':10,'category':'python'},
    {'name':'机器学习算法','symbolSize':10,'category':'python'},
]

links = []
links.append({'source':'Java工程师','target':'Python工程师'})
for i in range(1,37):
    links.append({'source':'Java工程师','target':nodes[i].get('name')})

for i in range(38,62):
    links.append({'source':'Python工程师','target':nodes[i].get('name')})

categories = [{'name':'java'},{'name':'python'}]

graph = ( Graph()
    .add("",
        nodes,
        links,
        categories,
        repulsion=250,
        linestyle_opts=opts.LineStyleOpts( curve=0.3),    #curve线的弯曲程度
    )
)

graph.render('技能关系图.html')

  • 写回答

2条回答 默认 最新

  • Hello_Pluto 2023-03-27 17:01
    关注

    是graph本身就有节点限制吗

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 4月4日
  • 已采纳回答 3月27日
  • 创建了问题 3月27日

悬赏问题

  • ¥50 swiftui @query 报错
  • ¥50 怎么解决刷卡或扫码后,点击软件输入框,win10屏幕键盘不会自动弹出的问题
  • ¥15 如何使用arcgispro的训练深度模型,发现water和nowater精度为0?(相关搜索:深度学习)
  • ¥20 matlab作业不太懂呀有问题能给个代码吗
  • ¥15 自制电路图为何无法驱动ESP01S?
  • ¥15 前端加access数据库
  • ¥15 ARCGIS 多值提取到点 ERROR 999999
  • ¥15 mysql异常断电, [MY-011971] [InnoDB]
  • ¥15 uni.onBluetoothDeviceFound熄屏不运行
  • ¥15 求PHDA糖尿病并发症数据集,有偿