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...
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...
These axes look much more professional and are easier to read than the default MayaVi axes.
Any help would be greatly appreciated.
Thanks!
We can create 3D plots in Python thanks to the mplot3d toolkit in the matplotlib library. Matplotlib was introduced with only 2D plots in mind. However, as of the 1.0 release, 3D utilities were developed on top of 2D, so 3D implementations of data are available today.
Mlab is a high-level python to Matlab bridge that lets Matlab look like a normal python library.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With