【问题标题】:ValueError: too many boolean indicesValueError:布尔索引过多
【发布时间】:2013-01-20 22:50:24
【问题描述】:

我正在尝试使用 matpolid 可视化一些数据,但出现此错误

 File "C:\Python27\lib\site-packages\matplotlib\mlab.py", line 2775, in griddata
tri = delaunay.Triangulation(x,y)
 File "C:\Python27\lib\site-packages\matplotlib\delaunay\triangulate.py", line 98, in __init__
duplicates = self._get_duplicate_point_indices()
 File "C:\Python27\lib\site-packages\matplotlib\delaunay\triangulate.py", line 137, in _get_duplicate_point_indices
return j_sorted[mask_duplicates]
ValueError: too many boolean indices

当我调用函数时会发生这种情况

 data=griddata(self.dataX,self.dataY,self.dataFreq,xi,yi)

有谁知道我为什么会出现这个错误?我认为它带有参数,但我可以弄清楚是什么

【问题讨论】:

  • 该错误与return 行有关。 j_sorted 是什么,mask_duplicates 是什么? j_sorted 的面具似乎形状错误(在某些维度上更大)。
  • 我更新了错误信息,但 j_sorted 和 mask_duplicates 不是我使用的变量。我想这是 matplotlib 中的东西
  • 你看过the docs吗?它说安装mpl_toolkits.natgrid 可能会有所帮助,因为默认算法是不稳定的。

标签: python numpy matplotlib


【解决方案1】:

可能值得更新您的 matplotlib。三角测量代码已经进入 v1.3.0。

matplotlib v1.3.0 的新增功能页面可以在http://matplotlib.org/users/whats_new.html#triangular-grid-interpolation找到

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-18
    • 1970-01-01
    • 2020-03-25
    • 2019-06-18
    • 2017-04-25
    • 1970-01-01
    相关资源
    最近更新 更多