Python中的三维箭头图

时间:2014-12-05 23:05:15

标签: python matplotlib 3d

我想在python 2.7中制作一个三维箭袋图。当我从matplotlib站点运行quiver3d_demo.py时,我得到一个类似于以下值的错误:

--------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/Library/Python/2.7/site-packages/ipython-2.0.0_dev-py2.7.egg/IPython/utils/py3compat.pyc in        execfile(fname, *where)
202             else:
203                 filename = fname
--> 204             __builtin__.execfile(filename, *where)

/Users/loisks/Desktop/quiver3d_demo.py in <module>()
 15      np.sin(np.pi * z))
 16 
---> 17 ax.quiver(x, y, z, u, v, w, length=0.1)
 18 
 19 plt.show()

/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.8-intel.egg/matplotlib/axes/_axes.pyc in quiver(self, *args, **kw)
 3802         if not self._hold:
 3803             self.cla()
-> 3804         q = mquiver.Quiver(self, *args, **kw)
 3805         self.add_collection(q, False)
 3806         self.update_datalim(q.XY)

/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.8-intel.egg/matplotlib/quiver.pyc in __init__(self, ax, *args, **kw)
395         """
396         self.ax = ax
--> 397         X, Y, U, V, C = _parse_args(*args)
398         self.X = X
399         self.Y = Y

/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.8-intel.egg/matplotlib/quiver.pyc in _parse_args(*args)
357         nr, nc = 1, U.shape[0]
358     else:
--> 359         nr, nc = U.shape
360     if len(args) == 2:  # remaining after removing U,V,C
361         X, Y = [np.array(a).ravel() for a in args]

ValueError:解压缩的值太多

有什么建议吗?它也不是quiver3d_demo.py - 我无法独立制作3D箭袋图。

1 个答案:

答案 0 :(得分:0)

你可能有一个旧版本的matplotlib。 The matplotlib website表示需要1.4.0或更高版本。