I do some manipulations on graphs/networks and want to plot the results and save them to a pdf (actually the format does not really matter, but I think pdf is fine).
I give you a minimal example:
import networkx as nx
from matplotlib import pyplot as plt
g=nx.erdos_renyi_graph(20,.2,directed=True)
nx.draw_networkx(g)
#plt.show()
plt.savefig('so_example.pdf', bbox_inches='tight')
The result is OK, except that there is a thick black frame around the picture:
Does anybody know a way to prevent this frame?
CodePudding user response:
You could use plt.box(False)
. See code below:
import networkx as nx
from matplotlib import pyplot as plt
g=nx.erdos_renyi_graph(20,.2,directed=True)
nx.draw_networkx(g)
plt.box(False)
plt.show()
And the output gives: