SourceForge logo
SourceForge logo
Menu

matplotlib-users

From: Arnold M. <arn...@wu...> - 2004年03月04日 08:31:52
Hi all,
I encountered a strange error (which I now remember was there already in 
version 0.50). When I run (for example) the mathtext_demo.py, I get the 
following error:
<error>
File 
"/usr/lib/python2.3/site-packages/matplotlib/backends/backend_gtk.py", 
line 504, in points_to_pixels
 return points*PIXELS_PER_INCH/72.0*self.dpi.get()/72.0
TypeError: unsupported operand type(s) for /: 'array' and 'float'
</error>
When I replace that line 504 with (note the parentheses)
 return points*(PIXELS_PER_INCH/72.0*self.dpi.get()/72.0)
python is happy.
I don't understand why python doesn't like the present construct.
Possibly an odd combination of versions:
-> Python 2.3 (#2, Aug 31 2003, 17:27:29) [GCC 3.3.1 (Mandrake Linux 9.2 
3.3.1-1mdk)] on linux2
-> Numeric 22.0
-> scipy cvs_version = (1,196,1591,4120)
Cheers,
Arnold
PS: the mathtext-option was a very pleasant surprise to me (hadn't seen 
any discussion on it on the mailing list).
From: John H. <jdh...@ac...> - 2004年03月04日 21:12:42
>>>>> "Arnold" == Arnold Moene <arn...@wu...> writes:
 Arnold> unsupported operand type(s) for /: 'array' and 'float'
This is a known bug with older versions of Numeric (eg 22.0) combined
with "from __future__ import division". It also affects current
versions of numarray. If you upgrade to the latest Numeric it will go
away. I try and code around it; in this case I forgot. I'll add the
parens.
 Arnold> PS: the mathtext-option was a very pleasant surprise to me
 Arnold> (hadn't seen any discussion on it on the mailing list).
Glad to hear it - there was some discussion on the matplotlib-devel
list. I'm sure you'll encounter strangeness and some parse errors
since it is not widely tested, so please alert me when you do (check
the KNOWN ISSUES section of
http://matplotlib.sourceforge.net/matplotlib.mathtext.html).
JDH
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /