I have an undirected graph created by Networkx that I am displaying using pyplot and I want to allow the user to specify the spacing between grid lines. I don't want to manually enter the ticks as this requires knowing the final size of the plot (if there's a way to do this I would like to know) which could vary based on the graph being displayed.
Is there any method that allows you to set the spacing amount? I've looked for a while and can't find anything, thanks.
The code below relates to the creating of the plot not the graph.
#Spacing between each line
intervals = float(sys.argv[1])
nx.draw(displayGraph, pos, node_size = 10)
plt.axis('on')
plt.grid('on')
plt.savefig("test1.png")
I need to find a way to get the grid to have spacing intervals that are defined by the user. I've found ways to do it but it relies on also saying how many grid lines you want and that causes the lines to not be evenly spaced over the plot