2
後試圖繪製matplotlib subplots時出現KeyError我無法再繪製matplotlib中的subplots。不完全確定是什麼更新並導致此。我的版本是Ubuntu 17.04,matplotlib 2.0.0,python 2.7。有沒有人有一個想法可能是什麼原因?當在最近Ubuntu更新後更新
我只是嘗試:
from matplotlib import pyplot as plt
fig, axs = plt.subplots(3,3)
導致:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 1212, in subplots
ax0 = fig.add_subplot(gs[0, 0], **subplot_kw)
File "/usr/lib/python2.7/dist-packages/matplotlib/figure.py", line 1020, in add_subplot
a = subplot_class_factory(projection_class)(self, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/matplotlib/axes/_subplots.py", line 73, in __init__
self._axes_class.__init__(self, fig, self.figbox, **kwargs)
File "/usr/lib/python2.7/dist-packages/matplotlib/axes/_base.py", line 529, in __init__
self._init_axis()
File "/usr/lib/python2.7/dist-packages/matplotlib/axes/_base.py", line 625, in _init_axis
self.yaxis = maxis.YAxis(self)
File "/usr/lib/python2.7/dist-packages/matplotlib/axis.py", line 676, in __init__
self.cla()
File "/usr/lib/python2.7/dist-packages/matplotlib/axis.py", line 760, in cla
self.reset_ticks()
File "/usr/lib/python2.7/dist-packages/matplotlib/axis.py", line 774, in reset_ticks
self.majorTicks.extend([self._get_tick(major=True)])
File "/usr/lib/python2.7/dist-packages/matplotlib/axis.py", line 2057, in _get_tick
return YTick(self.axes, 0, '', major=major, **tick_kw)
File "/usr/lib/python2.7/dist-packages/matplotlib/axis.py", line 148, in __init__
self.apply_tickdir(tickdir)
File "/usr/lib/python2.7/dist-packages/matplotlib/axis.py", line 512, in apply_tickdir
self._pad = self._base_pad + self.get_tick_padding()
File "/usr/lib/python2.7/dist-packages/matplotlib/axis.py", line 184, in get_tick_padding
return self._size * padding[self._tickdir]
KeyError: u'our
我想這很難找出是什麼原因造成的,所以重新安裝matplotlib可能是必需的。 – ImportanceOfBeingErnest