title: networkx get nodes position
body: <pre><code>import networkx as nx
  %matplotlib inline
  import matplotlib.pyplot as plt
  
  G2=nx.DiGraph()
  G2.add_node(900,pos=(0,0))
  G2.add_node(901,pos=(1,0))
  G2.add_node(902,pos=(0,1))
  G2.add_node(903,pos=(1,1))
  G2.add_node(904,pos=(0,-1))
  
  nodePos = nx.circular_layout(G2)
  print("nodePos : \n" , nodePos)
  
  nx.draw_networkx(G2, with_labels = True)
  plt.show()
  </code></pre>
  
  <p>The code above creates the graph shown below with the node positions:</p>
  
  <p><a href="https://i.stack.imgur.com/HukPj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HukPj.png" alt="enter image description here"></a></p>
  
  <p>nodePos : </p>
  
  <p>{900: array([ 1.,  0.]), 901: array([ 0.30901699,  0.95105652]), 902: array([-0.80901699,  0.58778525]), 903: array([-0.80901699, -0.58778525]), 904: array([ 0.30901699, -0.95105652])}</p>
  
  <p>Questions:</p>
  
  <p>a) Node 900 is given location of 0, 0 but x seems to be more than 0.8 for this node... Similarly, 904 is given y as -1 but the co-ordinate system does not show -1 anywhere.</p>
  
  <p>b) nx.circular_layout() is supposed to return the location of nodes and that is what I printed in nodePos. But, I do not understand the values printed in nodePos. Why do I see decimal values and that too with negative values.</p>
  
  <p>c) My intent is to get the correct location of nodes so that I can take it and do graph drawing at my end in Qt/Java etc....</p>