1

As there are many questions (this, this and this) about axis grid in mayavi that how to get matplotlib type grid using mayavi and there is no satisfactory answer even from Mayavi updates.

So regarding above problem, there is an idea that we can add ground plane in Mayavi as object and then we can draw/show required objects on ground plane. Below is object that I draw as ground plane Ground plane Code for above draw ground is

x, y = np.mgrid[-10:10:200j, -10:10:200j]
z = np.sin(x * y) / (x * y)
mlab.figure(bgcolor=(1, 1, 1))
mlab.surf(z, colormap='cool')

mlab.show()

Let's say we have an object that we want to draw/show it on above ground plane. Below is object (as a example) Object Code for above object is

mlab.figure(fgcolor=(0, 0, 0), bgcolor=(1, 1, 1))
u, v = mgrid[- 0.035:pi:0.01, - 0.035:pi:0.01]

X = 2 / 3. * (cos(u) * cos(2 * v) + sqrt(2) * sin(u) * cos(v)) * cos(u) / (sqrt(2) - sin(2 * u) * sin(3 * v))
Y = 2 / 3. * (cos(u) * sin(2 * v) - sqrt(2) * sin(u) * sin(v)) * cos(u) / (sqrt(2) - sin(2 * u) * sin(3 * v))
Z = -sqrt(2) * cos(u) * cos(u) / (sqrt(2) - sin(2 * u) * sin(3 * v))
S = sin(u)

mlab.mesh(X, Y, Z, scalars=S, colormap='YlGnBu', )

mlab.view(.0, - 5.0, 4)
mlab.show()

This code is available here

So how we can draw given object on the given ground plane same like below image? I edit this image in photoshop for better view.

Object on ground

Looking for some kind suggestions.

Erric
  • 123
  • 1
  • 10

0 Answers0