I am using NetworkX and Matplotlib to draw nodes, but the nodes are sometimes being cut off at the edge of the graphic. Is there a setting to increase the margins or prevent them from being cut off?
Image: Nodes being cut off at the edge of the graphic
Example program:
import networkx as nx
import matplotlib.pyplot as plt
import numpy as np
adjacency_matrix = np.array([[1,0,0,0,0,0,1,0],[0,1,1,1,1,0,0,0],[0,1,1,0,0,0,0,0],[0,1,0,1,0,0,0,0],
[0,1,0,0,1,1,0,0],[0,0,0,0,1,1,1,1],[1,0,0,0,0,1,1,0],[0,0,0,0,0,1,0,1]])
nx_graph = nx.from_numpy_matrix(adjacency_matrix)
pos = nx.networkx.kamada_kawai_layout(nx_graph)
nx.draw_networkx_nodes(nx_graph, pos, node_color="#000000", node_size=10000)
nx.draw_networkx_edges(nx_graph, pos, color="#808080", alpha=0.2, width=2.0)
plt.axis('off')
plt.tight_layout()
plt.show()