# Plotting streamlines on 3D surface with Mayavi

4 messages
Open this post in threaded view
|

## Plotting streamlines on 3D surface with Mayavi

 Hello, I'd like to plot stream lines on a three dimensional surface. Currently I'm using mesh + quiver, but this doesn't look nice because the arrows stick out of the plane and aren't connected. Example: import numpy as np (ys, xs) = np.mgrid[-10:10:50j, -10:10:50j] zs = np.cos(xs/2) + 0.5 * np.cos(ys/4) alpha = np.arctan2(ys, xs) u = np.sin(alpha) v = -np.cos(alpha) w = -u * np.sin(xs/2)/2 - v * np.sin(ys/4)/4 # 3D, but ugly from mayavi import mlab mlab.mesh(xs, ys, zs) mlab.quiver3d(xs, ys, zs, u, v, w) # 2D, but nice import matplotlib.pyplot as plt plt.streamplot(xs, ys, u, v) Based on some examples I have found, I believe that what I want is the Mayavi streamline module. But I wasn't able to find any documentation for this at all. Does anyone have a pointer for me? It'd be especially nice if there was a way to specify the surface connectivity explicitly (like in mlab.triangular_mesh). Best, -Nikolaus _______________________________________________ Enthought-Dev mailing list [hidden email] https://mail.enthought.com/mailman/listinfo/enthought-dev
Open this post in threaded view
|

## Re: Plotting streamlines on 3D surface with Mayavi

 On Wed, Jan 23, 2013 at 03:27:12PM -0800, Nikolaus Rath wrote: > Based on some examples I have found, I believe that what I want is the > Mayavi streamline module. But I wasn't able to find any documentation > for this at all. Streamlines are done with the 'mlab.flow' function. However, it won't restrict the lines to a surface. It is documented as all the other functions: http://docs.enthought.com/mayavi/mayavi/mlab.html#id1http://docs.enthought.com/mayavi/mayavi/auto/mlab_helper_functions.html#flowYou may also find interesting: http://docs.enthought.com/mayavi/mayavi/mlab.html#visualizing-a-vector-fieldand examples: http://docs.enthought.com/mayavi/mayavi/auto/example_lorenz.html#example-lorenzhttp://docs.enthought.com/mayavi/mayavi/auto/example_magnetic_field_lines.html#example-magnetic-field-linesHTH, Gael _______________________________________________ Enthought-Dev mailing list [hidden email] https://mail.enthought.com/mailman/listinfo/enthought-dev