PyVista is a helper module for the Visualization Toolkit (VTK) that takes a different approach on interfacing with VTK through NumPy and direct array access.
Questions tagged [pyvista]
147 questions
1
vote
1 answer
Find cells from vertices in pyvista PolyData mesh
I have a PolyData mesh, and I am trying to color some cells that contain given vertices. However, I need an efficient way to to this.
For instance, this works, but it is way too slow for a large mesh:
import pyvista as pv
import numpy as np
mesh =…

Zep
- 1,541
- 13
- 21
1
vote
1 answer
PyVista mesh triangulation - vertex indices
I have a triangulated mesh that I generated with the Delaunay 3D function in PyVista. I would like to calculate the surface area of the mesh adding up the areas of all the triangles. Is there a way to obtain the indices of the simplices triangles…

Alex
- 995
- 12
- 25
1
vote
0 answers
Pymeshfix/Pyvista unexpected cleaning result
I try to repair the following mesh (a dental bridge):
Within the mesh are some holes and also intersecting triangles. I use the function tin.small_boundaries() and if i detect intersecting triangles also tin.clean(max_iters=10, inner_loops=3).…

marxcell
- 69
- 6
1
vote
0 answers
Candlestick chart on pyvista
I've spent the day trying to familiarize myself with pyvista through example text and I have a long way to go but there's a specific thing I want to do with pyvista that I can't seem to figure out.
I want to make a candlestick chart for stocks and…

thatoneguy
- 59
- 1
- 11
1
vote
0 answers
openCV solvePnP returns wrong results
With cv2.solvePnP I try to do pose a estimation in pyvista, which is a python wrapper for vtk.
The results of solvePnP seem wrong to me, i.e. the resulting translation and rotation. For simplicity I try to "undo" a translation of the camera. I…

dba
- 325
- 1
- 6
- 16
1
vote
1 answer
PyVista: Update PolyData with additional points
I would like to add points (and cells) to the pyvista.PolyData in the plotter. I tried using the Plotter.update_coordinates function however this is only useful for point data with equal size:
import numpy as np
import pyvista as pv
import…

blaz
- 4,108
- 7
- 29
- 54
1
vote
0 answers
Using Pyvista 3D and 2D plots in PYQT5
I am trying to plot 3D and 2D plots using Pyvista, I have been able to make the 3D plot work no issues. Once I add the 2D plot I have the following errors:
I have to add an interactor widget to gridLayout_8, when I do the original size changes and…

cwdesignsvs
- 77
- 7
1
vote
1 answer
How to use mgrid to interpolate between a rectangle and a circle
I am trying to create a 3D surface that has a 1/4 rectangle for the exterior and 1/4 circle for the interior. I had help before to create the 3D surface with an ellipse as an exterior but I cannot do this for a rectangle for some reason. I have done…

cwdesignsvs
- 77
- 7
1
vote
1 answer
3D Surface in PyVista is not generating correctly. I am trying to avoid closing the center opening but can't figure out how to do so
Issue with PyVista filling opening that shouldn't be filled
import math
import numpy as np
import matplotlib as mpl
import pyvista as pv
mpl.use("Qt5Agg")
mpl.rcParams["toolbar"] = "None" # Get rid of toolbar
def xy_waveguide_contour(throat,…

cwdesignsvs
- 77
- 7
1
vote
1 answer
Panel (PyVista) : Jupyter notebook display problem
I am using PyVista on Jupyter notebook (in Anaconda in Windows) and using the Panel library but no result is displayed but the code ran fine.
import flopy as fl
import numpy as np
import matplotlib as mplt
import geopandas as gpd
import…

Mélanie177
- 11
- 1
1
vote
1 answer
Color point by distance from origin
Here is a Hopf torus created in Python with PyVista:
import numpy as np
import pyvista as pv
A = 0.44
n = 3
def Gamma(t):
alpha = np.pi/2 - (np.pi/2-A)*np.cos(n*t)
beta = t + A*np.sin(2*n*t)
return np.array([
np.sin(alpha) *…

Stéphane Laurent
- 75,186
- 15
- 119
- 225
1
vote
1 answer
How to smooth pyvista.StructuredGrid?
Here is a Hopf torus made in Python with PyVista:
import numpy as np
import pyvista as pv
A = 0.44
n = 3
def Gamma(t):
alpha = np.pi/2 - (np.pi/2-A)*np.cos(n*t)
beta = t + A*np.sin(2*n*t)
return np.array([
np.sin(alpha) *…

Stéphane Laurent
- 75,186
- 15
- 119
- 225
1
vote
1 answer
Adding pyvista into pyqt widget?
I'm trying to implement a pyvista plot
import sys
from qtpy import QtWidgets
from qtpy.QtWidgets import QMainWindow
import numpy as np
import pyvista as pv
from pyvistaqt import QtInteractor
class MainWindow(QMainWindow):
def __init__(self,…

thatoneguy
- 59
- 1
- 11
1
vote
2 answers
Update PyVista plotter with new scalars
Trying to update the grid data with a new scalar I am not able to update the plot
I have reported the issues to PyVista support as well: https://github.com/pyvista/pyvista-support/issues/501
I am able to have a figure update by using this example:…

Red Sparrow
- 387
- 1
- 5
- 17
1
vote
0 answers
How do I plot sRGB gamut slice with colorio?
I want to plot the Mac Adam ellipses in different color spaces. For convenience I would like to show the possible sRGB Gamut too. Just like in this image (which is made with the colorio package too):
Here I encountered two problems:
I don't know…

Meredith Hesketh Fortescue
- 140
- 1
- 9