title: Position/showing of labels with networkx + graphviz
body: <p>I've achieved the following plot with a combination networkx and graphviz:</p>
  
  <p><a href="https://i.stack.imgur.com/Pq5c0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Pq5c0.png" alt="enter image description here"></a></p>
  
  <p>I'm very happy with the result. In the plot you can identify what I call aggregation nodes: those are the latest green ones (where all the green nodes converge) one hop before the orange ones.</p>
  
  <p>What I'd like to achieve is the following:</p>
  
  <p>1) Put labels on the sides of the nodes. As you can see, the labels are over them and it's difficult to read;</p>
  
  <p>2) Only show labels on the aggregation nodes and the orange ones.</p>
  
  <p>This is how I get to plot the diagram.</p>
  
  <pre><code># We create the graph
  G = nx.DiGraph()
  
  # We add nodes and edges
  G.add_nodes_from(nodes)
  G.add_edges_from(edges)
  
  # We establish attributes to nodes
  nx.set_node_attributes(G,nodesAttrDic)
  
  # Tune plot
  nodeFontSize    = 10
  nodeSize        = 20
  nodeColorList   = list(getNodeColor(nodesAttrDic,G.nodes()))
  edgeColorList   = getEdgeColor(G.edges())
  
  # Graphiz tunning
  prog = 'dot'
  args = '-Gnodesep=1 -Granksep=2 -Gpad=0.5 -Grankdir=TD'
  root = None
  pos  = graphviz_layout(G, prog = prog, root = root, args = args)
  
  nx.draw(G,
      pos         = pos,
      with_labels = True, 
      node_color  = nodeColorList, 
      edge_color  = edgeColorList, 
      font_size   = nodeFontSize,
      node_size   = nodeSize,)
  
  plt.show()
  </code></pre>
  
  <p>Any ideas on how to do this? </p>
  
  <p>Thanks!</p>
  
  <p>Lucas</p>