[Pythonmac-SIG] Errors with simple_plot in matplotlib: type is wrong for / operator?
John Hunter
jdhunter at ace.bsd.uchicago.edu
Tue Jul 26 21:41:16 CEST 2005
>>>>> "Louis" == Louis Pecora <pecora at anvil.nrl.navy.mil> writes:
Louis> *This is deep in matplotlib. Anyone know what's happening?
Louis> Here's what line 335 in ticker.py looks like (not sure if
Louis> this helps since you'd probably have to know the code of
Louis> matplotlib):
Louis> # set the format string to format all the ticklabels locs =
Louis> (array(self.locs)-self.offset) /
Louis> 10**self.orderOfMagnitude+1e-15
Louis> But there's that / operator.
What version of Numeric/numarray are you running? Try running your
example script with
> pythonw myscript.py --verbose-helpful
and report the output.
Also, does it help to replace the 10**self.orderOfMagnitude with
10.0**self.orderOfMagnitude? I didn't write that section of the code,
but I think this is what the author (Darren, CCd) intends.
JDH
Darren: FYI, the original post in full is below
From: Louis Pecora <pecora at anvil.nrl.navy.mil>
Subject: [Pythonmac-SIG] Errors with simple_plot in matplotlib: type is
wrong for / operator?
To: pythonmac-sig at python.org
Date: Tue, 26 Jul 2005 15:34:29 -0400
X-Spambayes-Classification: ham; 0.00
I got my Python back up and running thanks to help from Bob Impolito
and Robert Kern (site packages and .pth files and new system install).
* I have installed wxPython and matplotlib. But when I run the
simple_plot.py program:
#!/usr/bin/pythonw
from pylab import *
figure(1)
t = arange(0.0, 1.0+0.01, 0.01)
s = cos(2*2*pi*t)
plot(t, s)
xlabel('time (s)')
ylabel('voltage (mV)')
title('About as simple as it gets, folks')
grid(True)
#axis([0,1,-1,1])
savefig('simple_plot')
show()
* I get this traceback:
louispec% /tmp/501/Cleanup\ At\ Startup/1735220.command; exit
Traceback (most recent call last):
File "/Users/louispecora/Documents/Computer Info /Python /Matplotlib
/Examples.Matplotlib/simple_plot.py", line 17, in ?
savefig('simple_plot')
File "/Library/Python/2.3/pylab.py", line 751, in savefig
File "/platlib/matplotlib/figure.py", line 618, in savefig
File "/platlib/matplotlib/backends/backend_wxagg.py", line 83, in
print_figure
File "/platlib/matplotlib/backends/backend_agg.py", line 432, in
print_figure
File "/platlib/matplotlib/backends/backend_agg.py", line 369, in draw
File "/platlib/matplotlib/figure.py", line 498, in draw
File "/platlib/matplotlib/axes.py", line 1361, in draw
File "/platlib/matplotlib/axis.py", line 530, in draw
File "/platlib/matplotlib/ticker.py", line 297, in set_locs
File "/platlib/matplotlib/ticker.py", line 335, in _set_format
TypeError: unsupported operand type(s) for /: 'array' and 'int'
Exit 1
logout
[Process completed]
*This is deep in matplotlib. Anyone know what's happening?
Here's what line 335 in ticker.py looks like (not sure if this helps
since you'd probably have to know the code of matplotlib):
# set the format string to format all the ticklabels
locs = (array(self.locs)-self.offset) / 10**self.orderOfMagnitude+1e-15
But there's that / operator.
--
Cheers,
Lou Pecora
Code 6362
Naval Research Lab
Washington, DC 20375
USA
Ph: +202-767-6002
email: pecora at anvil.nrl.navy.mil
_______________________________________________
Pythonmac-SIG maillist - Pythonmac-SIG at python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
More information about the Pythonmac-SIG
mailing list