PlotterITK in Jupyter notebook fails to show plot after adding cell arrays and running various filters
See original GitHub issueBug Description
After adding various cell arrays to a PolyData mesh, and then running various filters, PlotterITK in a jupyter notebook environment fails to display the plot. There is no crash report, but the plotting window simply does not show.
Reducing the number of cell arrays in the code bellow seems to prevent the bug, and so does removing at least one of the add_mesh() calls.
After running the code once in a new jupyter notebook seems to work fine, but running the same cell again will produce the bug. After running the same code in the same cell at least 7 times, PlotterITK() will fail to display anything in any other cell.
To Reproduce
Running the following code at least twice in the same jupyter cell will recreate the bug.
import pyvista as pv
import numpy as np
sphere = pv.Sphere()
#Add a bunch of cell arrays to the sphere
numberOfCellArrays = 5
for i in range(numberOfCellArrays):
sphere['randomArray'+str(i)] = np.random.random(sphere.cell_normals.shape[0])
#Run the particular filters that are causing the issue
randomIndex = np.random.random(sphere.faces.shape[0]) > 0.5
randomCells = sphere.extract_cells(np.argwhere(randomIndex))
randomEdges = randomCells.extract_feature_edges(non_manifold_edges=False, feature_edges=False, manifold_edges=False)
randomCellsSubdivided = pv.PolyData(randomCells.points, randomCells.cells).subdivide(3)
#Attempt to plot results
plotter = pv.PlotterITK()
plotter.add_mesh(sphere)
plotter.add_mesh(randomCells, color='b')
plotter.add_mesh(randomEdges, color='r')
plotter.add_mesh(randomCellsSubdivided.points, color='cyan')
plotter.show()
After running the above code at least 7 times in a jupyter notebook cell, the following PlotterITK() window will also fail to show.
plotter = pv.PlotterITK()
plotter.add_mesh(pv.Plane())
plotter.show()
System Information:
I am running pyvista in the following docker container:
docker pull suoarski/earthinit
--------------------------------------------------------------------------------
Date: Wed Sep 01 04:17:45 2021 UTC
OS : Linux
CPU(s) : 12
Machine : x86_64
Architecture : 64bit
Environment : Jupyter
GPU Vendor : VMware, Inc.
GPU Renderer : llvmpipe (LLVM 10.0.0, 256 bits)
GPU Version : 3.3 (Core Profile) Mesa 20.0.8
Python 3.6.9 (default, Jan 26 2021, 15:33:00) [GCC 8.4.0]
pyvista : 0.31.3
vtk : 8.1.2
numpy : 1.19.5
imageio : 2.9.0
appdirs : 1.4.4
scooby : 0.5.7
meshio : 4.4.3
matplotlib : 3.3.4
IPython : 7.16.1
colorcet : 1.0.0
ipyvtklink : 0.2.1
scipy : 1.5.4
itkwidgets : 0.32.0
tqdm : 4.60.0
--------------------------------------------------------------------------------
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
There’s a large feature that will really improve plotting within jupyterlab, but it’s a work in progress that’s taking a while: https://github.com/pyvista/pyvista/pull/1557
I’d checkout that PR.
Thanks!