I have a python code to generate a random graph of 300 nodes and 200 edges and display it
import networkx as nx
import matplotlib.pyplot as plt
G = nx.gnm_random_graph(300,200)
graph_pos = nx.spring_layout(G)
nx.draw_networkx_nodes(G, graph_pos, node_size=10, node_color='blue', alpha=0.3)
nx.draw_networkx_edges(G, graph_pos)
nx.draw_networkx_labels(G, graph_pos, font_size=8, font_family='sans-serif')
plt.show()
However, because there are too many nodes , I need to have more pixels so that I can zoom in and save it.
If I put
plt.figure(figsize=(18,18))
before showing, then the nodes and edges don't appear. What is the problem and How do I fix this?