Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:49:07

0001 #!/usr/bin/env python 
0002 """
0003 
0004 https://docs.pyvista.org/examples/01-filter/glyphs.html
0005 
0006 """
0007 
0008 import pyvista as pv
0009 from pyvista import examples 
0010 
0011 mesh = examples.download_carotid().threshold(145, scalars="scalars")
0012 mask = mesh['scalars'] < 210
0013 mesh['scalars'][mask] = 0  # null out smaller vectors
0014 
0015 # Make a geometric object to use as the glyph
0016 geom = pv.Arrow()  # This could be any dataset
0017 
0018 # Perform the glyph
0019 glyphs = mesh.glyph(orient="vectors", scale="scalars", factor=0.003, geom=geom)
0020 
0021 # plot using the plotting class
0022 pl = pv.Plotter()
0023 pl.add_mesh(glyphs, show_scalar_bar=False, lighting=False, cmap='coolwarm')
0024 pl.camera_position = [(146.53, 91.28, 21.70),
0025                       (125.00, 94.45, 19.81),
0026                       (-0.086, 0.007, 0.996)]  # view only part of the vector field
0027 cpos = pl.show()
0028