I have a Dataframe that links Employee
to Supervisor
and I am trying to create a twopi
Graphviz to create a radial org chart. I am having issues where some of the nodes overlap. Here is my current code:
from networkx.drawing.nx_agraph import to_agraph
G = nx.from_pandas_edgelist(df, source='Supervisor', target='Employee',create_using=nx.DiGraph)
A = to_agraph(G)
A.graph_attr['splines']='curved'
A.graph_attr['ranksep']="4"
for node in A:
# Style node to have color
n = A.get_node(node)
n.attr['style']='filled'
n.attr['fillcolor'] = '#ab9beb'
A.layout('twopi')
A.draw('layouts/twopi.png')
Here is what the output looks like:
What would be the best to show this without having the nodes of employee names overlap. Setting nodesep
does not seem to affect anything