Python Graphs: Latex Math rendering of node labels
<p>I am using the following code to create a <code>pygraphviz</code> graph. But is it possible to make it render latex math equations (see Figure 1)?  If not, is there an alternative python library that plots similar graphs but supports latex rendering ? </p>

<pre><code>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')
</code></pre>

<p>This results in the following figure</p>

<p><a href="https://i.stack.imgur.com/KPNgF.png" rel="noreferrer"><img src="https://i.stack.imgur.com/KPNgF.png" alt="Figure 1"></a></p>

<p>Figure 1</p>