title: Displaying networkx graph with labels
body: <p>I'm trying to create a labeled graph using networkx but am having trouble getting the nodes and labels to turn out correctly. In short, the labels don't line up over the right nodes and there are some nodes which have no edges when displayed. </p>
  
  <p>First I created a graph, added nodes and edges, then added labels. </p>
  
  <p>The graph data comes from a pandas DataFrame object with two columns, employee and manager names:</p>
  
  <pre><code>                emp_name             mgr_name
  0        Marianne Becker                 None
  1            Evan Abbott      Marianne Becker
  2               Jay Page      Marianne Becker
  3             Seth Reese      Marianne Becker
  4         Maxine Collier      Marianne Becker
  </code></pre>
  
  <p>... </p>
  
  <p>Each node is a name and the edges are the mgr_name to emp_name relationship.</p>
  
  <p>My graph code:</p>
  
  <pre><code>import networkx as nx
  G=nx.DiGraph()
  
  #set layout
  pos=nx.spring_layout(G)
  
  #add nodes
  G.add_nodes_from(df.emp_name)
  G.nodes()
  G.add_node('None')
  
  #create tuples for edges
  subset = df[['mgr_name','emp_name']]
  tuples = [tuple(x) for x in subset.values]
  
  #add edges
  G.add_edges_from(tuples)
  G.number_of_edges()
  
  #draw graph
  import matplotlib.pyplot as plt
  nx.draw(G, labels = True)
  plt.show()
  </code></pre>
  
  <p>Ideally I would have a tree-like structure with employee names as the labels for each of the nodes.</p>
  
  <p>Output image is <img src="https://i.stack.imgur.com/s6VBi.png" alt="enter image description here"></p>