【问题标题】:3-D Quiver Plot in PythonPython 中的 3-D 箭袋图
【发布时间】:2014-12-05 23:05:14
【问题描述】:

我正在尝试在 python 2.7 中制作 3-D 箭袋图。当我从 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 箭袋图时遇到了麻烦。

【问题讨论】:

    标签: python matplotlib 3d


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2021-05-07
      • 2023-04-06
      • 1970-01-01
      • 2017-02-22
      • 1970-01-01
      • 2016-07-04
      • 2013-10-20
      • 2017-03-17
      • 1970-01-01
      相关资源
      最近更新 更多