Python相当于D3.js [英] Python equivalent of D3.js

查看:452
本文介绍了Python相当于D3.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以推荐可以进行交互式图形可视化的Python库。

Can anyone recommend a Python library that can do interactive graph visualization?

我特别想要像d3.js python ,理想情况下它也是3D。

I specifically want something like d3.js but for python and ideally it would be 3D as well.

我看过:


  • NetworkX - 它只有 Matplotlib 情节和那些似乎是2D。我没有看到任何类型的交互性,比如 d3.js 给出,如拉节点。

  • graph-tool - 它只显示2D绘图,并且具有非常缓慢的交互式图表。

  • NetworkX - it only does Matplotlib plots and those seem to be 2D. I didn't see any sort of interactiveness, like one that d3.js gives, such as pulling nodes around.
  • graph-tool - it does only 2D plots and has very slow interactive graphs.

推荐答案

您可以使用 d3py 一个python模块生成xml页面嵌入d3.js脚本。例如:

You could use d3py a python module that generate xml pages embedding d3.js script. For example :

import d3py
import networkx as nx

import logging
logging.basicConfig(level=logging.DEBUG)

G = nx.Graph()
G.add_edge(1,2)
G.add_edge(1,3)
G.add_edge(3,2)
G.add_edge(3,4)
G.add_edge(4,2)

# use 'with' if you are writing a script and want to serve this up forever
with d3py.NetworkXFigure(G, width=500, height=500) as p:
    p += d3py.ForceLayout()
    p.show()

这篇关于Python相当于D3.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆