Just draw a very simple 4-node network,
import networkx as nx
import matplotlib.pyplot as plt
G = nx.Graph()
node1 = "116.251.211.248"
node2 = "5.79.100.165"
node3 = "http.anturis.com"
node4 = "s411993.ip-37-187-141.eu"
G.add_node(node1)
G.add_node(node2)
G.add_node(node3)
G.add_node(node4)
G.add_weighted_edges_from([(node1, node2, 0.742345), (node1, node3, 0.916954), (node1, node4, 0.662011), (node1, node4, 0.818537), (node2, node3, 0.947824), (node2, node4, 0.800774), (node3, node4, 0.928537)])
pos=nx.shell_layout(G)
nx.draw(G, pos, with_labels=True)
plt.show()
My problem is the edge labels fall partially outside of the box
I am new to drawing with networkx. How do I add margins to the left and right so the full labels can be shown?
question from:
https://stackoverflow.com/questions/65652083/how-to-display-the-full-naming-of-the-networkx-nodes-when-ploting-the-graph-with 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…