import networkx as nx
import matplotlib.pyplot as plt
G=nx.Graph()
G.add_edge(1,2)
G.add_edge(2,3)
nx.draw(G,with_labels=True)
plt.show()
Click Run or press shift + ENTER to run code
/dev/fiddle.py:320: UserWarning: This figure includes Axes that are not compatible with tight_layout, so results might be incorrect.
matplotlib.pyplot.tight_layout()