2016-01-21 148 views
1

當我嘗試繪製一個三維散點圖per the instructions here,我得到以下錯誤:IPython中無法繪製3D散點圖

In [10]: Traceback (most recent call last): 
    File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_qt5agg.py", line 176, in __draw_idle_agg 
    FigureCanvasAgg.draw(self) 
    File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_agg.py", line 474, in draw 
    self.figure.draw(self.renderer) 
    File "/usr/local/lib/python2.7/dist-packages/matplotlib/artist.py", line 61, in draw_wrapper 
    draw(artist, renderer, *args, **kwargs) 
    File "/usr/local/lib/python2.7/dist-packages/matplotlib/figure.py", line 1159, in draw 
    func(*args) 
    File "/usr/local/lib/python2.7/dist-packages/mpl_toolkits/mplot3d/axes3d.py", line 271, in draw 
    for col in self.collections] 
    File "/usr/local/lib/python2.7/dist-packages/mpl_toolkits/mplot3d/art3d.py", line 455, in do_3d_projection 
    xs, ys, zs = self._offsets3d 
AttributeError: 'Path3DCollection' object has no attribute '_offsets3d' 

If you suspect this is an IPython bug, please report it at: 
    https://github.com/ipython/ipython/issues 
or send an email to the mailing list at [email protected] 

You can print a more detailed traceback right now with "%tb", or use "%debug" 
to interactively debug it. 

Extra-detailed tracebacks for bug-reporting purposes can be enabled via: 
    %config Application.verbose_crash=True 

以前我使用PyQt4的時候得到這個錯誤。我花了幾個小時安裝PyQt5(在我的Ubuntu版本上很難)。現在開始ipython與

ipython --pylab='qt5' 

我預計它會工作,但再次嘗試繪圖時得到相同的錯誤信息。

請注意,當我調用scatter方法時會發生這種情況。然後,直到我結束這個數字,每次我在ipython中輸入時它都會繼續給出相同的回溯。

任何想法,我可能做錯了什麼?

+0

您是否使用'from mpl_toolkits.mplot3d import Axes3D'和'ax = fig.add_subplot(111,projection ='3d')'? (如果你顯示導致錯誤的所有命令,這將會很有幫助。) – unutbu

回答