class
matplotlib.texmanager.
TexManager
Bases: object
Convert strings to dvi files using TeX, caching the results to a directory.
The cache directory is called tex.cache and is located in the directory
returned by get_cachedir.
Repeated calls to this constructor always return the same instance.
-
classmethod get_basefile(tex, fontsize, dpi=None)
Return a filename based on a hash of the string, fontsize, and dpi.
-
classmethod get_custom_preamble()
Return a string containing user additions to the tex preamble.
-
classmethod get_font_preamble()
Return a string containing font configuration for the tex preamble.
-
classmethod get_grey(tex, fontsize=None, dpi=None)
Return the alpha channel.
-
classmethod get_rgba(tex, fontsize=None, dpi=None, rgb=(0, 0, 0))
Return latex's rendering of the tex string as an RGBA array.
Examples
texmanager = TexManager()
-
classmethod get_text_width_height_descent(tex, fontsize, renderer=None)
Return width, height and descent of the text.
-
classmethod make_dvi(tex, fontsize)
Generate a dvi file containing latex's layout of tex string.
Return the file name.
-
classmethod make_png(tex, fontsize, dpi)
Generate a png file containing latex's rendering of tex string.
Return the file name.
-
classmethod make_tex(tex, fontsize)
Generate a tex file to render the tex string at a specific font size.
Return the file name.
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
))