networkx の draw だとコケて、draw_networkx だと動く。networkx のちゃんとまとまった解説サイトが見つけにくい。

>>> import matplotlib.pyplot as plt
>>> import networkx as nx
>>> G = nx.Graph()
>>> G.add_edge(1,2)
>>> G.add_edge(1,3)
>>> nx.draw(G)

Warning (from warnings module):
  File "/home/idehara/.local/lib/python3.6/site-packages/networkx/drawing/nx_pylab.py", line 126
    b = plt.ishold()
MatplotlibDeprecationWarning: pyplot.hold is deprecated.
    Future behavior will be consistent with the long-time default:
    plot commands add elements without first clearing the
    Axes and/or Figure.

Warning (from warnings module):
  File "/home/idehara/.local/lib/python3.6/site-packages/networkx/drawing/nx_pylab.py", line 138
    plt.hold(b)
MatplotlibDeprecationWarning: pyplot.hold is deprecated.
    Future behavior will be consistent with the long-time default:
    plot commands add elements without first clearing the
    Axes and/or Figure.

Warning (from warnings module):
  File "/usr/lib64/python3.6/site-packages/matplotlib/__init__.py", line 920
    warnings.warn(self.msg_depr_set % key)
UserWarning: axes.hold is deprecated. Please remove it from your matplotlibrc and/or style files.

Warning (from warnings module):
  File "/usr/lib64/python3.6/site-packages/matplotlib/rcsetup.py", line 152
    warnings.warn("axes.hold is deprecated, will be removed in 3.0")
UserWarning: axes.hold is deprecated, will be removed in 3.0
>>> nx.draw_networkx(G)
>>> plt.show()

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です