Python networkx中缺少箭头

Python networkx中缺少箭头,python,matplotlib,networkx,Python,Matplotlib,Networkx,对于流程分析,我需要生成流程图。使用networkX时效果非常好。但是,我需要在每个指向到达节点的节点上使用箭头 我搜索了其他已解决的问题,并尝试使用提供的解决方案,但箭头没有显示 谢谢你的帮助 # libraries import pandas as pd import numpy as np import networkx as nx import matplotlib.pyplot as plt # Build a dataframe with your connections df =

对于流程分析,我需要生成流程图。使用networkX时效果非常好。但是,我需要在每个指向到达节点的节点上使用箭头

我搜索了其他已解决的问题,并尝试使用提供的解决方案,但箭头没有显示

谢谢你的帮助

# libraries
import pandas as pd
import numpy as np
import networkx as nx
import matplotlib.pyplot as plt

# Build a dataframe with your connections
df = pd.DataFrame({ 'from':['A', 'B', 'C','A','E','F','E','G','G','D','F'], 
'to':['D' , 'A', 'E','C','A','F','G','D','B','G','C']})

# Build your graph
G=nx.from_pandas_edgelist(df, 'from', 'to')

# Spectral
#nx.draw_spectral(G, with_labels=True, node_size=1500, node_color="skyblue")
nx.draw(G, pos=nx.spectral_layout(G), with_labels=True, node_size=500, 
node_color="skyblue", arrowsize=20, arrowstyle='fancy')
plt.title("Precedence Chart")
这是我从中得到的实际输出:

我真的希望所有人都知道这个解决方案,因为我在过去10个小时里试图解决这个问题。

您需要一个有向图(有向图):

G = nx.from_pandas_edgelist(df, 'from', 'to', create_using=nx.DiGraph())