Hi, I'm running into the following error:

findfont: Matching
:family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=medium
to Bitstream Vera Sans (/usr/X11R6/lib/X11/fonts/TTF/Vera.ttf) with
score of 0.000000
Found dvipng version 1.11
findfont: Matching
:family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=large
to Bitstream Vera Sans (/usr/X11R6/lib/X11/fonts/TTF/Vera.ttf) with
score of 0.000000
Exception in Tkinter callback
Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk/Tkinter.py",
line 1410, in __call__
    return self.func(*args)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_tkagg.py",
line 212, in resize
    self.show()
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_tkagg.py",
line 215, in draw
    FigureCanvasAgg.draw(self)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_agg.py",
line 388, in draw
    self.figure.draw(self.renderer)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py",
line 55, in draw_wrapper
    draw(artist, renderer, *kl)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/figure.py",
line 772, in draw
    for a in self.axes: a.draw(renderer)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py",
line 55, in draw_wrapper
    draw(artist, renderer, *kl)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axes.py",
line 1760, in draw
    a.draw(renderer)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py",
line 55, in draw_wrapper
    draw(artist, renderer, *kl)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/legend.py",
line 389, in draw
    self._legend_box.draw(renderer)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/offsetbox.py",
line 240, in draw
    c.draw(renderer)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/offsetbox.py",
line 240, in draw
    c.draw(renderer)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/offsetbox.py",
line 240, in draw
    c.draw(renderer)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/offsetbox.py",
line 240, in draw
    c.draw(renderer)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/offsetbox.py",
line 504, in draw
    c.draw(renderer)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py",
line 55, in draw_wrapper
    draw(artist, renderer, *kl)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/lines.py",
line 530, in draw
    drawFunc(renderer, gc, tpath, affine.frozen())
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/lines.py",
line 866, in _draw_lines
    self._lineFunc(renderer, gc, path, trans)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/lines.py",
line 917, in _draw_dashed
    renderer.draw_path(gc, path, trans)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_agg.py",
line 117, in draw_path
    self._renderer.draw_path(gc, path, transform, rgbFace)
TypeError: float() argument must be a string or a number
Exception in Tkinter callback
Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk/Tkinter.py",
line 1410, in __call__
    return self.func(*args)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_tkagg.py",
line 212, in resize
    self.show()
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_tkagg.py",
line 215, in draw
    FigureCanvasAgg.draw(self)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_agg.py",
line 388, in draw
    self.figure.draw(self.renderer)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py",
line 55, in draw_wrapper
    draw(artist, renderer, *kl)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/figure.py",
line 772, in draw
    for a in self.axes: a.draw(renderer)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py",
line 55, in draw_wrapper
    draw(artist, renderer, *kl)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axes.py",
line 1760, in draw
    a.draw(renderer)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py",
line 55, in draw_wrapper
    draw(artist, renderer, *kl)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/legend.py",
line 389, in draw
    self._legend_box.draw(renderer)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/offsetbox.py",
line 240, in draw
    c.draw(renderer)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/offsetbox.py",
line 240, in draw
    c.draw(renderer)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/offsetbox.py",
line 240, in draw
    c.draw(renderer)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/offsetbox.py",
line 240, in draw
    c.draw(renderer)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/offsetbox.py",
line 504, in draw
    c.draw(renderer)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/artist.py",
line 55, in draw_wrapper
    draw(artist, renderer, *kl)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/lines.py",
line 530, in draw
    drawFunc(renderer, gc, tpath, affine.frozen())
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/lines.py",
line 866, in _draw_lines
    self._lineFunc(renderer, gc, path, trans)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/lines.py",
line 917, in _draw_dashed
    renderer.draw_path(gc, path, trans)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_agg.py",
line 117, in draw_path
    self._renderer.draw_path(gc, path, transform, rgbFace)
TypeError: float() argument must be a string or a number


Using the following code:
from pylab import *
import numpy,scipy,matplotlib;
h=6.626e-27
c=3e10
nu=3e18/5500.
k=1.38e-16
T=6000
mynu=linspace(1e13,10**15.2,100000)
dnu = mean(mynu[1:]-mynu[:-1])
planck = 2*h*mynu**3/c**2 * (exp(h*mynu/(k*T))-1)**-1
mylam=linspace(1500e-8,5e-4,100000)
dlam = mean(mylam[1:]-mylam[:-1])
planckL=2*h*c**2/mylam**5*(exp(h*c/(mylam*k*T))-1)**-1; planckLn =
planckL* planck.max()/planckL.max()
figure(0); clf(); loglog(mynu,planck,label=r'$\nu$')
plot(3e10/mylam,planckLn,label=r'$\lambda$')
xlabel(r'$\nu$')
ylabel(r'$B_\nu$')
vlines(3e10/5500e-8,1e-7,1e-4)
vlines(3e10/6000e-8,1e-7,1e-4,linestyle='--')
vlines(3e10/5000e-8,1e-7,1e-4,linestyle='--')
legend(loc='best')

figure(1); clf()
loglog(mynu,planck*mynu,label=r'$\nu$')
plot(3e10/mylam,planckL*mylam,label=r'$\lambda$')
vlines(3e10/5500e-8,1e6,2e10)
vlines(3e10/6000e-8,1e6,2e10,linestyle='--')
vlines(3e10/5000e-8,1e6,2e10,linestyle='--')
xlabel(r'$\nu = c / \lambda$')
ylabel(r'$\nu B_\nu = \lambda B_\lambda$')
legend(loc='best')


lamlow = 5000e-8
lamhi  = 6000e-8
nulow = 3e10/lamhi
nuhi = 3e10/lamlow
whnu = (mynu<nuhi)*(mynu>nulow)
whlam = (mylam<lamhi)*(mylam>lamlow)
int_nu = (planck[whnu]*dnu).sum()
int_lam = (planckL[whlam]*dlam).sum()

print "int_nu = %g" % (int_nu)
print "int_lam = %g" % (int_lam)

show()



The error only happens when I use a legend; i.e. there is no error
when the legend() lines are commented out.  I've only explored a
little parameter space but it still happens without latex in the
labels and when I use a linear-linear plot.

Adam

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to