Hi there,
I'm trying to render text with LaTeX using the example on page 53 of the
Matplotlib tutorial; see source code and output below.
It's not working. divipng, (latest)Ghostscript, and LaTeX are all
installed; their executables
in my PATH. Matplotlib is working flawlessly. Help is appreciated.
Thanks, Harry
$gs
GPL Ghostscript 8.71 (2010-02-10)
Copyright (C) 2010 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
GS>
$dvipng
This is dvipng 1.12 Copyright 2002-2008 Jan-Ake Larsson
#EXAMPLE TUTORIAL page 53
#!/Library/Frameworks/Python.framework/Versions/Current/bin/python
from matplotlib import rc
from numpy import arange, cos, pi
from matplotlib.pyplot import figure, axes, plot, xlabel, ylabel, title, \
grid, savefig, show
rc('text', usetex=True)
rc('font', family='serif')
figure(1, figsize=(6,4))
ax = axes([0.1, 0.1, 0.8, 0.7])
t = arange(0.0, 1.0+0.01, 0.01)
s = cos(2*2*pi*t)+2
plot(t, s)
xlabel(r'\textbf{time (s)}')
ylabel(r'\textit{voltage (mV)}',fontsize=16)
title(r"\TeX\ is Number
$\displaystyle\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}$!",
fontsize=16, color='r')
grid(True)
savefig('tex_demo')
show()
###OUTPUT#####
warning: Could not open char translation file `cp8bit.tcx'.
kpathsea: Running mktexfmt latex.efmt
fmtutil: unknown format type: latex.efmt.
Traceback (most recent call last):
File "tex.py", line 34, in <module>
savefig('tex_demo')
File
"/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6/site-packages/matplotlib/pyplot.py",
line 356, in savefig
return fig.savefig(*args, **kwargs)
File
"/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6/site-packages/matplotlib/figure.py",
line 1032, in savefig
self.canvas.print_figure(*args, **kwargs)
--------AND A LOT OF MORE OUTPUT LIKE THE ABOVE--------------
string:\n%s\nHere is the full report generated by LaTeX: \n\n'%
repr(tex)) + report)
RuntimeError: LaTeX was not able to process the following string:
'$0.0$'
Here is the full report generated by LaTeX:
This is e-TeX, Version 3.141592-2.1 (Web2C 7.5.2)
I can't find the format file `latex.efmt'!
Harry
------------------------------------------------------------------------------
This SF.net email is sponsored by
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users