2017-04-06 1 views
1

최근에 matplotlib를 다시 설치했으며 networkx를 사용하여 그래프 출력을 생성하는 몇 달 전 작성한 코드가 오류를 출력하고 있음을 알았습니다. 콘솔. 내가 얻는 오류는 아래에 자세히 나와있다.NetworkX 버그 Matplotlib 함께

matplot lib

내 질문은 :

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입니다 :

matplotlib가 최근에 으로 업데이트 되었기 때문일 수 있습니다. networkx는 사물을 사용하고있는 것으로 보입니다. 그게 구식입니까? (Matplotlib는 내가 믿는 지난 달에 업데이트되었습니다). 내 코드에서 일 수 있습니까? 이러한 오류를 방지하기 위해 할 수있는 일이 있습니까?

감사합니다.

답변

2

matlplotlib의 최신 릴리스 날짜는 모든 얻고, 메시지 2월 20일 2017

networkx의 최신 릴리스 날짜는 제외하고 pydotplus 메시지에서 2017

년 1 월 11입니다 가까운 장래에 일부 현재 명령이 작동하지 않을 것이라는 경고가되는 것처럼 보입니다. (그리고 앞으로 명령을 액세스하는 방법에 대한 지시 사항을 제공합니다.) 나는 pydotplus에 대해 몰라요. Matplotlib과 관련이 없다고 생각합니다.

예, 업데이트 때문입니다. 그것은 문제가되지 않지만, 아마 networkx의 다음 버전은 새로운 matplotlib로 작업해야 할 것입니다.

나는 당신이이 질문에 이러한 경고를 제거하기위한 지침을 찾을 것으로 예상 : How to suppress matplotlib warning?

+0

감사합니다 - 그들은 매우 짜증나. 그들을 억압 할 방법이 있는지 아십니까? –

+0

@LukeCollins 이미 찾지 못했다면 방금 추가 한 링크를 참조하십시오. – Joel

+0

안녕하세요 조엘, 고맙습니다. :) –