How to mark axes in Mayavi using LaTeX math symbols?

I import Mayavi into a python script to display some set of 3D data, it turns out that the following naive axis labels do not work

from mayavi import mlab axes =mlab.axes(xlabel='$\alpha$', ylabel='$\beta$', zlabel='$\sigma$') 

Any ideas? I can not find the solution from Google or the user guide.

+7
source share
3 answers

Mayavi does not support LaTeX characters sadly.

+5
source

The stream is a bit outdated, but the problem is still not resolved. For those who are still interested in using latex text in Mayavi, you can look at this site:

https://pgi-jcns.fz-juelich.de/portal/pages/latex-mayavi.html

It provides a workaround where the latex document is converted to a png file, which is again imported into Mayavi. Good luck

+1
source

Try r before each line

 from mayavi import mlab axes =mlab.axes(xlabel=r'$\alpha$', ylabel=r'$\beta$', zlabel=r'$\sigma$') 
0
source

All Articles