PyVista:AttributeError:“绘图仪”对象没有属性“ren\u-win”

2024-09-28 01:30:40 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用PyVista文档的示例代码:

import pyvista as pv
import matplotlib.pyplot as plt
from pyvista import examples

mesh = examples.load_random_hills()

p = pv.Plotter()
p.add_mesh(mesh, color=True)
p.show()

zval = p.get_image_depth()

plt.figure()
plt.imshow(zval)
plt.colorbar(label='Distance to Camera')
plt.title('Depth image')
plt.xlabel('X Pixel')
plt.ylabel('Y Pixel')
plt.show()

很遗憾,我收到以下错误:

File "C:\Users\user\Anaconda3\lib\site-packages\pyvista\plotting\plotting.py", line 3110, in get_image_depth
    ifilter.SetInput(self.ren_win)

AttributeError: 'Plotter' object has no attribute 'ren_win'

我不知道为什么会发生错误,我找不到有关此问题的任何信息

pv.报告的输出为:

  Date: Mon May 03 14:02:50 2021 Mitteleuropäische Sommerzeit



  Python 3.7.4 (default, Aug  9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)]

           pyvista : 0.29.1
               vtk : 9.0.1
             numpy : 1.16.5
           imageio : 2.6.0
           appdirs : 1.4.4
            scooby : 0.5.7
            meshio : 4.4.1
        matplotlib : 3.3.4
             PyQt5 : 5.9.2
           IPython : 7.8.0
             scipy : 1.3.1
              tqdm : 4.36.1

  Intel(R) Math Kernel Library Version 2019.0.4 Product Build 20190411 for
  Intel(R) 64 architecture applications

Tags: imageimportgetmatplotlibasshowpltexamples

热门问题