我正在尝试一些这里上显示的熊猫图样。但是,每当我按照建议使用以下命令设置样式选项时,
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 ipython-dev@scipy.org
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行时,会生成错误。有什么原因吗?我已经将numpy、pandas和matplotlib更新为使用pip --upgrade的最新版本。
发布于 2014-10-02 02:27:06
这是与https://github.com/matplotlib/matplotlib/issues/3470相同的问题--问题是,由于rcparams验证中的一个微妙的疏忽,macOSX后端期望的是一个由字节字符串对象组成的列表,因此事情就发生了变化。
最简单的方法是使用macosx后端以外的任何其他后端。正在进行中的修补程序(https://github.com/matplotlib/matplotlib/pull/3564),但它已经变成了一个泥潭的其他微妙的错误。
仍在试图决定这是否需要在1.4.1上成为一个阻滞剂。
https://stackoverflow.com/questions/26153254
复制相似问题