question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PlotterITK in Jupyter notebook fails to show plot after adding cell arrays and running various filters

See original GitHub issue

Bug 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:open
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
akaszynskicommented, Sep 2, 2021

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.

0reactions
akaszynskicommented, Sep 3, 2021

Also, just want to say thanks for working on pyvista, it truly is a useful library, better than any other python alternative I have seen so far!

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

PlotterITK in Jupyter notebook fails to show plot after adding ...
After adding various cell arrays to a PolyData mesh, and then running various filters, PlotterITK in a jupyter notebook environment fails to ...
Read more >
How to dynamically update a plot in a loop in IPython ...
The code is in one single input cell, using --pylab=inline . I want to use IPython notebook and Pandas to consume a stream...
Read more >
Using itkwidgets with PyVista
PyVista has an interface for visualizing plots in Jupyter. The pyvista.PlotterITK class allows you interactively visualize a mesh within a jupyter notebook.
Read more >
Inline plots do not show up in the jupyter notebook preview
I like the option to offer a different default style sheet, but I am having issues with inline plots, which do not show...
Read more >
pyvista Changelog - PyUp.io
See 3117. ... [FFT Filters](https://github.com/pyvista/pyvista/pull/1953) with complex variables. ... Do not add arrays when plotting by akaszynski in ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found