相当于 D3.js 的 Python

标签 python graph d3.js graph-tool

谁能推荐一个可以进行交互式图形可视化的 Python 库?

我特别想要 d3.js 之类的东西但对于 python 来说,理想情况下它也是 3D 的。

我看过:

  • NetworkX - 它只做 Matplotlib 绘图,而且那些似乎是 2D 的。我没有看到任何类型的交互性,就像 d3.js 提供的那样,比如拉节点。
  • graph-tool - 它只绘制 2D 绘图并且具有非常慢的交互式图表。

最佳答案

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

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()

关于相当于 D3.js 的 Python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12977517/

相关文章:

python - 从一天的开始按 n 天对 Pandas DataFrame 进行分组

Python Kivy Canvas 不会更新

testing - 具有图形输出的 Lua 测试器?

javascript - d3.js v4 : Trying to fix a subset of graph nodes

javascript - D3 : enter(), 鼠标悬停/鼠标悬停时 exit()

python - 是否可以使用 PYQT5 中的元素创建一个类

python - 无法使用 Python 产生正确的值

algorithm - 寻找最低成本路径的非有向图算法

javascript - Highcharts 柱形图有背景颜色吗?

d3.js - 时间轴: Remove scale points with no data