【发布时间】:2016-06-20 05:14:48
【问题描述】:
我正在使用以下代码创建pygraphviz 图表。但是有没有可能让它渲染乳胶数学方程(见图 1)?如果没有,是否有替代 python 库可以绘制类似的图形但支持乳胶渲染?
import networkx as nx
from networkx.drawing.nx_agraph import to_agraph
G=nx.DiGraph()
G.add_node(1,color='blue',style='filled',
fillcolor='white',shape='square', label="$3x+2$")
G.add_node(2)
G.add_node(3)
G.add_edge(1, 2)
G.add_edge(1, 3)
G.add_edge(3, 4)
A = to_agraph(G)
A.layout('dot')
A.draw('test1.png')
结果如下图
图一
【问题讨论】:
-
我在PyGraphviz documentation 中没有看到任何对 LaTeX 的引用。您认为这应该可行吗?
-
我明白了!我编辑了问题以使请求不限于 pyGraphviz。换句话说,是否有一个 python 库可以用 Latex 渲染绘制类似的图形?我知道 matplotlib 渲染乳胶,但这样的图表并不好。
-
你最后管理了吗?
标签: python latex networkx pygraphviz