mlabtex Quickstart

mlabtex provides a renderer for latex code in mayavi.

Installation

The package can be installed via pip. On Windows you can install WinPython to get Python and pip running.

pip install mlabtex

Further Information

You can find the documention here

Functions

The following functions are provided:

render_latex(text, path[, color, dpi, output]) Renders LaTeX-formula into an image.
mlabtex(x, y, z, text[, color, figure, …]) Render for matplotlib like text in mayavi.
mlabimg(x, y, z, path[, figure, name, …]) Render image files in mayavi.

Example

You can use it like the mlab.surf routine:

from mayavi import mlab
from mlabtex import mlabtex

text = (
    r'Sebastian M\"uller, '
    + r'$f(x)=\displaystyle\sum_{n=0}^\infty '
    + r'f^{(n)}(x_0)\cdot\frac{(x-x_0)^n}{n!}$'
)
tex = mlabtex(
    0., 0., 0.,
    text,
    color=(0., 0., 0.),
    orientation=(30., 0., 0.),
    dpi=1200,
)
mlab.axes()
mlab.show()
_images/01_example.png

License

MIT © 2019