title: Networkx spread nodes and shorten lables
body: <p>I have a networks bipartite graph.
  this is the code:</p>
  
  <pre><code>    G = nx.Graph()
      G.add_nodes_from(USsNames, bipartite=0) # Add the node attribute "bipartite"
      G.add_nodes_from(TCsNames, bipartite=1)
      G.add_weighted_edges_from(compoundArr)
  
      labeldict = {}
  
  
      # Separate by group
      pos = {}
  
      # Update position for node from each group
      pos.update({node: [1, index] for index, node in enumerate(USsNames)})
      pos.update({node: [2, index] for index, node in enumerate(TCsNames)})
  
      nx.draw(G, pos, node_size=10,with_labels=False)
      for p in pos:  # raise text positions
          pos[p][1] += 0.12
  
      # create the dictionary with the formatted labels
      edge_labels = {i[0:2]:'{0:.2f}'.format(i[2]['weight']) for i in G.edges(data=True)}
  
      # add the custom egde labels
      nx.draw_networkx_edge_labels(G, pos, edge_labels=edge_labels,font_size=8)
      nx.draw_networkx_labels(G, pos,font_size=8)
      plt.show()
  </code></pre>
  
  <p>And the output:
  <a href="https://i.stack.imgur.com/3jWKS.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3jWKS.jpg" alt="enter image description here"></a></p>
  
  <p>I need to spread the left nodes so they will spread up, and to shorten the right nodes labels (let's say first four chars).</p>
  
  <p>I tried to find a solution but I didn't make it. Thank you.</p>