I have an input data with 6 columns where the three first are the position x, y, z and the rest are vector components of a vector field. I could only make a 3d graph with quiver3d of the mayavi library in python (x,y,z,px,py,pz) creating 6 numpy arrays x,y,z,px,py,pz just to visualize it.
It would be great to get a 3D graph by any mean where I could insert cut planes where the vectors that are contained on it would be shown, or planes where I could see a color map that would help me to understand its beahaviour. Any help?
Here is the input: https://pastebin.com/raw/pmGguxUc
Here is the code I used to get the visualization with quiver3d function. import numpy as np import mayavi.mlab as mlab
data = np.loadtxt("vectorfield.dat", dtype = float)
dataTranspuesta=data.T
x=dataTranspuesta[0]
y=dataTranspuesta[1]
z=dataTranspuesta[2]
px=dataTranspuesta[3]
py=dataTranspuesta[4]
pz=dataTranspuesta[5]
mlab.quiver3d(x, y, z, px, py, pz, line_width=0.7 ,scale_mode="vector" ,scale_factor=0.0045,mask_points=7 ,mode="arrow", colormap="seismic" )
mlab.show()
It is easier to organize everything using mayavi's pipeline. They are basically the same as using mlab plotting functions, but organize your visualization tasks in a pipeline fashion.
Pfld = mlab.pipeline.vector_field(x, y, z, px, py, pz)
Quiver = mlab.pipeline.vectors(Pfld)
Pcut = mlab.pipeline.vector_cut_plane(Quiver, plane_orientation='x_axes')
You can also draw isosurface contours for the vectors' magnitude
Pmag = mlab.pipeline.extract_vector_norm(Pfld)
Piso = mlab.pipeline.iso_surface(Pmag)
and plane cuts of the scalar field can be achieved through mlab.pipeline.scalar_cut_plane(Pmag)
or mlab.pipeline.image_plane_widget(Pmag)
See documentations for more details on the allowed arguments, decorations, etc.
Also examples 1 and exmaples 2 may fit your needs.