Skip to content Skip to sidebar Skip to footer

Single Line With Multiple Radii With Mayavi

I am trying to plot a single line (or tube) in Mayavi that has a non-constant width or radius. This seems like a simple task though I may not be understanding what is happening beh

Solution 1:

In the GUI, you can go to the Tube pipeline and use Vary_radius = 'vary_radius_by_scalar'

In the script you can do

import mayavi.mlab as mlab
import numpy as np

x = range(100)
y = range(100)
z = range(100)
s = np.random.uniform(0, 1, 100)

t = mlab.plot3d(x, y, z, s, tube_radius=10)
t.parent.parent.filter.vary_radius = 'vary_radius_by_scalar'

Since the parent of the surface is the Module manager (colors, etc) and its parent is the Tube pipeline

Post a Comment for "Single Line With Multiple Radii With Mayavi"