Search code examples
pythonnumpynumericmayavi

how to add ripples of this mayavi 3d plot?


In my plot, I want different colors of ripples. so can you please tell me how to add ripples of this mayavi 3d plot. my code is given bellow. this is my image enter image description here i want to add ripples to surface the axis ripple:sample image:enter image description here

import scipy as np
from mayavi import mlab


x,y = np.mgrid[-3:3:100j, -3:3:100j]

a = 0.3

a0 = 0.2

r1=np.sqrt((x-a)**2 + y**2)

values = np.exp(-r1/a0)



mlab.surf(values, warp_scale='auto')

mlab.outline()

mlab.axes()
# mlab.test_contour3d()
mlab.show()

Solution

  • If you're looking for a static image of 'ripples', try the numpy sinc function. That should do what you want. It is the result of Fourier-transforming a delta function.