32 Using ipyvtk with PyVista for Visualization#

Set File Paths and download Tutorial Data#

If you downloaded the latest GemGIS version from the Github repository, append the path so that the package can be imported successfully. Otherwise, it is recommended to install GemGIS via pip install gemgis and import GemGIS using import gemgis as gg. In addition, the file path to the folder where the data is being stored is set. The tutorial data is downloaded using Pooch (https://www.fatiando.org/pooch/latest/index.html) and stored in the specified folder. Use pip install pooch if Pooch is not installed on your system yet.

[1]:
import gemgis as gg

file_path ='data/32_using_ipyvtk_with_pyvista_for_visualization/'
WARNING (theano.configdefaults): g++ not available, if using conda: `conda install m2w64-toolchain`
C:\Users\ale93371\Anaconda3\envs\test_gempy\lib\site-packages\theano\configdefaults.py:560: UserWarning: DeprecationWarning: there is no c++ compiler.This is deprecated and with Theano 0.11 a c++ compiler will be mandatory
  warnings.warn("DeprecationWarning: there is no c++ compiler."
WARNING (theano.configdefaults): g++ not detected ! Theano will be unable to execute optimized C-implementations (for both CPU and GPU) and will default to Python implementations. Performance will be severely degraded. To remove this warning, set Theano flags cxx to an empty string.
WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions.
[2]:
gg.download_gemgis_data.download_tutorial_data(filename="32_using_ipyvtk_with_pyvista_for_visualization.zip", dirpath=file_path)
Downloading file '32_using_ipyvtk_with_pyvista_for_visualization.zip' from 'https://rwth-aachen.sciebo.de/s/AfXRsZywYDbUF34/download?path=%2F32_using_ipyvtk_with_pyvista_for_visualization.zip' to 'C:\Users\ale93371\Documents\gemgis\docs\getting_started\tutorial\data\32_using_ipyvtk_with_pyvista_for_visualization'.

Load Data#

[3]:
import pyvista as pv

mesh1 = pv.read(file_path + 'mesh1.vtk')
mesh2 = pv.read(file_path + 'mesh2.vtk')

Plotting Data with PyVista#

[7]:
p = pv.Plotter(notebook=True)

p.add_mesh(mesh1)
p.add_mesh(mesh2)

p.set_background('white')
p.show_grid(color='black')
p.show()
../../_images/getting_started_tutorial_32_using_ipyvtk_with_pyvista_for_visualization_7_0.png
[11]:
meshes = pv.MultiBlock([mesh1, mesh2])
[ ]:
p = pv.Plotter(notebook=False)

p.add_mesh_clip_plane(meshes)

p.set_background('white')
p.show_grid(color='black')
p.show()