|
New release
|
|
matplotlib 0.98.3 is a major release which requires python2.4 or 2.5 and numpy 1.1. It contains significant improvements and may require some advanced users to update their code; see migration and API_CHANGES. We are supporting a maintenance branch of the older code available at matplotlib 0.91.4. Basemap users see basemap-readme for upgrade instructions |
|
Donate
|
|
Help support matplotlib development by donating to fund developer sprints and other matplotlib development costs. |
|
|
|
This module supports embedded TeX expressions in matplotlib via dvipng
and dvips for the raster and postscript backends. The tex and
dvipng/dvips information is cached in ~/.matplotlib/tex.cache for reuse between
sessions
Requirements:
* latex
* \*Agg backends: dvipng
* PS backend: latex w/ psfrag, dvips, and Ghostscript 8.51
(older versions do not work properly)
Backends:
* \*Agg
* PS
* PDF
For raster output, you can get RGBA numpy arrays from TeX expressions
as follows::
texmanager = TexManager()
s = '\TeX\ is Number $\displaystyle\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}$!'
Z = self.texmanager.get_rgba(s, size=12, dpi=80, rgb=(1,0,0))
To enable tex rendering of all text in your matplotlib figure, set
text.usetex in your matplotlibrc file (http://matplotlib.sf.net/matplotlibrc)
or include these two lines in your script::
from matplotlib import rc
rc('text', usetex=True)
Classes |
| | |
- TexManager
class TexManager |
| |
Convert strings to dvi files using TeX, caching the results to a
working dir |
| |
Methods defined here:
- __init__(self)
- get_basefile(self, tex, fontsize, dpi=None)
- returns a filename based on a hash of the string, fontsize, and dpi
- get_custom_preamble(self)
- returns a string containing user additions to the tex preamble
- get_font_config(self)
- Reinitializes self if relevant rcParams on have changed.
- get_font_preamble(self)
- returns a string containing font configuration for the tex preamble
- get_grey(self, tex, fontsize=None, dpi=None)
- returns the alpha channel
- get_ps_bbox(self, tex, fontsize)
- returns a list containing the postscript bounding box for latex's
rendering of the tex string
- get_rgba(self, tex, fontsize=None, dpi=None, rgb=(0, 0, 0))
- Returns latex's rendering of the tex string as an rgba array
- make_dvi(self, tex, fontsize)
- generates a dvi file containing latex's layout of tex string
returns the file name
- make_png(self, tex, fontsize, dpi)
- generates a png file containing latex's rendering of tex string
returns the filename
- make_ps(self, tex, fontsize)
- generates a postscript file containing latex's rendering of tex string
returns the file name
- make_tex(self, tex, fontsize)
- Generate a tex file to render the tex string at a specific font size
returns the file name
Data and other attributes defined here:
- configdir = '/home/jdhunter/.matplotlib'
- cursive = ('pzc', r'\usepackage{chancery}')
- font_families = ('serif', 'sans-serif', 'cursive', 'monospace')
- font_family = 'serif'
- font_info = {'avant garde': ('pag', r'\usepackage{avant}'), 'bookman': ('pbk', r'\renewcommand{\rmdefault}{pbk}'), 'charter': ('pch', r'\usepackage{charter}'), 'computer modern roman': ('cmr', ''), 'computer modern sans serif': ('cmss', ''), 'computer modern typewriter': ('cmtt', ''), 'courier': ('pcr', r'\usepackage{courier}'), 'cursive': ('pzc', r'\usepackage{chancery}'), 'helvetica': ('phv', r'\usepackage{helvet}'), 'monospace': ('cmtt', ''), ...}
- grey_arrayd = {}
- monospace = ('cmtt', '')
- n = 'monospace'
- oldcache = '/home/jdhunter/.tex.cache'
- oldpath = '/home/jdhunter'
- postscriptd = {}
- pscnt = 0
- rgba_arrayd = {}
- sans_serif = ('cmss', '')
- serif = ('cmr', '')
- texcache = '/home/jdhunter/.matplotlib/tex.cache'
| |
Data |
| | |
DEBUG = False
cmd_split = ';'
rcParams = {'figure.subplot.right': 0.90000000000000002, 'm...persize': 'letter', 'svg.embed_char_paths': True} |
|