Support for embedded TeX expressions in Matplotlib.
Requirements:
To enable TeX rendering of all text in your Matplotlib figure, set rcParams["text.usetex"]
(default: False
) to True.
TeX and dvipng/dvips processing results are cached in ~/.matplotlib/tex.cache for reuse between sessions.
TexManager.get_rgba
can also be used to directly obtain raster output as RGBA NumPy arrays.
Bases: object
Convert strings to dvi files using TeX, caching the results to a directory.
Repeated calls to this constructor always return the same instance.
Return a filename based on a hash of the string, fontsize, and dpi.
Return a string containing user additions to the tex preamble.
Return a string containing font configuration for the tex preamble.
Return the alpha channel.
Return latex's rendering of the tex string as an rgba array.
>>> texmanager = TexManager() >>> s = r"\TeX\ is $\displaystyle\sum_n\frac{-e^{i\pi}}{2^n}$!" >>> Z = texmanager.get_rgba(s, fontsize=12, dpi=80, rgb=(1, 0, 0))
Return width, height and descent of the text.
Generate a dvi file containing latex's layout of tex string.
Return the file name.
Generate a png file containing latex's rendering of tex string.
Return the file name.
Generate a tex file to render the tex string at a specific font size.
Return the file name.
© 2012–2021 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.
https://matplotlib.org/3.5.1/api/texmanager_api.html