2014-10-02 67 views
0

我正在嘗試一些熊貓繪製的東西here。然而,每當我嘗試使用下面的命令來設置樣式選項的建議熊貓繪製iPython導致錯誤的選項

pd.options.display.mpl_style = 'default' 

我收到以下錯誤

In [6]: Traceback (most recent call last): 
    File "/Users/seanwhipple/py27/lib/python2.7/site-packages/matplotlib/artist.py", line 59, in draw_wrapper 
    draw(artist, renderer, *args, **kwargs) 
    File "/Users/seanwhipple/py27/lib/python2.7/site-packages/matplotlib/figure.py", line 1079, in draw 
    func(*args) 
    File "/Users/seanwhipple/py27/lib/python2.7/site-packages/matplotlib/artist.py", line 59, in draw_wrapper 
    draw(artist, renderer, *args, **kwargs) 
    File "/Users/seanwhipple/py27/lib/python2.7/site-packages/matplotlib/axes/_base.py", line 2092, in draw 
    a.draw(renderer) 
    File "/Users/seanwhipple/py27/lib/python2.7/site-packages/matplotlib/artist.py", line 59, in draw_wrapper 
    draw(artist, renderer, *args, **kwargs) 
    File "/Users/seanwhipple/py27/lib/python2.7/site-packages/matplotlib/axis.py", line 1105, in draw 
    renderer) 
    File "/Users/seanwhipple/py27/lib/python2.7/site-packages/matplotlib/axis.py", line 1054, in _get_tick_bboxes 
    extent = tick.label1.get_window_extent(renderer) 
    File "/Users/seanwhipple/py27/lib/python2.7/site-packages/matplotlib/text.py", line 741, in get_window_extent 
    bbox, info, descent = self._get_layout(self._renderer) 
    File "/Users/seanwhipple/py27/lib/python2.7/site-packages/matplotlib/text.py", line 311, in _get_layout 
    ismath=False) 
    File "/Users/seanwhipple/py27/lib/python2.7/site-packages/matplotlib/backends/backend_macosx.py", line 166, in get_text_width_height_descent 
    six.text_type(s), family, size, weight, style) 
TypeError: bad argument type for built-in operation 

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 

在經過我的測試代碼的工作我已經確定,當我加入pd.options線產生錯誤。有什麼理由呢?我已經更新numpypandasmatplotlib到其最新版本使用pip --upgrade

+0

不確定究竟是什麼導致了錯誤,但最新版本的matplotlib添加了一個[樣式包](http://matplotlib.org/users/whats_new.html#style-package-added),它完成了很多熊貓選項的功能。 – TomAugspurger 2014-10-02 01:43:41

+0

關於如何使用它的任何提示? – sedavidw 2014-10-02 01:50:13

回答

2

這是相同的問題https://github.com/matplotlib/matplotlib/issues/3470的問題是,由於rcparams驗證了微妙的監督,什麼MacOSX的後端預計將名單unicode對象是一個字節串對象的列表,因此事情爆炸了。

最簡單的解決方法是使用除macosx後端之外的任何其他後端。有一個補丁正在進行(https://github.com/matplotlib/matplotlib/pull/3564),但它已變成其他泥濘的微妙錯誤。

仍試圖確定這是否需要在1.4.1上成爲攔截器。

+0

感謝您的回答,你知道什麼是沒有這個問題的matplotlib的最新版本? – sedavidw 2014-10-02 13:35:25

+0

1.3.1(這是六前化)和1.4.1出現時('很快',我認爲這是一個阻斷劑)。如果你是遊戲,從這個分支的源代碼編譯(https://github.com/matplotlib/matplotlib/pull/3564)會很棒(我沒有一個mac來測試)。 – tacaswell 2014-10-02 13:40:02