14

I would like to know how to have proper axes on a 3D surface plot in MayaVi. The best axes I could create looked something like this...

enter image description here

However, these do not look very professional if I were to give a presentation or put these on a poster.

I would like the axes to look something like this...

enter image description here

These axes look much more professional and are easier to read than the default MayaVi axes.

Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
Ben Donovan
  • 199
  • 1
  • 7
  • Which MayaVi version are you using? – Schorsch Jun 20 '14 at 12:33
  • 1
    Your question is basically "I do not like the default mayavi axes, how do I get better ones?" In my opinion this is not really therefore a good question although it may be an important feature request. The answer to your question is that this is how the axes look in VTK. If you are unhappy with them, you have several options. You can look around for different libraries that do what you want, you can try to ask the mayavi/vtk developers nicely if they would implement your feature, or you can write it yourself. – aestrivex Jun 20 '14 at 15:09
  • 2
    Just ran into the very same problem. While I agree that "this is just the way VTK looks", it is not a satisfactory answer. In my opinion this issue makes mayavi almost useless for scientific applications as you can never publish such weird looking plots. Going to look for alternatives...R seems to be promising – HansSnah Oct 03 '16 at 19:22

1 Answers1

9

I had this problem too. I hacked a bad workaround by not displaying the mayavi axes, but plotting the axes I needed myself using plot3d()

from mayavi import mlab
import numpy as np
xx = yy = zz = np.arange(-0.6,0.7,0.1)
xy = xz = yx = yz = zx = zy = np.zeros_like(xx)    
mlab.plot3d(yx,yy+lensoffset,yz,line_width=0.01,tube_radius=0.01)
mlab.plot3d(zx,zy+lensoffset,zz,line_width=0.01,tube_radius=0.01)
mlab.plot3d(xx,xy+lensoffset,xz,line_width=0.01,tube_radius=0.01)

You can now add labels and annotations using text3d() Very inelegant and brute force, but works in a pinch.