Skip to content

Instantly share code, notes, and snippets.

@mrklein
mrklein / vtk-unstructured-grid-plot.py
Last active September 22, 2022 12:07
Read, cut and plot VTK file with python-vtk and matplotlib
%matplotlib inline
filename = 'vtk-plot_0.vtk'
import vtk
from numpy import zeros
import matplotlib.pyplot as plt
reader = vtk.vtkUnstructuredGridReader()
reader.SetFileName(filename)
@mrklein
mrklein / plot_vtk.py
Last active December 17, 2024 13:09
Plot VTK with matplotlib
#!/usr/bin/env python
import os
import numpy as np
import vtk
import matplotlib.pyplot as plt
def load_velocity(filename):
if not os.path.exists(filename):