I want to draw a square grid with Networkx . I did something like this:
import matplotlib.pyplot as plt import numpy as np import networkx as nx L=4 G = nx.Graph() pos={} for i in np.arange(L*L): pos[i] = (i/L,i%L) nx.draw_networkx_nodes(G,pos,node_size=50,node_color='k') plt.show()
However, the conclusion is just an empty figure. How to resolve this?
In addition, I would like to join the points horizontally and vertically with arrows. The direction of the arrows going from (i,j) to (i+1,j) should depend on the sign of the element i, j of the matrix A , which I already have. How to do it?
source share