OK,

here is the LaTeX example from the cookbook, i.e. I executed the following:

— x —

import pylab

from pylab import arange,pi,sin,cos,sqrt

fig_width_pt = 246.0 # Get this from LaTeX using \showthe\columnwidth

inches_per_pt = 1.0/72.27 # Convert pt to inch

golden_mean = (sqrt(5)-1.0)/2.0 # Aesthetic ratio

fig_width = fig_width_pt*inches_per_pt # width in inches
fig_height = fig_width*golden_mean # height in inches

fig_size = [fig_width,fig_height]

params = {‘backend’: ‘ps’,

‘axes.labelsize’: 10,

‘text.fontsize’: 10,

‘xtick.labelsize’: 8,

’

ytick.labelsize’: 8,

‘text.usetex’: True,

‘figure.figsize’: fig_size}

pylab.rcParams.update(params)

# Generate data

x = pylab.arange(-2*pi,2*pi,0.01)

y1 = sin(x)

y2 = cos(x)

# Plot data

pylab.figure(1)

pylab.clf()

pylab.axes([0.125,0.2,0.95-0.125,0.95-0.2])

pylab.plot(x,y1,‘g:’,label=‘\sin(x)’)

pylab.plot(x,y2,‘-b’,label=‘\cos(x)’)

pylab.xlabel(‘x (radians)’)

pylab.ylabel(‘y’)

pylab.legend()

pylab.savefig(‘fig1.eps’)

— x —

Please find attached the resulting picture and the output from running the script with the flag “–verbose-debug-annoying”.

Best regards,

Johan

2007/8/7, Darren Dale <dd55@…163…>:

fig1.eps (71.2 KB)

verbose-debug-annoying-output.text (7.87 KB)

## ···

Hi Johan,

Please try following the instructions I sent in my last post.

On Tuesday 07 August 2007 10:53:31 am you wrote:

Hi, and thanks for your answer.

I got the following output from running my script with the

–verbose-helpful flag:

— x —

joeh@…1695…:~/ABB/HVC/SubSea/Python> python plot_data.py

–verbose-helpful

matplotlib data path /usr/lib64/python2.5/site-packages/matplotlib/mpl-data$HOME=/home/joeh

CONFIGDIR=/home/joeh/.matplotlib

loaded rc file /home/joeh/.matplotlib/matplotlibrc

matplotlib version 0.90.0

verbose.level helpful

interactive is Falseplatform is linux2

numerix numpy 1.0.3

font search path [‘/usr/lib64/python2.5/site-packages/matplotlib/mpl-data’]

loaded ttfcache file /home/joeh/.matplotlib/ttffont.cache

backend GTKAgg version 2.10.3

Could not match Computer Modern Roman, normal, normal. Returning

/usr/lib64/python2.5/site-packages/matplotlib/mpl-data/Vera.ttf

Found dvipng version 1.5

Could not match Computer Modern Roman, normal, normal. Returning/usr/lib64/python2.5/site-packages/matplotlib/mpl-data/Vera.ttf

Could not match Computer Modern Roman, normal, normal. Returning

/usr/lib64/python2.5/site-packages/matplotlib/mpl-data/Vera.ttf%%BoundingBox: 96 263 483 504

%%HiResBoundingBox: 96.933583 263.234875 482.480001 503.829758— x —

Definitely looks like some missing fonts, does anyone known what I have to

do?

Best regards,

Johan2007/8/7, Darren Dale <dd55@…163…>:

On Tuesday 07 August 2007 07:37:04 am Johan Ekh wrote:

Hi all,

I’m new to Python in general and Matplotlib in particular.

I’m trying to create publication quality plots for inclusion

in LaTeX papers and presentations and have some problemsto get the fonts right.

My matplotlibrc contains the following lines

font.family : serif

font.serif : Times, Palatino, New Century Schoolbook, Bookman,Computer Modern Roman

font.sans-serif : Helvetica, Avant Garde, Computer Modern Sans serif

font.cursive : Zapf Chancery

font.monospace : Courier, Computer Modern Typewriterand my Python script contains the following lines

params = {‘backend’: ‘ps’,

‘axes.labelsize’: 12,`'text.fontsize': 12, 'xtick.labelsize': 10, 'ytick.labelsize': 10, 'text.usetex': True,`

`'figure.figsize': fig_size}`

rcParams.update(params)

I run what I believe is a standard openSUSE 10.2 installation of tetex

and

python, including matplotlib.

Still, fonts in my matplotlib plot are different from the ones used in

my

LaTeX document. Also, strangely

psfrag does not seem to work? Nothing ever gets replaced in my plot!Can someone please help me out, what am I doing wrong?

Please make sure that the external dependencies are installed and

properly configured, see

http://www.scipy.org/Cookbook/Matplotlib/UsingTex

. If that doesn’t help,

try setting your verbose.level to “debug”, write as simple a script as

possible that reproduces the problem, and post again, along with the

output and perhaps the figure.–

Darren S. Dale, Ph.D.

Staff Scientist

Cornell High Energy Synchrotron Source

Cornell University

275 Wilson Lab

Rt. 366 & Pine Tree Road

Ithaca, NY 14853dd55@…163…

office: (607) 255-3819

fax: (607) 255-9001

http://www.chess.cornell.edu