Matplotlib 的 NetworkX 错误
NetworkX Bug with Matplotlib
我最近重新安装了 matplotlib,我注意到我几个月前编写的代码(功能齐全)使用 networkx 生成图形输出,现在在控制台上输出错误.我得到的错误详述如下。
C:\Python36\lib\site-packages\networkx\drawing\nx_pylab.py:126: 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.
b = plt.ishold()
C:\Python36\lib\site-packages\networkx\drawing\nx_pylab.py:138: 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.
plt.hold(b)
C:\Python36\lib\site-packages\matplotlib\__init__.py:917: UserWarning: axes.hold is deprecated. Please remove it from your matplotlibrc and/or style files.
warnings.warn(self.msg_depr_set % key)
C:\Python36\lib\site-packages\matplotlib\rcsetup.py:152: UserWarning: axes.hold is deprecated, will be removed in 3.0
warnings.warn("axes.hold is deprecated, will be removed in 3.0")
Traceback (most recent call last):
File "C:\Users\lukec\Dropbox\University\Year 2 Semester 2\ICS2210 Data Structures and Algorithms II\Assignment\launcher.py", line 33, in <module>
graph.draw()
File "C:\Users\lukec\Dropbox\University\Year 2 Semester 2\ICS2210 Data Structures and Algorithms II\Assignment\graph.py", line 122, in draw
nx.drawing.nx_pydot.write_dot(G, "graph.dot")
File "<decorator-gen-232>", line 2, in write_dot
File "C:\Python36\lib\site-packages\networkx\utils\decorators.py", line 220, in _open_file
result = func(*new_args, **kwargs)
File "C:\Python36\lib\site-packages\networkx\drawing\nx_pydot.py", line 43, in write_dot
P=to_pydot(G)
File "C:\Python36\lib\site-packages\networkx\drawing\nx_pydot.py", line 175, in to_pydot
import pydotplus
ModuleNotFoundError: No module named 'pydotplus'
程序仍然可以正常运行,但是,我得到了正确的计算和图形输出,就像以前一样,唯一的区别是 matplotlib 的外观不同:
我的问题是:
Could this be due to the fact that matplotlib has recently been
updated, and networkx seems to be using things from it which are
outdated? (Matplotlib was updated last month I believe). Could it be
from my code? Is there anything I can do to prevent these errors?
感谢任何帮助。
matlplotlib 的最新发布日期是 2017 年 2 月 20 日。
networkx 的最新发布日期是 2017 年 1 月 11 日
除了 pydotplus
消息之外,您收到的所有消息似乎都是警告,在不久的将来某些当前命令将无法使用(并提供有关如何正确访问这些未来命令的说明现在)。我不知道 pydotplus
。我认为这与 matplotlib 无关。
是的,这是因为更新。这应该不是问题,但也许下一个版本的 networkx 需要使用新的 matplotlib。
我相信您会在这个问题中找到消除这些警告的说明:
我最近重新安装了 matplotlib,我注意到我几个月前编写的代码(功能齐全)使用 networkx 生成图形输出,现在在控制台上输出错误.我得到的错误详述如下。
C:\Python36\lib\site-packages\networkx\drawing\nx_pylab.py:126: 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.
b = plt.ishold()
C:\Python36\lib\site-packages\networkx\drawing\nx_pylab.py:138: 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.
plt.hold(b)
C:\Python36\lib\site-packages\matplotlib\__init__.py:917: UserWarning: axes.hold is deprecated. Please remove it from your matplotlibrc and/or style files.
warnings.warn(self.msg_depr_set % key)
C:\Python36\lib\site-packages\matplotlib\rcsetup.py:152: UserWarning: axes.hold is deprecated, will be removed in 3.0
warnings.warn("axes.hold is deprecated, will be removed in 3.0")
Traceback (most recent call last):
File "C:\Users\lukec\Dropbox\University\Year 2 Semester 2\ICS2210 Data Structures and Algorithms II\Assignment\launcher.py", line 33, in <module>
graph.draw()
File "C:\Users\lukec\Dropbox\University\Year 2 Semester 2\ICS2210 Data Structures and Algorithms II\Assignment\graph.py", line 122, in draw
nx.drawing.nx_pydot.write_dot(G, "graph.dot")
File "<decorator-gen-232>", line 2, in write_dot
File "C:\Python36\lib\site-packages\networkx\utils\decorators.py", line 220, in _open_file
result = func(*new_args, **kwargs)
File "C:\Python36\lib\site-packages\networkx\drawing\nx_pydot.py", line 43, in write_dot
P=to_pydot(G)
File "C:\Python36\lib\site-packages\networkx\drawing\nx_pydot.py", line 175, in to_pydot
import pydotplus
ModuleNotFoundError: No module named 'pydotplus'
程序仍然可以正常运行,但是,我得到了正确的计算和图形输出,就像以前一样,唯一的区别是 matplotlib 的外观不同:
我的问题是:
Could this be due to the fact that matplotlib has recently been updated, and networkx seems to be using things from it which are outdated? (Matplotlib was updated last month I believe). Could it be from my code? Is there anything I can do to prevent these errors?
感谢任何帮助。
matlplotlib 的最新发布日期是 2017 年 2 月 20 日。
networkx 的最新发布日期是 2017 年 1 月 11 日
除了 pydotplus
消息之外,您收到的所有消息似乎都是警告,在不久的将来某些当前命令将无法使用(并提供有关如何正确访问这些未来命令的说明现在)。我不知道 pydotplus
。我认为这与 matplotlib 无关。
是的,这是因为更新。这应该不是问题,但也许下一个版本的 networkx 需要使用新的 matplotlib。
我相信您会在这个问题中找到消除这些警告的说明: