SourceForge logo
SourceForge logo
Menu

matplotlib-checkins

From: <jd...@us...> - 2007年07月15日 15:33:10
Revision: 3532
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3532&view=rev
Author: jdh2358
Date: 2007年07月15日 08:33:02 -0700 (2007年7月15日)
Log Message:
-----------
added agg buffer to numpy array example
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
 trunk/matplotlib/lib/matplotlib/image.py
Added Paths:
-----------
 trunk/matplotlib/examples/agg_buffer_to_array.py
Added: trunk/matplotlib/examples/agg_buffer_to_array.py
===================================================================
--- trunk/matplotlib/examples/agg_buffer_to_array.py	 (rev 0)
+++ trunk/matplotlib/examples/agg_buffer_to_array.py	2007年07月15日 15:33:02 UTC (rev 3532)
@@ -0,0 +1,24 @@
+import matplotlib
+matplotlib.use('Agg')
+from pylab import figure, show
+import numpy as npy
+
+# make an agg figure
+fig = figure()
+ax = fig.add_subplot(111)
+ax.plot([1,2,3])
+ax.set_title('a simple figure')
+fig.canvas.draw()
+
+# grab rhe pixel buffer and dumpy it into a numpy array
+buf = fig.canvas.buffer_rgba(0,0)
+l, b, w, h = fig.bbox.get_bounds()
+X = npy.fromstring(buf, npy.uint8)
+X.shape = h,w,4
+
+# now display the array X as an Axes in a new figure
+fig2 = figure()
+ax2 = fig2.add_subplot(111, frameon=False)
+ax2.imshow(X)
+fig2.savefig('simple.png')
+show()
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py	2007年07月15日 05:08:57 UTC (rev 3531)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py	2007年07月15日 15:33:02 UTC (rev 3532)
@@ -382,8 +382,8 @@
 """
 if __debug__: verbose.report('FigureCanvasAgg.draw', 'debug-annoying')
 
- renderer = self.get_renderer()
- self.figure.draw(renderer)
+ self.renderer = self.get_renderer()
+ self.figure.draw(self.renderer)
 
 def get_renderer(self):
 l,b,w,h = self.figure.bbox.get_bounds()
Modified: trunk/matplotlib/lib/matplotlib/image.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/image.py	2007年07月15日 05:08:57 UTC (rev 3531)
+++ trunk/matplotlib/lib/matplotlib/image.py	2007年07月15日 15:33:02 UTC (rev 3532)
@@ -264,7 +264,9 @@
 if self._extent is not None:
 return self._extent
 else:
- numrows, numcols = self.get_size()
+ sz = self.get_size()
+ #print 'sz', sz
+ numrows, numcols = sz
 if self.origin == 'upper':
 return (-0.5, numcols-0.5, numrows-0.5, -0.5)
 else:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ds...@us...> - 2007年07月16日 14:07:01
Revision: 3539
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3539&view=rev
Author: dsdale
Date: 2007年07月16日 07:06:59 -0700 (2007年7月16日)
Log Message:
-----------
fixed a formatting bug in ticker.ScalarFormatter (10^0 was rendered as 
10 in some cases)
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/lib/matplotlib/ticker.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2007年07月16日 13:16:25 UTC (rev 3538)
+++ trunk/matplotlib/CHANGELOG	2007年07月16日 14:06:59 UTC (rev 3539)
@@ -1,3 +1,6 @@
+2007年07月16日 fixed a formatting bug in ticker.ScalarFormatter's scientific 
+ notation (10^0 was being rendered as 10 in some cases) - DSD
+
 2007年07月13日 Add MPL_isfinite64() and MPL_isinf64() for testing
 doubles in (the now misnamed) MPL_isnan.h. - ADS
 
Modified: trunk/matplotlib/lib/matplotlib/ticker.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/ticker.py	2007年07月16日 13:16:25 UTC (rev 3538)
+++ trunk/matplotlib/lib/matplotlib/ticker.py	2007年07月16日 14:06:59 UTC (rev 3539)
@@ -402,27 +402,26 @@
 if absolute(xp) < 1e-8: xp = 0
 return self.format % xp
 
- def _formatSciNotation(self,s, mathtext=False):
+ def _formatSciNotation(self, s, mathtext=False):
 # transform 1e+004 into 1e4, for example
 tup = s.split('e')
 try:
- mantissa = tup[0].rstrip('0').rstrip('.')
+ significand = tup[0].rstrip('0').rstrip('.')
 sign = tup[1][0].replace('+', '')
 exponent = tup[1][1:].lstrip('0')
 if mathtext:
- if self._usetex:
- if mantissa=='1':
- return r'10^{%s%s}'%(sign, exponent)
- else:
- return r'%s{\times}10^{%s%s}'%(mantissa, sign, exponent)
+ if significand == '1':
+ # reformat 1x10^y as 10^y
+ significand = ''
+ if exponent:
+ exponent = '10^{%s%s}'%(sign, exponent)
+ if significand and exponent:
+ return r'%s{\times}%s'%(significand, exponent)
 else:
- if mantissa=='1':
- return r'10^{%s%s}'%(sign, exponent)
- else:
- return r'%s{\times}10^{%s%s}'%(mantissa, sign, exponent)
+ return r'%s%s'%(significand, exponent)
 else:
- return ('%se%s%s' %(mantissa, sign, exponent)).rstrip('e')
- except IndexError,msg:
+ return ('%se%s%s' %(significand, sign, exponent)).rstrip('e')
+ except IndexError, msg:
 return s
 
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ds...@us...> - 2007年07月16日 19:40:35
Revision: 3545
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3545&view=rev
Author: dsdale
Date: 2007年07月16日 12:40:34 -0700 (2007年7月16日)
Log Message:
-----------
cleanup some code in ScalerFormatter, use unicode multiplication sign in 
offset ticklabel
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/lib/matplotlib/ticker.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2007年07月16日 18:29:23 UTC (rev 3544)
+++ trunk/matplotlib/CHANGELOG	2007年07月16日 19:40:34 UTC (rev 3545)
@@ -1,3 +1,6 @@
+2007年07月16日 clean up some code in ticker.ScalarFormatter, use unicode to
+ render multiplication sign in offset ticklabel - DSD
+
 2007年07月16日 fixed a formatting bug in ticker.ScalarFormatter's scientific 
 notation (10^0 was being rendered as 10 in some cases) - DSD
 
Modified: trunk/matplotlib/lib/matplotlib/ticker.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/ticker.py	2007年07月16日 18:29:23 UTC (rev 3544)
+++ trunk/matplotlib/lib/matplotlib/ticker.py	2007年07月16日 19:40:34 UTC (rev 3545)
@@ -274,7 +274,7 @@
 def __init__(self, useOffset=True, useMathText=False):
 # useOffset allows plotting small data ranges with large offsets:
 # for example: [1+1e-9,1+2e-9,1+3e-9]
- # useMathText will render the offset an scientific notation in mathtext
+ # useMathText will render the offset and scientific notation in mathtext
 self._useOffset = useOffset
 self._usetex = rcParams['text.usetex']
 self._useMathText = useMathText
@@ -292,7 +292,9 @@
 return self.pprint_val(x)
 
 def set_scientific(self, b):
- 'True or False to turn scientific notation on or off; see also set_powerlimits()'
+ '''True or False to turn scientific notation on or off
+ see also set_powerlimits()
+ '''
 self._scientific = bool(b)
 
 def set_powerlimits(self, lims):
@@ -311,11 +313,9 @@
 'return a short formatted string representation of a number'
 return '%1.3g'%value
 
- def format_data(self,value,sign=False,mathtext=False):
+ def format_data(self,value):
 'return a formatted string representation of a number'
- if sign: s = '%+1.10e'% value
- else: s = '%1.10e'% value
- return self._formatSciNotation(s,mathtext=mathtext)
+ return self._formatSciNotation('%1.10e'% value)
 
 def get_offset(self):
 """Return scientific notation, plus offset"""
@@ -324,16 +324,15 @@
 offsetStr = ''
 sciNotStr = ''
 if self.offset:
- if self._usetex or self._useMathText:
- offsetStr = self.format_data(self.offset, sign=True, mathtext=True)
- else:
- offsetStr = self.format_data(self.offset, sign=True, mathtext=False)
+ offsetStr = self.format_data(self.offset)
+ if self.offset > 0: offsetStr = '+' + offsetStr
 if self.orderOfMagnitude:
 if self._usetex or self._useMathText:
- sciNotStr = r'{\times}'+self.format_data(10**self.orderOfMagnitude, mathtext=True)
+ sciNotStr = r'{\times}'+self.format_data(10**self.orderOfMagnitude)
 else:
- sciNotStr = 'x1e%+d'% self.orderOfMagnitude
- if self._useMathText or self._usetex: return ''.join(('$',sciNotStr,offsetStr,'$'))
+ sciNotStr = u'\xd7'+'1e%d'% self.orderOfMagnitude
+ if self._useMathText or self._usetex: 
+ return ''.join(('$',sciNotStr,offsetStr,'$'))
 else: return ''.join((sciNotStr,offsetStr))
 else: return ''
 
@@ -402,14 +401,14 @@
 if absolute(xp) < 1e-8: xp = 0
 return self.format % xp
 
- def _formatSciNotation(self, s, mathtext=False):
+ def _formatSciNotation(self, s):
 # transform 1e+004 into 1e4, for example
 tup = s.split('e')
 try:
 significand = tup[0].rstrip('0').rstrip('.')
 sign = tup[1][0].replace('+', '')
 exponent = tup[1][1:].lstrip('0')
- if mathtext:
+ if self._useMathText or self._usetex:
 if significand == '1':
 # reformat 1x10^y as 10^y
 significand = ''
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <as...@us...> - 2007年07月17日 10:09:29
Revision: 3547
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3547&view=rev
Author: astraw
Date: 2007年07月17日 03:09:27 -0700 (2007年7月17日)
Log Message:
-----------
bugfix segfault in transforms module. Thanks Ben North for the patch
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/src/_transforms.cpp
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2007年07月16日 22:19:24 UTC (rev 3546)
+++ trunk/matplotlib/CHANGELOG	2007年07月17日 10:09:27 UTC (rev 3547)
@@ -1,3 +1,6 @@
+2007年07月17日 bugfix segfault in transforms module. Thanks Ben North for
+ the patch. - ADS
+
 2007年07月16日 clean up some code in ticker.ScalarFormatter, use unicode to
 render multiplication sign in offset ticklabel - DSD
 
Modified: trunk/matplotlib/src/_transforms.cpp
===================================================================
--- trunk/matplotlib/src/_transforms.cpp	2007年07月16日 22:19:24 UTC (rev 3546)
+++ trunk/matplotlib/src/_transforms.cpp	2007年07月17日 10:09:27 UTC (rev 3547)
@@ -33,7 +33,7 @@
 int
 LazyValue::compare(const Py::Object &other) {
 if (!check(other))
- throw Py::TypeError("Can on compare LazyValues with LazyValues");
+ throw Py::TypeError("Can only compare LazyValues with LazyValues");
 LazyValue* pother = static_cast<LazyValue*>(other.ptr());
 double valself = val();
 double valother = pother->val();
@@ -2079,12 +2079,13 @@
 
 args.verify_length(6);
 
- LazyValue::check(args[0]);
- LazyValue::check(args[1]);
- LazyValue::check(args[2]);
- LazyValue::check(args[3]);
- LazyValue::check(args[4]);
- LazyValue::check(args[5]);
+ if (!LazyValue::check(args[0])
+ || !LazyValue::check(args[1])
+ || !LazyValue::check(args[2])
+ || !LazyValue::check(args[3])
+ || !LazyValue::check(args[4])
+ || !LazyValue::check(args[5]))
+ throw Py::TypeError("Affine(a, b, c, d, tx, ty) expected 6 LazyValue args");
 
 LazyValue* a = static_cast<LazyValue*>(args[0].ptr());
 LazyValue* b = static_cast<LazyValue*>(args[1].ptr());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ds...@us...> - 2007年07月17日 15:35:52
Revision: 3552
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3552&view=rev
Author: dsdale
Date: 2007年07月17日 08:35:41 -0700 (2007年7月17日)
Log Message:
-----------
validate rcParams
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/lib/matplotlib/__init__.py
 trunk/matplotlib/lib/matplotlib/rcsetup.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2007年07月17日 13:40:56 UTC (rev 3551)
+++ trunk/matplotlib/CHANGELOG	2007年07月17日 15:35:41 UTC (rev 3552)
@@ -1,3 +1,5 @@
+2007年07月17日 added validation to setting and changing rcParams - DSD
+
 2007年07月17日 bugfix segfault in transforms module. Thanks Ben North for
 the patch. - ADS
 
Modified: trunk/matplotlib/lib/matplotlib/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/__init__.py	2007年07月17日 13:40:56 UTC (rev 3551)
+++ trunk/matplotlib/lib/matplotlib/__init__.py	2007年07月17日 15:35:41 UTC (rev 3552)
@@ -518,34 +518,6 @@
 return fname
 
 
-def validate_key(key, val, line, cnt, fname, fail_on_error):
- if key in _deprecated_map.keys():
- alt = _deprecated_map[key]
- warnings.warn('%s is deprecated in matplotlibrc - use %s instead.' % (key, alt))
- key = alt
-
- if not defaultParams.has_key(key):
- print >> sys.stderr, """\
-Bad key "%s" on line %d in
-%s.
-You probably need to get an updated matplotlibrc file from
-http://matplotlib.sf.net/matplotlibrc or from the matplotlib source
-distribution""" % (key, cnt, fname)
- return None
-
- default, converter = defaultParams[key]
-
- if fail_on_error:
- return converter(val) # try to convert to proper type or raise
- else:
- try: cval = converter(val) # try to convert to proper type or raise
- except Exception, msg:
- warnings.warn('Bad val "%s" on line #%d\n\t"%s"\n\tin file "%s"\n\t%s' % (
- val, cnt, line, fname, msg))
- return None
- else:
- return cval
-
 _deprecated_map = {
 'text.fontstyle': 'font.style',
 'text.fontangle': 'font.style',
@@ -555,6 +527,31 @@
 'tick.size' : 'tick.major.size',
 }
 
+
+class RcParams(dict):
+ 
+ """A dictionary object including validation
+ """
+ 
+ validate = dict([ (key, converter) for key, (default, converter) in \
+ defaultParams.iteritems() ])
+ 
+ fail_on_error = False
+ 
+ def __setitem__(self, key, val):
+ try:
+ if key in _deprecated_map.keys():
+ alt = _deprecated_map[key]
+ warnings.warn('%s is deprecated in matplotlibrc. Use %s \
+instead.'% (key, alt))
+ key = alt
+ cval = self.validate[key](val)
+ dict.__setitem__(self, key, cval)
+ except KeyError:
+ raise KeyError('%s is not a valid rc parameter.\
+See rcParams.keys() for a list of valid parameters.'%key)
+
+
 def rc_params(fail_on_error=False):
 'Return the default params updated from the values in the rc file'
 
@@ -573,7 +570,8 @@
 if not strippedline: continue
 tup = strippedline.split(':',1)
 if len(tup) !=2:
- warnings.warn('Illegal line #%d\n\t%s\n\tin file "%s"' % (cnt, line, fname))
+ warnings.warn('Illegal line #%d\n\t%s\n\tin file "%s"'%\
+ (cnt, line, fname))
 continue
 key, val = tup
 key = key.strip()
@@ -582,35 +580,53 @@
 warnings.warn('Duplicate key in file "%s", line #%d'%(fname,cnt))
 rc_temp[key] = (val, line, cnt)
 
- ret = dict([ (key,default) for key, (default, converter) in defaultParams.iteritems() ])
+ ret = RcParams([ (key, default) for key, (default, converter) in \
+ defaultParams.iteritems() ])
 
 for key in ('verbose.level', 'verbose.fileo'):
 if key in rc_temp:
 val, line, cnt = rc_temp.pop(key)
- cval = validate_key(key, val, line, cnt, fname, fail_on_error)
- if cval is not None:
- ret[key] = cval
+ if fail_on_error:
+ ret[key] = val # try to convert to proper type or raise
+ else:
+ try: ret[key] = val # try to convert to proper type or skip
+ except Exception, msg:
+ warnings.warn('Bad val "%s" on line #%d\n\t"%s"\n\tin file \
+"%s"\n\t%s' % (val, cnt, line, fname, msg))
 
 verbose.set_level(ret['verbose.level'])
 verbose.set_fileo(ret['verbose.fileo'])
 
 for key, (val, line, cnt) in rc_temp.iteritems():
- cval = validate_key(key, val, line, cnt, fname, fail_on_error)
- if cval is not None:
- ret[key] = cval
+ if defaultParams.has_key(key):
+ if fail_on_error:
+ ret[key] = val # try to convert to proper type or raise
+ else:
+ try: ret[key] = val # try to convert to proper type or skip
+ except Exception, msg:
+ warnings.warn('Bad val "%s" on line #%d\n\t"%s"\n\tin file \
+"%s"\n\t%s' % (val, cnt, line, fname, msg))
+ else:
+ print >> sys.stderr, """
+Bad key "%s" on line %d in
+%s.
+You probably need to get an updated matplotlibrc file from
+http://matplotlib.sf.net/matplotlibrc or from the matplotlib source
+distribution""" % (key, cnt, fname)
 
 if ret['datapath'] is None:
 ret['datapath'] = get_data_path()
 
 verbose.report('loaded rc file %s'%fname)
-
+ 
 return ret
 
 
 # this is the instance used by the matplotlib classes
 rcParams = rc_params()
 
-rcParamsDefault = dict(rcParams.items()) # a copy
+rcParamsDefault = RcParams([ (key, default) for key, (default, converter) in \
+ defaultParams.iteritems() ])
 
 rcParams['ps.usedistiller'] = checkdep_ps_distiller(rcParams['ps.usedistiller'])
 rcParams['text.usetex'] = checkdep_usetex(rcParams['text.usetex'])
Modified: trunk/matplotlib/lib/matplotlib/rcsetup.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/rcsetup.py	2007年07月17日 13:40:56 UTC (rev 3551)
+++ trunk/matplotlib/lib/matplotlib/rcsetup.py	2007年07月17日 15:35:41 UTC (rev 3552)
@@ -36,8 +36,8 @@
 'Convert b to a boolean or raise'
 if type(b) is str:
 b = b.lower()
- if b in ('t', 'y', 'yes', 'true', '1', 1, True): return True
- elif b in ('f', 'n', 'no', 'false', '0', 0, False): return False
+ if b in ('t', 'y', 'yes', 'on', 'true', '1', 1, True): return True
+ elif b in ('f', 'n', 'no', 'off', 'false', '0', 0, False): return False
 else:
 raise ValueError('Could not convert "%s" to boolean' % b)
 
@@ -142,12 +142,15 @@
 
 if len(s)==6 and s.isalnum(): # looks like hex
 return '#' + s
+ 
+ if len(s)==7 and s.startswith('#') and s[1:].isalnum():
+ return s
 
 if s.isalpha():
 #assuming a color name, hold on
 return s
 
- raise ValueError('"s" does not look like color arg')
+ raise ValueError('%s does not look like color arg'%s)
 
 def validate_stringlist(s):
 'return a list'
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jd...@us...> - 2007年07月17日 22:15:45
Revision: 3554
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3554&view=rev
Author: jdh2358
Date: 2007年07月17日 15:15:44 -0700 (2007年7月17日)
Log Message:
-----------
recleanup of axes imports
Modified Paths:
--------------
 trunk/matplotlib/README
 trunk/matplotlib/examples/agg_test.py
 trunk/matplotlib/lib/matplotlib/__init__.py
 trunk/matplotlib/lib/matplotlib/axes.py
 trunk/matplotlib/setup.py
Modified: trunk/matplotlib/README
===================================================================
--- trunk/matplotlib/README	2007年07月17日 16:37:14 UTC (rev 3553)
+++ trunk/matplotlib/README	2007年07月17日 22:15:44 UTC (rev 3554)
@@ -54,8 +54,8 @@
 
 AUTHOR
 
- John D. Hunter <jdh...@ac...>
- Copyright (c) 2002-2004 John D. Hunter; All Rights Reserved.
+ John D. Hunter <jd...@gm...>
+ Copyright (c) 2002-2007 John D. Hunter; All Rights Reserved.
 
 Jeremy O'Donoghue wrote the wx backend
 
Modified: trunk/matplotlib/examples/agg_test.py
===================================================================
--- trunk/matplotlib/examples/agg_test.py	2007年07月17日 16:37:14 UTC (rev 3553)
+++ trunk/matplotlib/examples/agg_test.py	2007年07月17日 22:15:44 UTC (rev 3554)
@@ -106,39 +106,42 @@
 renderer.color_rgba8( white )
 agg.render_scanlines_rgba(rasterizer, scanline, renderer);
 
-## Copy a rectangle from the buffer the rectangle defined by
-## x0,y0->x1,y1 and paste it at xdest, ydest
-x0, y0 = 10, 50
-x1, y1 = 110, 190
-xdest, ydest = 350, 200
+if 0:
+ ## Copy a rectangle from the buffer the rectangle defined by
+ ## x0,y0->x1,y1 and paste it at xdest, ydest
+ x0, y0 = 10, 50
+ x1, y1 = 110, 190
+ xdest, ydest = 350, 200
 
 
-widthr, heightr = x1-x0, y1-y0
-strider = widthr*4
-copybuffer = agg.buffer(widthr, heightr, strider)
 
-rbufcopy = agg.rendering_buffer()
-rbufcopy.attachb(copybuffer)
-pfcopy = agg.pixel_format_rgba(rbufcopy)
-rbasecopy = agg.renderer_base_rgba(pfcopy)
+ widthr, heightr = x1-x0, y1-y0
+ strider = widthr*4
+ copybuffer = agg.buffer(widthr, heightr, strider)
 
-rect = agg.rect(x0, y0, x1, y1)
-print rect.is_valid()
-rectp = agg.rectPtr(rect)
-#print dir(rbasecopy)
 
-# agg is funny about the arguments to copy from; the last 2 args are
-# dx, dy. If the src and dest buffers are the same size and you omit
-# the dx and dy args, the position of the copy in the dest buffer is
-# the same as in the src. Since our dest buffer is smaller than our
-# src buffer, we have to offset the location by -x0, -y0
-rbasecopy.copy_from(rbuf, rect, -x0, -y0);
+ rbufcopy = agg.rendering_buffer()
+ rbufcopy.attachb(copybuffer)
+ pfcopy = agg.pixel_format_rgba(rbufcopy)
+ rbasecopy = agg.renderer_base_rgba(pfcopy)
 
-# paste the rectangle at a new location xdest, ydest
-rbase.copy_from(rbufcopy, None, xdest, ydest);
+ rect = agg.rect(x0, y0, x1, y1)
+ print rect.is_valid()
+ rectp = agg.rectPtr(rect)
+ #print dir(rbasecopy)
 
+ # agg is funny about the arguments to copy from; the last 2 args are
+ # dx, dy. If the src and dest buffers are the same size and you omit
+ # the dx and dy args, the position of the copy in the dest buffer is
+ # the same as in the src. Since our dest buffer is smaller than our
+ # src buffer, we have to offset the location by -x0, -y0
+ rbasecopy.copy_from(rbuf, rect, -x0, -y0);
 
+ # paste the rectangle at a new location xdest, ydest
+ rbase.copy_from(rbufcopy, None, xdest, ydest);
 
+
+
 ## Display it with PIL
 s = buffer.to_string()
 print len(s)
Modified: trunk/matplotlib/lib/matplotlib/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/__init__.py	2007年07月17日 16:37:14 UTC (rev 3553)
+++ trunk/matplotlib/lib/matplotlib/__init__.py	2007年07月17日 22:15:44 UTC (rev 3554)
@@ -801,8 +801,6 @@
 """
 pass
 
-
-
 class Namespace:
 """
 A class which takes a list of modules and creates an object with
@@ -832,3 +830,4 @@
 mod = getattr(basemod, name)
 setattr(self, name, mod)
 
+
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py	2007年07月17日 16:37:14 UTC (rev 3553)
+++ trunk/matplotlib/lib/matplotlib/axes.py	2007年07月17日 22:15:44 UTC (rev 3554)
@@ -8,11 +8,32 @@
 import matplotlib
 rcParams = matplotlib.rcParams
 
-# import a bunch of matplotlib modules into a single namespace
-mpl = matplotlib.Importer("""artist, agg, axis, cbook, collections, colors,
- contour, dates, font_manager, image, legend, lines, mlab, cm,
- patches, quiver, table, text, ticker, transforms""")
+from matplotlib import artist as martist
+from matplotlib import agg 
+from matplotlib import axis as maxis
+from matplotlib import cbook 
+from matplotlib import collections as mcoll
+from matplotlib import colors as mcolors
+from matplotlib import contour as mcontour
+from matplotlib import dates as mdates
+from matplotlib import font_manager 
+from matplotlib import image as mimage
+from matplotlib import legend as mlegend
+from matplotlib import lines as mlines
+from matplotlib import mlab 
+from matplotlib import cm 
+from matplotlib import patches as mpatches
+from matplotlib import quiver as mquiver
+from matplotlib import table as mtable
+from matplotlib import text as mtext
+from matplotlib import ticker as mticker
+from matplotlib import transforms as mtrans
 
+iterable = cbook.iterable
+is_string_like = cbook.is_string_like
+
+
+
 def delete_masked_points(*args):
 """
 Find all masked points in a set of arguments, and return
@@ -35,9 +56,11 @@
 return args
 mask = reduce(ma.mask_or, masks)
 margs = []
+ is_string_like = mpl_cbook.is_string_like
+ iterable = mpl_cbook.iterable
 for x in args:
- if (not mpl.cbook.is_string_like(x)
- and mpl.cbook.iterable(x)
+ if (not is_string_like(x)
+ and iterable(x)
 and len(x) == len(mask)):
 if (hasattr(x, 'get_compressed_copy')):
 compressed_x = x.get_compressed_copy(mask)
@@ -69,7 +92,7 @@
 
 # Is fmt just a colorspec?
 try:
- color = mpl.colors.colorConverter.to_rgb(fmt)
+ color = mcolors.colorConverter.to_rgb(fmt)
 return linestyle, marker, color # Yes.
 except ValueError:
 pass # No, not just a color.
@@ -89,17 +112,17 @@
 chars = [c for c in fmt]
 
 for c in chars:
- if mpl.lines.lineStyles.has_key(c):
+ if mlines.lineStyles.has_key(c):
 if linestyle is not None:
 raise ValueError(
 'Illegal format string "%s"; two linestyle symbols' % fmt)
 linestyle = c
- elif mpl.lines.lineMarkers.has_key(c):
+ elif mlines.lineMarkers.has_key(c):
 if marker is not None:
 raise ValueError(
 'Illegal format string "%s"; two marker symbols' % fmt)
 marker = c
- elif mpl.colors.colorConverter.colors.has_key(c):
+ elif mcolors.colorConverter.colors.has_key(c):
 if color is not None:
 raise ValueError(
 'Illegal format string "%s"; two color symbols' % fmt)
@@ -240,7 +263,7 @@
 if multicol:
 for j in range(y.shape[1]):
 color = self._get_next_cycle_color()
- seg = mpl.lines.Line2D(x, y[:,j],
+ seg = mlines.Line2D(x, y[:,j],
 color = color,
 axes=self.axes,
 )
@@ -248,7 +271,7 @@
 ret.append(seg)
 else:
 color = self._get_next_cycle_color()
- seg = mpl.lines.Line2D(x, y,
+ seg = mlines.Line2D(x, y,
 color = color,
 axes=self.axes,
 )
@@ -259,7 +282,7 @@
 
 def _plot_2_args(self, tup2, **kwargs):
 ret = []
- if mpl.cbook.is_string_like(tup2[1]):
+ if is_string_like(tup2[1]):
 
 assert self.command == 'plot', 'fill needs at least 2 non-string arguments'
 y, fmt = tup2
@@ -271,7 +294,7 @@
 _color = color
 if _color is None:
 _color = self._get_next_cycle_color()
- seg = mpl.lines.Line2D(x, y,
+ seg = mlines.Line2D(x, y,
 color=_color,
 linestyle=linestyle, marker=marker,
 axes=self.axes,
@@ -293,7 +316,7 @@
 
 def makeline(x, y):
 color = self._get_next_cycle_color()
- seg = mpl.lines.Line2D(x, y,
+ seg = mlines.Line2D(x, y,
 color=color,
 axes=self.axes,
 )
@@ -302,7 +325,7 @@
 
 def makefill(x, y):
 facecolor = self._get_next_cycle_color()
- seg = mpl.patches.Polygon(zip(x, y),
+ seg = mpatches.Polygon(zip(x, y),
 facecolor = facecolor,
 fill=True,
 )
@@ -333,7 +356,7 @@
 _color = color
 if _color is None:
 _color = self._get_next_cycle_color()
- seg = mpl.lines.Line2D(x, y,
+ seg = mlines.Line2D(x, y,
 color=_color,
 linestyle=linestyle, marker=marker,
 axes=self.axes,
@@ -343,7 +366,7 @@
 
 def makefill(x, y):
 facecolor = color
- seg = mpl.patches.Polygon(zip(x, y),
+ seg = mpatches.Polygon(zip(x, y),
 facecolor = facecolor,
 fill=True,
 )
@@ -377,13 +400,13 @@
 remaining = []
 continue
 if len(remaining)==3:
- if not mpl.cbook.is_string_like(remaining[2]):
+ if not is_string_like(remaining[2]):
 raise ValueError, 'third arg must be a format string'
 for seg in self._plot_3_args(remaining, **kwargs):
 yield seg
 remaining=[]
 continue
- if mpl.cbook.is_string_like(remaining[2]):
+ if is_string_like(remaining[2]):
 for seg in self._plot_3_args(remaining[:3], **kwargs):
 yield seg
 remaining=remaining[3:]
@@ -392,15 +415,15 @@
 yield seg
 remaining=remaining[2:]
 
-ValueType=type(mpl.transforms.zero())
+ValueType=type(mtrans.zero())
 def makeValue(v):
 if type(v) == ValueType:
 return v
 else:
- return mpl.transforms.Value(v)
+ return mtrans.Value(v)
 
 
-class Axes(mpl.artist.Artist):
+class Axes(martist.Artist):
 """
 The Axes contains most of the figure elements: Axis, Tick, Line2D,
 Text, Polygon etc, and sets the coordinate system
@@ -413,8 +436,8 @@
 
 """
 
- scaled = {mpl.transforms.IDENTITY : 'linear',
- mpl.transforms.LOG10 : 'log',
+ scaled = {mtrans.IDENTITY : 'linear',
+ mtrans.LOG10 : 'log',
 }
 
 def __str__(self):
@@ -463,7 +486,7 @@
 yticks: sequence of floats
 
 """
- mpl.artist.Artist.__init__(self)
+ martist.Artist.__init__(self)
 self._position = map(makeValue, rect)
 self._originalPosition = rect
 self.set_axes(self)
@@ -506,7 +529,7 @@
 self.set_navigate(True)
 self.set_navigate_mode(None)
 
- if len(kwargs): mpl.artist.setp(self, **kwargs)
+ if len(kwargs): martist.setp(self, **kwargs)
 
 if self.xaxis is not None:
 self._xcid = self.xaxis.callbacks.connect('units finalize', self.relim)
@@ -521,8 +544,8 @@
 
 def _init_axis(self):
 "move this out of __init__ because non-separable axes don't use it"
- self.xaxis = mpl.axis.XAxis(self)
- self.yaxis = mpl.axis.YAxis(self)
+ self.xaxis = maxis.XAxis(self)
+ self.yaxis = maxis.YAxis(self)
 
 
 def sharex_foreign(self, axforeign):
@@ -594,7 +617,7 @@
 
 ACCEPTS: a Figure instance
 """
- mpl.artist.Artist.set_figure(self, fig)
+ martist.Artist.set_figure(self, fig)
 
 l, b, w, h = self._position
 xmin = fig.bbox.ll().x()
@@ -609,8 +632,8 @@
 self.top = (b+h)*figh
 
 
- Bbox = mpl.transforms.Bbox
- Point = mpl.transforms.Point
+ Bbox = mtrans.Bbox
+ Point = mtrans.Point
 self.bbox = Bbox(
 Point(self.left, self.bottom),
 Point(self.right, self.top ),
@@ -625,10 +648,10 @@
 """
 
 
- one = mpl.transforms.one
- zero = mpl.transforms.zero
- Point = mpl.transforms.Point
- Bbox = mpl.transforms.Bbox
+ one = mtrans.one
+ zero = mtrans.zero
+ Point = mtrans.Point
+ Bbox = mtrans.Bbox
 if self._sharex is not None:
 left=self._sharex.viewLim.ll().x()
 right=self._sharex.viewLim.ur().x()
@@ -645,12 +668,12 @@
 
 
 self.viewLim = Bbox(Point(left, bottom), Point(right, top))
- self.dataLim = mpl.transforms.unit_bbox()
+ self.dataLim = mtrans.unit_bbox()
 
- self.transData = mpl.transforms.get_bbox_transform(
+ self.transData = mtrans.get_bbox_transform(
 self.viewLim, self.bbox)
- self.transAxes = mpl.transforms.get_bbox_transform(
- mpl.transforms.unit_bbox(), self.bbox)
+ self.transAxes = mtrans.get_bbox_transform(
+ mtrans.unit_bbox(), self.bbox)
 
 if self._sharex:
 self.transData.set_funcx(self._sharex.transData.get_funcx())
@@ -701,7 +724,7 @@
 self.yaxis.cla()
 
 self.dataLim.ignore(1)
- self.callbacks = mpl.cbook.CallbackRegistry(('xlim_changed', 'ylim_changed'))
+ self.callbacks = cbook.CallbackRegistry(('xlim_changed', 'ylim_changed'))
 
 if self._sharex is not None:
 self.xaxis.major = self._sharex.xaxis.major
@@ -726,8 +749,8 @@
 self._autoscaleon = True
 
 self.grid(self._gridOn)
- props = mpl.font_manager.FontProperties(size=rcParams['axes.titlesize'])
- self.title = mpl.text.Text(
+ props = font_manager.FontProperties(size=rcParams['axes.titlesize'])
+ self.title = mtext.Text(
 x=0.5, y=1.02, text='',
 fontproperties=props,
 verticalalignment='bottom',
@@ -738,7 +761,7 @@
 
 self._set_artist_props(self.title)
 
- self.axesPatch = mpl.patches.Rectangle(
+ self.axesPatch = mpatches.Rectangle(
 xy=(0,0), width=1, height=1,
 facecolor=self._axisbg,
 edgecolor=rcParams['axes.edgecolor'],
@@ -746,7 +769,7 @@
 self.axesPatch.set_figure(self.figure)
 self.axesPatch.set_transform(self.transAxes)
 self.axesPatch.set_linewidth(rcParams['axes.linewidth'])
- self.axesFrame = mpl.lines.Line2D((0,1,1,0,0), (0,0,1,1,0),
+ self.axesFrame = mlines.Line2D((0,1,1,0,0), (0,0,1,1,0),
 linewidth=rcParams['axes.linewidth'],
 color=rcParams['axes.edgecolor'],
 figure=self.figure)
@@ -840,7 +863,7 @@
 """
 ACCEPTS: ['C', 'SW', 'S', 'SE', 'E', 'NE', 'N', 'NW', 'W']
 """
- if anchor in mpl.transforms.PBox.coefs.keys() or len(anchor) == 2:
+ if anchor in mtrans.PBox.coefs.keys() or len(anchor) == 2:
 self._anchor = anchor
 else:
 raise ValueError('argument must be among %s' %
@@ -880,7 +903,7 @@
 if data_ratio is None:
 data_ratio = ysize/xsize
 box_aspect = A * data_ratio
- pb = mpl.transforms.PBox(self._originalPosition)
+ pb = mtrans.PBox(self._originalPosition)
 pb1 = pb.shrink_to_aspect(box_aspect, fig_aspect)
 self.set_position(pb1.anchor(self._anchor), 'active')
 return
@@ -953,7 +976,7 @@
 kwargs are passed on to set_xlim and set_ylim -- see their
 docstrings for details
 '''
- if len(v)==1 and mpl.cbook.is_string_like(v[0]):
+ if len(v)==1 and is_string_like(v[0]):
 s = v[0].lower()
 if s=='on': self.set_axis_on()
 elif s=='off': self.set_axis_off()
@@ -1020,11 +1043,11 @@
 
 def get_images(self):
 'return a list of Axes images contained by the Axes'
- return mpl.cbook.silent_list('AxesImage', self.images)
+ return cbook.silent_list('AxesImage', self.images)
 
 def get_lines(self):
 'Return a list of lines contained by the Axes'
- return mpl.cbook.silent_list('Line2D', self.lines)
+ return cbook.silent_list('Line2D', self.lines)
 
 def get_xaxis(self):
 'Return the XAxis instance'
@@ -1032,12 +1055,12 @@
 
 def get_xgridlines(self):
 'Get the x grid lines as a list of Line2D instances'
- return mpl.cbook.silent_list('Line2D xgridline', self.xaxis.get_gridlines())
+ return cbook.silent_list('Line2D xgridline', self.xaxis.get_gridlines())
 
 
 def get_xticklines(self):
 'Get the xtick lines as a list of Line2D instances'
- return mpl.cbook.silent_list('Text xtickline', self.xaxis.get_ticklines())
+ return cbook.silent_list('Text xtickline', self.xaxis.get_ticklines())
 
 
 def get_yaxis(self):
@@ -1046,11 +1069,11 @@
 
 def get_ygridlines(self):
 'Get the y grid lines as a list of Line2D instances'
- return mpl.cbook.silent_list('Line2D ygridline', self.yaxis.get_gridlines())
+ return cbook.silent_list('Line2D ygridline', self.yaxis.get_gridlines())
 
 def get_yticklines(self):
 'Get the ytick lines as a list of Line2D instances'
- return mpl.cbook.silent_list('Line2D ytickline', self.yaxis.get_ticklines())
+ return cbook.silent_list('Line2D ytickline', self.yaxis.get_ticklines())
 
 #### Adding and tracking artists
 
@@ -1265,7 +1288,7 @@
 im.draw(renderer)
 else:
 # make a composite image blending alpha
- # list of (mpl.image.Image, ox, oy)
+ # list of (mimage.Image, ox, oy)
 
 
 mag = renderer.get_image_magnification()
@@ -1273,7 +1296,7 @@
 for im in self.images if im.get_visible()]
 
 
- im = mpl.image.from_images(self.bbox.height()*mag,
+ im = mimage.from_images(self.bbox.height()*mag,
 self.bbox.width()*mag,
 ims)
 im.is_grayscale = False
@@ -1398,7 +1421,7 @@
 if len(kwargs): b = True
 self.xaxis.grid(b, **kwargs)
 self.yaxis.grid(b, **kwargs)
- grid.__doc__ = mpl.cbook.dedent(grid.__doc__) % mpl.artist.kwdocd
+ grid.__doc__ = cbook.dedent(grid.__doc__) % martist.kwdocd
 
 def ticklabel_format(self, **kwargs):
 """
@@ -1499,7 +1522,7 @@
 ACCEPTS: len(2) sequence of floats
 """
 
- if xmax is None and mpl.cbook.iterable(xmin):
+ if xmax is None and iterable(xmin):
 xmin,xmax = xmin
 
 
@@ -1513,11 +1536,11 @@
 if xmin is None: xmin = old_xmin
 if xmax is None: xmax = old_xmax
 
- if (self.transData.get_funcx().get_type()==mpl.transforms.LOG10
+ if (self.transData.get_funcx().get_type()==mtrans.LOG10
 and min(xmin, xmax)<=0):
 raise ValueError('Cannot set nonpositive limits with log transform')
 
- xmin, xmax = mpl.transforms.nonsingular(xmin, xmax, increasing=False)
+ xmin, xmax = mtrans.nonsingular(xmin, xmax, increasing=False)
 self.viewLim.intervalx().set_bounds(xmin, xmax)
 if emit: self.callbacks.process('xlim_changed', self)
 
@@ -1549,19 +1572,19 @@
 #if subsx is None: subsx = range(2, basex)
 assert(value.lower() in ('log', 'linear', ))
 if value == 'log':
- self.xaxis.set_major_locator(mpl.ticker.LogLocator(basex))
- self.xaxis.set_major_formatter(mpl.ticker.LogFormatterMathtext(basex))
- self.xaxis.set_minor_locator(mpl.ticker.LogLocator(basex,subsx))
- self.transData.get_funcx().set_type(mpl.transforms.LOG10)
+ self.xaxis.set_major_locator(mticker.LogLocator(basex))
+ self.xaxis.set_major_formatter(mticker.LogFormatterMathtext(basex))
+ self.xaxis.set_minor_locator(mticker.LogLocator(basex,subsx))
+ self.transData.get_funcx().set_type(mtrans.LOG10)
 minx, maxx = self.get_xlim()
 if min(minx, maxx)<=0:
 self.autoscale_view()
 elif value == 'linear':
- self.xaxis.set_major_locator(mpl.ticker.AutoLocator())
- self.xaxis.set_major_formatter(mpl.ticker.ScalarFormatter())
- self.xaxis.set_minor_locator(mpl.ticker.NullLocator())
- self.xaxis.set_minor_formatter(mpl.ticker.NullFormatter())
- self.transData.get_funcx().set_type( mpl.transforms.IDENTITY )
+ self.xaxis.set_major_locator(mticker.AutoLocator())
+ self.xaxis.set_major_formatter(mticker.ScalarFormatter())
+ self.xaxis.set_minor_locator(mticker.NullLocator())
+ self.xaxis.set_minor_formatter(mticker.NullFormatter())
+ self.transData.get_funcx().set_type( mtrans.IDENTITY )
 
 def get_xticks(self):
 'Return the x ticks as a list of locations'
@@ -1577,7 +1600,7 @@
 
 def get_xticklabels(self):
 'Get the xtick labels as a list of Text instances'
- return mpl.cbook.silent_list('Text xticklabel', self.xaxis.get_ticklabels())
+ return cbook.silent_list('Text xticklabel', self.xaxis.get_ticklabels())
 
 def set_xticklabels(self, labels, fontdict=None, **kwargs):
 """
@@ -1592,7 +1615,7 @@
 ACCEPTS: sequence of strings
 """
 return self.xaxis.set_ticklabels(labels, fontdict, **kwargs)
- set_xticklabels.__doc__ = mpl.cbook.dedent(set_xticklabels.__doc__) % mpl.artist.kwdocd
+ set_xticklabels.__doc__ = cbook.dedent(set_xticklabels.__doc__) % martist.kwdocd
 
 def get_ylim(self):
 'Get the y axis range [ymin, ymax]'
@@ -1621,7 +1644,7 @@
 """
 
 
- if ymax is None and mpl.cbook.iterable(ymin):
+ if ymax is None and iterable(ymin):
 ymin,ymax = ymin
 
 if ymin is not None:
@@ -1634,11 +1657,11 @@
 if ymin is None: ymin = old_ymin
 if ymax is None: ymax = old_ymax
 
- if (self.transData.get_funcy().get_type()==mpl.transforms.LOG10
+ if (self.transData.get_funcy().get_type()==mtrans.LOG10
 and min(ymin, ymax)<=0):
 raise ValueError('Cannot set nonpositive limits with log transform')
 
- ymin, ymax = mpl.transforms.nonsingular(ymin, ymax, increasing=False)
+ ymin, ymax = mtrans.nonsingular(ymin, ymax, increasing=False)
 self.viewLim.intervaly().set_bounds(ymin, ymax)
 if emit: self.callbacks.process('ylim_changed', self)
 
@@ -1671,20 +1694,20 @@
 assert(value.lower() in ('log', 'linear', ))
 
 if value == 'log':
- self.yaxis.set_major_locator(mpl.ticker.LogLocator(basey))
- self.yaxis.set_major_formatter(mpl.ticker.LogFormatterMathtext(basey))
- self.yaxis.set_minor_locator(mpl.ticker.LogLocator(basey,subsy))
- self.transData.get_funcy().set_type(mpl.transforms.LOG10)
+ self.yaxis.set_major_locator(mticker.LogLocator(basey))
+ self.yaxis.set_major_formatter(mticker.LogFormatterMathtext(basey))
+ self.yaxis.set_minor_locator(mticker.LogLocator(basey,subsy))
+ self.transData.get_funcy().set_type(mtrans.LOG10)
 miny, maxy = self.get_ylim()
 if min(miny, maxy)<=0:
 self.autoscale_view()
 
 elif value == 'linear':
- self.yaxis.set_major_locator(mpl.ticker.AutoLocator())
- self.yaxis.set_major_formatter(mpl.ticker.ScalarFormatter())
- self.yaxis.set_minor_locator(mpl.ticker.NullLocator())
- self.yaxis.set_minor_formatter(mpl.ticker.NullFormatter())
- self.transData.get_funcy().set_type( mpl.transforms.IDENTITY )
+ self.yaxis.set_major_locator(mticker.AutoLocator())
+ self.yaxis.set_major_formatter(mticker.ScalarFormatter())
+ self.yaxis.set_minor_locator(mticker.NullLocator())
+ self.yaxis.set_minor_formatter(mticker.NullFormatter())
+ self.transData.get_funcy().set_type( mtrans.IDENTITY )
 
 def get_yticks(self):
 'Return the y ticks as a list of locations'
@@ -1700,7 +1723,7 @@
 
 def get_yticklabels(self):
 'Get the ytick labels as a list of Text instances'
- return mpl.cbook.silent_list('Text yticklabel', self.yaxis.get_ticklabels())
+ return cbook.silent_list('Text yticklabel', self.yaxis.get_ticklabels())
 
 def set_yticklabels(self, labels, fontdict=None, **kwargs):
 """
@@ -1715,13 +1738,13 @@
 ACCEPTS: sequence of strings
 """
 return self.yaxis.set_ticklabels(labels, fontdict, **kwargs)
- set_yticklabels.__doc__ = mpl.cbook.dedent(set_yticklabels.__doc__) % mpl.artist.kwdocd
+ set_yticklabels.__doc__ = cbook.dedent(set_yticklabels.__doc__) % martist.kwdocd
 
 def toggle_log_lineary(self):
 'toggle between log and linear on the y axis'
 funcy = self.transData.get_funcy().get_type()
- if funcy==mpl.transforms.LOG10: self.set_yscale('linear')
- elif funcy==mpl.transforms.IDENTITY: self.set_yscale('log')
+ if funcy==mtrans.LOG10: self.set_yscale('linear')
+ elif funcy==mtrans.IDENTITY: self.set_yscale('log')
 
 def xaxis_date(self, tz=None):
 """Sets up x-axis ticks and labels that treat the x data as dates.
@@ -1730,13 +1753,13 @@
 """
 
 locator = self.xaxis.get_major_locator()
- if not isinstance(locator, mpl.dates.DateLocator):
- locator = mpl.dates.AutoDateLocator(tz)
+ if not isinstance(locator, mdates.DateLocator):
+ locator = mdates.AutoDateLocator(tz)
 self.xaxis.set_major_locator(locator)
 
 formatter = self.xaxis.get_major_formatter()
- if not isinstance(formatter, mpl.dates.DateFormatter):
- formatter = mpl.dates.AutoDateFormatter(locator)
+ if not isinstance(formatter, mdates.DateFormatter):
+ formatter = mdates.AutoDateFormatter(locator)
 self.xaxis.set_major_formatter(formatter)
 
 def yaxis_date(self, tz=None):
@@ -1746,13 +1769,13 @@
 """
 
 locator = self.yaxis.get_major_locator()
- if not isinstance(locator, mpl.dates.DateLocator):
- locator = mpl.dates.AutoDateLocator(tz)
+ if not isinstance(locator, mdates.DateLocator):
+ locator = mdates.AutoDateLocator(tz)
 self.yaxis.set_major_locator(locator)
 
 formatter = self.xaxis.get_major_formatter()
- if not isinstance(formatter, mpl.dates.DateFormatter):
- formatter = mpl.dates.AutoDateFormatter(locator)
+ if not isinstance(formatter, mdates.DateFormatter):
+ formatter = mdates.AutoDateFormatter(locator)
 self.yaxis.set_major_formatter(formatter)
 
 def format_xdata(self, x):
@@ -1836,7 +1859,7 @@
 lw, c = args
 else:
 raise ValueError('args must be a (linewidth, color) tuple')
- c =mpl.colors.colorConverter.to_rgba(c)
+ c =mcolors.colorConverter.to_rgba(c)
 self._cursorProps = lw, c
 
 
@@ -1924,7 +1947,7 @@
 if len(args)>1:
 raise DeprecationWarning(
 'New pick API implemented -- see API_CHANGES in the src distribution')
- mpl.artist.Artist.pick(self,args[0])
+ martist.Artist.pick(self,args[0])
 
 def __pick(self, x, y, trans=None, among=None):
 """
@@ -1969,7 +1992,7 @@
 verts = a.get_verts()
 tverts = a.get_transform().seq_xy_tups(verts)
 xt, yt = zip(*tverts)
- elif isinstance(a, mpl.lines.Line2D):
+ elif isinstance(a, mlines.Line2D):
 xdata = a.get_xdata(orig=False)
 ydata = a.get_ydata(orig=False)
 xt, yt = a.get_transform().numerix_x_y(xdata, ydata)
@@ -1979,7 +2002,7 @@
 artists = self.lines + self.patches + self.texts
 if callable(among):
 artists = filter(test, artists)
- elif mpl.cbook.iterable(among):
+ elif iterable(among):
 amongd = dict([(k,1) for k in among])
 artists = [a for a in artists if a in amongd]
 elif among is None:
@@ -2018,7 +2041,7 @@
 if fontdict is not None: self.title.update(fontdict)
 self.title.update(kwargs)
 return self.title
- set_title.__doc__ = mpl.cbook.dedent(set_title.__doc__) % mpl.artist.kwdocd
+ set_title.__doc__ = cbook.dedent(set_title.__doc__) % martist.kwdocd
 
 def set_xlabel(self, xlabel, fontdict=None, **kwargs):
 """
@@ -2037,7 +2060,7 @@
 if fontdict is not None: label.update(fontdict)
 label.update(kwargs)
 return label
- set_xlabel.__doc__ = mpl.cbook.dedent(set_xlabel.__doc__) % mpl.artist.kwdocd
+ set_xlabel.__doc__ = cbook.dedent(set_xlabel.__doc__) % martist.kwdocd
 
 def set_ylabel(self, ylabel, fontdict=None, **kwargs):
 """
@@ -2057,7 +2080,7 @@
 if fontdict is not None: label.update(fontdict)
 label.update(kwargs)
 return label
- set_ylabel.__doc__ = mpl.cbook.dedent(set_ylabel.__doc__) % mpl.artist.kwdocd
+ set_ylabel.__doc__ = cbook.dedent(set_ylabel.__doc__) % martist.kwdocd
 
 def text(self, x, y, s, fontdict=None,
 withdash=False, **kwargs):
@@ -2114,11 +2137,11 @@
 # the withdash kwarg and simply delegate whether there's
 # a dash to TextWithDash and dashlength.
 if withdash:
- t = mpl.text.TextWithDash(
+ t = mtext.TextWithDash(
 x=x, y=y, text=s,
 )
 else:
- t = mpl.text.Text(
+ t = mtext.Text(
 x=x, y=y, text=s,
 )
 self._set_artist_props(t)
@@ -2132,7 +2155,7 @@
 #if t.get_clip_on(): t.set_clip_box(self.bbox)
 if kwargs.has_key('clip_on'): t.set_clip_box(self.bbox)
 return t
- text.__doc__ = mpl.cbook.dedent(text.__doc__) % mpl.artist.kwdocd
+ text.__doc__ = cbook.dedent(text.__doc__) % martist.kwdocd
 
 def annotate(self, *args, **kwargs):
 """
@@ -2145,13 +2168,13 @@
 
 %(Annotation)s
 """
- a = mpl.text.Annotation(*args, **kwargs)
- a.set_transform(mpl.transforms.identity_transform())
+ a = mtext.Annotation(*args, **kwargs)
+ a.set_transform(mtrans.identity_transform())
 self._set_artist_props(a)
 if kwargs.has_key('clip_on'): a.set_clip_box(self.bbox)
 self.texts.append(a)
 return a
- annotate.__doc__ = mpl.cbook.dedent(annotate.__doc__) % mpl.artist.kwdocd
+ annotate.__doc__ = cbook.dedent(annotate.__doc__) % martist.kwdocd
 
 #### Lines and spans
 
@@ -2185,11 +2208,11 @@
 %(Line2D)s
 """
 
- trans = mpl.transforms.blend_xy_sep_transform( self.transAxes, self.transData)
+ trans = mtrans.blend_xy_sep_transform( self.transAxes, self.transData)
 l, = self.plot([xmin,xmax], [y,y], transform=trans, scalex=False, **kwargs)
 return l
 
- axhline.__doc__ = mpl.cbook.dedent(axhline.__doc__) % mpl.artist.kwdocd
+ axhline.__doc__ = cbook.dedent(axhline.__doc__) % martist.kwdocd
 
 def axvline(self, x=0, ymin=0, ymax=1, **kwargs):
 """
@@ -2221,11 +2244,11 @@
 %(Line2D)s
 """
 
- trans = mpl.transforms.blend_xy_sep_transform( self.transData, self.transAxes )
+ trans = mtrans.blend_xy_sep_transform( self.transData, self.transAxes )
 l, = self.plot([x,x], [ymin,ymax] , transform=trans, scaley=False, **kwargs)
 return l
 
- axvline.__doc__ = mpl.cbook.dedent(axvline.__doc__) % mpl.artist.kwdocd
+ axvline.__doc__ = cbook.dedent(axvline.__doc__) % martist.kwdocd
 
 def axhspan(self, ymin, ymax, xmin=0, xmax=1, **kwargs):
 """
@@ -2260,13 +2283,13 @@
 %(Polygon)s
 """
 # convert y axis units
- trans = mpl.transforms.blend_xy_sep_transform( self.transAxes, self.transData)
+ trans = mtrans.blend_xy_sep_transform( self.transAxes, self.transData)
 verts = (xmin, ymin), (xmin, ymax), (xmax, ymax), (xmax, ymin)
- p = mpl.patches.Polygon(verts, **kwargs)
+ p = mpatches.Polygon(verts, **kwargs)
 p.set_transform(trans)
 self.add_patch(p)
 return p
- axhspan.__doc__ = mpl.cbook.dedent(axhspan.__doc__) % mpl.artist.kwdocd
+ axhspan.__doc__ = cbook.dedent(axhspan.__doc__) % martist.kwdocd
 
 def axvspan(self, xmin, xmax, ymin=0, ymax=1, **kwargs):
 """
@@ -2300,13 +2323,13 @@
 %(Polygon)s
 """
 # convert x axis units
- trans = mpl.transforms.blend_xy_sep_transform(self.transData, self.transAxes)
+ trans = mtrans.blend_xy_sep_transform(self.transData, self.transAxes)
 verts = [(xmin, ymin), (xmin, ymax), (xmax, ymax), (xmax, ymin)]
- p = mpl.patches.Polygon(verts, **kwargs)
+ p = mpatches.Polygon(verts, **kwargs)
 p.set_transform(trans)
 self.add_patch(p)
 return p
- axvspan.__doc__ = mpl.cbook.dedent(axvspan.__doc__) % mpl.artist.kwdocd
+ axvspan.__doc__ = cbook.dedent(axvspan.__doc__) % martist.kwdocd
 
 
 def hlines(self, y, xmin, xmax, colors='k', linestyle='solid',
@@ -2331,10 +2354,16 @@
 raise DeprecationWarning(
 'hlines now uses a collections.LineCollection and not a list of Line2D to draw; see API_CHANGES')
 
- if not mpl.cbook.iterable(y): y = [y]
- if not mpl.cbook.iterable(xmin): xmin = [xmin]
- if not mpl.cbook.iterable(xmax): xmax = [xmax]
+ if not iterable(y): y = [y]
+ if not iterable(xmin): xmin = [xmin]
+ if not iterable(xmax): xmax = [xmax]
 y = npy.asarray(y)
+
+ if len(xmin)==1:
+ xmin = xmin*ones(y.shape, y.dtype)
+ if len(ymax)==1:
+ xmax = xmax*ones(y.shape, y.dtype)
+
 xmin = npy.asarray(xmin)
 xmax = npy.asarray(xmax)
 
@@ -2349,7 +2378,7 @@
 
 verts = [ ((thisxmin, thisy), (thisxmax, thisy))
 for thisxmin, thisxmax, thisy in zip(xmin, xmax, y)]
- coll = mpl.collections.LineCollection(verts, colors=colors,
+ coll = mcoll.LineCollection(verts, colors=colors,
 linestyle=linestyle, label=label)
 self.add_collection(coll)
 
@@ -2369,7 +2398,7 @@
 
 
 return coll
- hlines.__doc__ = mpl.cbook.dedent(hlines.__doc__)
+ hlines.__doc__ = cbook.dedent(hlines.__doc__)
 
 def vlines(self, x, ymin, ymax, colors='k', linestyle='solid',
 label='', **kwargs):
@@ -2400,9 +2429,9 @@
 self._process_unit_info(xdata=x, ydata=ymin, kwargs=kwargs)
 
 
- if not mpl.cbook.iterable(x): x = [x]
- if not mpl.cbook.iterable(ymin): ymin = [ymin]
- if not mpl.cbook.iterable(ymax): ymax = [ymax]
+ if not iterable(x): x = [x]
+ if not iterable(ymin): ymin = [ymin]
+ if not iterable(ymax): ymax = [ymax]
 x = npy.asarray(x)
 ymin = npy.asarray(ymin)
 ymax = npy.asarray(ymax)
@@ -2424,7 +2453,7 @@
 verts = [ ((thisx, thisymin), (thisx, thisymax))
 for thisx, (thisymin, thisymax) in zip(x,Y)]
 #print 'creating line collection'
- coll = mpl.collections.LineCollection(verts, colors=colors,
+ coll = mcoll.LineCollection(verts, colors=colors,
 linestyle=linestyle, label=label)
 self.add_collection(coll)
 coll.update(kwargs)
@@ -2432,7 +2461,7 @@
 minx = x.min()
 maxx = x.max()
 miny = min(ymin.min(), ymax.min())
- maxy = max(ymax.max(), ymax.max())
+ maxy = max(ymin.max(), ymax.max())
 minx, maxx = self.convert_xunits((minx, maxx))
 miny, maxy = self.convert_yunits((miny, maxy))
 corners = (minx, miny), (maxx, maxy)
@@ -2440,7 +2469,7 @@
 self.autoscale_view()
 
 return coll
- vlines.__doc__ = mpl.cbook.dedent(vlines.__doc__) % mpl.artist.kwdocd
+ vlines.__doc__ = cbook.dedent(vlines.__doc__) % martist.kwdocd
 
 #### Basic plotting
 def plot(self, *args, **kwargs):
@@ -2555,7 +2584,7 @@
 self.autoscale_view(scalex=scalex, scaley=scaley)
 return lines
 
- plot.__doc__ = mpl.cbook.dedent(plot.__doc__) % mpl.artist.kwdocd
+ plot.__doc__ = cbook.dedent(plot.__doc__) % martist.kwdocd
 
 def plot_date(self, x, y, fmt='bo', tz=None, xdate=True, ydate=False,
 **kwargs):
@@ -2604,7 +2633,7 @@
 self.autoscale_view()
 
 return ret
- plot_date.__doc__ = mpl.cbook.dedent(plot_date.__doc__) % mpl.artist.kwdocd
+ plot_date.__doc__ = cbook.dedent(plot_date.__doc__) % martist.kwdocd
 
 
 def loglog(self, *args, **kwargs):
@@ -2652,7 +2681,7 @@
 self._hold = b # restore the hold
 
 return l
- loglog.__doc__ = mpl.cbook.dedent(loglog.__doc__) % mpl.artist.kwdocd
+ loglog.__doc__ = cbook.dedent(loglog.__doc__) % martist.kwdocd
 
 def semilogx(self, *args, **kwargs):
 """
@@ -2685,7 +2714,7 @@
 l = self.plot(*args, **kwargs)
 self._hold = b # restore the hold
 return l
- semilogx.__doc__ = mpl.cbook.dedent(semilogx.__doc__) % mpl.artist.kwdocd
+ semilogx.__doc__ = cbook.dedent(semilogx.__doc__) % martist.kwdocd
 
 def semilogy(self, *args, **kwargs):
 """
@@ -2719,7 +2748,7 @@
 self._hold = b # restore the hold
 
 return l
- semilogy.__doc__ = mpl.cbook.dedent(semilogy.__doc__) % mpl.artist.kwdocd
+ semilogy.__doc__ = cbook.dedent(semilogy.__doc__) % martist.kwdocd
 
 def acorr(self, x, **kwargs):
 """
@@ -2754,9 +2783,9 @@
 See the respective function for documentation on valid kwargs
 """
 return self.xcorr(x, x, **kwargs)
- acorr.__doc__ = mpl.cbook.dedent(acorr.__doc__) % mpl.artist.kwdocd
+ acorr.__doc__ = cbook.dedent(acorr.__doc__) % martist.kwdocd
 
- def xcorr(self, x, y, normed=False, detrend=mpl.mlab.detrend_none, usevlines=False,
+ def xcorr(self, x, y, normed=False, detrend=mlab.detrend_none, usevlines=False,
 maxlags=None, **kwargs):
 """
 XCORR(x, y, normed=False, detrend=mlab.detrend_none, usevlines=False, **kwargs):
@@ -2821,7 +2850,7 @@
 a, = self.plot(lags, c, **kwargs)
 b = None
 return lags, c, a, b
- xcorr.__doc__ = mpl.cbook.dedent(xcorr.__doc__) % mpl.artist.kwdocd
+ xcorr.__doc__ = cbook.dedent(xcorr.__doc__) % martist.kwdocd
 
 def legend(self, *args, **kwargs):
 """
@@ -2893,9 +2922,9 @@
 handles = self.lines[:]
 handles.extend(self.patches)
 handles.extend([c for c in self.collections
- if isinstance(c, mpl.collections.LineCollection)])
+ if isinstance(c, mcoll.LineCollection)])
 handles.extend([c for c in self.collections
- if isinstance(c, mpl.collections.RegularPolyCollection)])
+ if isinstance(c, mcoll.RegularPolyCollection)])
 return handles
 
 if len(args)==0:
@@ -2916,7 +2945,7 @@
 handles = [h for h, label in zip(get_handles(), labels)]
 
 elif len(args)==2:
- if mpl.cbook.is_string_like(args[1]) or isinstance(args[1], int):
+ if is_string_like(args[1]) or isinstance(args[1], int):
 # LABELS, LOC
 labels, loc = args
 handles = [h for h, label in zip(get_handles(), labels)]
@@ -2933,8 +2962,8 @@
 raise TypeError('Invalid arguments to legend')
 
 
- handles = mpl.cbook.flatten(handles)
- self.legend_ = mpl.legend.Legend(self, handles, labels, **kwargs)
+ handles = cbook.flatten(handles)
+ self.legend_ = mlegend.Legend(self, handles, labels, **kwargs)
 return self.legend_
 
 
@@ -3011,7 +3040,7 @@
 if not self._hold: self.cla()
 
 def make_iterable(x):
- if not mpl.cbook.iterable(x):
+ if not iterable(x):
 return [x]
 else:
 return x
@@ -3071,24 +3100,24 @@
 
 # if color looks like a color string, an RGB tuple or a
 # scalar, then repeat it by nbars
- if (mpl.cbook.is_string_like(color) or
- (mpl.cbook.iterable(color) and len(color)==3 and nbars!=3) or
- not mpl.cbook.iterable(color)):
+ if (is_string_like(color) or
+ (iterable(color) and len(color)==3 and nbars!=3) or
+ not iterable(color)):
 color = [color]*nbars
 
 # if edgecolor looks like a color string, an RGB tuple or a
 # scalar, then repeat it by nbars
- if (mpl.cbook.is_string_like(edgecolor) or
- (mpl.cbook.iterable(edgecolor) and len(edgecolor)==3 and nbars!=3) or
- not mpl.cbook.iterable(edgecolor)):
+ if (is_string_like(edgecolor) or
+ (iterable(edgecolor) and len(edgecolor)==3 and nbars!=3) or
+ not iterable(edgecolor)):
 edgecolor = [edgecolor]*nbars
 
 if yerr is not None:
- if not mpl.cbook.iterable(yerr):
+ if not iterable(yerr):
 yerr = [yerr]*nbars
 
 if xerr is not None:
- if not mpl.cbook.iterable(xerr):
+ if not iterable(xerr):
 xerr = [xerr]*nbars
 
 assert len(left)==nbars, "argument 'left' must be %d or scalar" % nbars
@@ -3139,7 +3168,7 @@
 if w<0:
 l += w
 w = abs(w)
- r = mpl.patches.Rectangle(
+ r = mpatches.Rectangle(
 xy=(l, b), width=w, height=h,
 facecolor=c,
 edgecolor=e,
@@ -3184,7 +3213,7 @@
 self.dataLim.intervaly().set_bounds(ymin, ymax)
 self.autoscale_view()
 return patches
- bar.__doc__ = mpl.cbook.dedent(bar.__doc__) % mpl.artist.kwdocd
+ bar.__doc__ = cbook.dedent(bar.__doc__) % martist.kwdocd
 
 def barh(self, bottom, width, height=0.8, left=None, **kwargs):
 """
@@ -3246,7 +3275,7 @@
 orientation='horizontal', **kwargs)
 return patches
 
- barh.__doc__ = mpl.cbook.dedent(barh.__doc__) % mpl.artist.kwdocd
+ barh.__doc__ = cbook.dedent(barh.__doc__) % martist.kwdocd
 
 def broken_barh(self, xranges, yrange, **kwargs):
 """
@@ -3264,13 +3293,13 @@
 facecolors='black', 'red', 'green'
 
 """
- col = mpl.collections.BrokenBarHCollection(xranges, yrange, **kwargs)
+ col = mcoll.BrokenBarHCollection(xranges, yrange, **kwargs)
 self.add_collection(col, autolim=True)
 self.autoscale_view()
 
 return col
 
- broken_barh.__doc__ = mpl.cbook.dedent(broken_barh.__doc__) % mpl.artist.kwdocd
+ broken_barh.__doc__ = cbook.dedent(broken_barh.__doc__) % martist.kwdocd
 
 def stem(self, x, y, linefmt='b-', markerfmt='bo', basefmt='r-'):
 """
@@ -3350,7 +3379,7 @@
 Return value:
 
 If autopct is None, return a list of (patches, texts), where patches
- is a sequence of mpl.patches.Wedge instances and texts is a
+ is a sequence of mpatches.Wedge instances and texts is a
 list of the label Text instnaces
 
 If autopct is not None, return (patches, texts, autotexts), where
@@ -3385,7 +3414,7 @@
 x += expl*math.cos(thetam)
 y += expl*math.sin(thetam)
 
- w = mpl.patches.Wedge((x,y), radius, 360.*theta1, 360.*theta2,
+ w = mpatches.Wedge((x,y), radius, 360.*theta1, 360.*theta2,
 facecolor=colors[i%len(colors)])
 slices.append(w)
 self.add_patch(w)
@@ -3395,7 +3424,7 @@
 # make sure to add a shadow after the call to
 # add_patch so the figure and transform props will be
 # set
- shad = mpl.patches.Shadow(w, -0.02, -0.02,
+ shad = mpatches.Shadow(w, -0.02, -0.02,
 #props={'facecolor':w.get_facecolor()}
 )
 shad.set_zorder(0.9*w.get_zorder())
@@ -3415,7 +3444,7 @@
 if autopct is not None:
 xt = x + pctdistance*radius*math.cos(thetam)
 yt = y + pctdistance*radius*math.sin(thetam)
- if mpl.cbook.is_string_like(autopct):
+ if is_string_like(autopct):
 s = autopct%(100.*frac)
 elif callable(autopct):
 s = autopct(100.*frac)
@@ -3501,18 +3530,18 @@
 if not self._hold: self.cla()
 
 # make sure all the args are iterable arrays
- if not mpl.cbook.iterable(x): x = npy.asarray([x])
+ if not iterable(x): x = npy.asarray([x])
 else: x = npy.asarray(x)
 
- if not mpl.cbook.iterable(y): y = npy.asarray([y])
+ if not iterable(y): y = npy.asarray([y])
 else: y = npy.asarray(y)
 
 if xerr is not None:
- if not mpl.cbook.iterable(xerr): xerr = npy.asarray([xerr])
+ if not iterable(xerr): xerr = npy.asarray([xerr])
 else: xerr = npy.asarray(xerr)
 
 if yerr is not None:
- if not mpl.cbook.iterable(yerr): yerr = npy.asarray([yerr])
+ if not iterable(yerr): yerr = npy.asarray([yerr])
 else: yerr = npy.asarray(yerr)
 
 l0 = None
@@ -3581,7 +3610,7 @@
 
 self.autoscale_view()
 return (l0, caplines, barcols)
- errorbar.__doc__ = mpl.cbook.dedent(errorbar.__doc__) % mpl.artist.kwdocd
+ errorbar.__doc__ = cbook.dedent(errorbar.__doc__) % martist.kwdocd
 
 def boxplot(self, x, notch=0, sym='b+', vert=1, whis=1.5,
 positions=None, widths=None):
@@ -3663,7 +3692,7 @@
 d = npy.ravel(x[i])
 row = len(d)
 # get median and quartiles
- q1, med, q3 = mpl.mlab.prctile(d,[25,50,75])
+ q1, med, q3 = mlab.prctile(d,[25,50,75])
 # get high extreme
 iq = q3 - q1
 hi_val = q3 + whis*iq
@@ -3870,16 +3899,16 @@
 # The inherent ambiguity is resolved in favor of color
 # mapping, not interpretation as rgb or rgba.
 
- if not mpl.cbook.is_string_like(c):
+ if not is_string_like(c):
 sh = npy.shape(c)
 if len(sh) == 1 and sh[0] == len(x):
 colors = None # use cmap, norm after collection is created
 else:
- colors = mpl.colors.colorConverter.to_rgba_list(c, alpha)
+ colors = mcolors.colorConverter.to_rgba_list(c, alpha)
 else:
- colors = mpl.colors.colorConverter.to_rgba_list(c, alpha)
+ colors = mcolors.colorConverter.to_rgba_list(c, alpha)
 
- if not mpl.cbook.iterable(s):
+ if not iterable(s):
 scales = (s,)
 else:
 scales = s
@@ -3895,14 +3924,14 @@
 marker = (verts, 0)
 verts = None
 
- if mpl.cbook.is_string_like(marker):
+ if is_string_like(marker):
 # the standard way to define symbols using a string character
 sym = syms.get(marker)
 if sym is None and verts is None:
 raise ValueError('Unknown marker symbol to scatter')
 numsides, rotation = syms[marker]
 
- elif mpl.cbook.iterable(marker):
+ elif iterable(marker):
 # accept marker to be:
 # (numsides, style, [angle])
 # or
@@ -3911,7 +3940,7 @@
 if len(marker)<2 or len(marker)>3:
 raise ValueError('Cannot create markersymbol from marker')
 
- if mpl.cbook.is_numlike(marker[0]):
+ if cbook.is_numlike(marker[0]):
 # (numsides, style, [angle])
 
 if len(marker)==2:
@@ -3931,7 +3960,7 @@
 if sym is not None:
 if not starlike:
 
- collection = mpl.collections.RegularPolyCollection(
+ collection = mcoll.RegularPolyCollection(
 self.figure.dpi,
 numsides, rotation, scales,
 facecolors = colors,
@@ -3941,7 +3970,7 @@
 transOffset = self.transData,
 )
 else:
- collection = mpl.collections.StarPolygonCollection(
+ collection = mcoll.StarPolygonCollection(
 self.figure.dpi,
 numsides, rotation, scales,
 facecolors = colors,
@@ -3962,7 +3991,7 @@
 else:
 # todo -- make this nx friendly
 verts = [verts*s for s in scales]
- collection = mpl.collections.PolyCollection(
+ collection = mcoll.PolyCollection(
 verts,
 facecolors = colors,
 edgecolors = edgecolors,
@@ -3970,13 +3999,13 @@
 offsets = zip(x,y),
 transOffset = self.transData,
 )
- collection.set_transform(mpl.transforms.identity_transform())
+ collection.set_transform(mtrans.identity_transform())
 collection.set_alpha(alpha)
 collection.update(kwargs)
 
 if colors is None:
- if norm is not None: assert(isinstance(norm, mpl.colors.Normalize))
- if cmap is not None: assert(isinstance(cmap, mpl.colors.Colormap))
+ if norm is not None: assert(isinstance(norm, mcolors.Normalize))
+ if cmap is not None: assert(isinstance(cmap, mcolors.Colormap))
 collection.set_array(npy.asarray(c))
 collection.set_cmap(cmap)
 collection.set_norm(norm)
@@ -4010,7 +4039,7 @@
 self.add_collection(collection)
 return collection
 
- scatter.__doc__ = mpl.cbook.dedent(scatter.__doc__) % mpl.artist.kwdocd
+ scatter.__doc__ = cbook.dedent(scatter.__doc__) % martist.kwdocd
 
 def scatter_classic(self, x, y, s=None, c='b'):
 """
@@ -4047,35 +4076,35 @@
 Optional kwargs control the arrow properties:
 %(Arrow)s
 """
- a = mpl.patches.FancyArrow(x, y, dx, dy, **kwargs)
+ a = mpatches.FancyArrow(x, y, dx, dy, **kwargs)
 self.add_artist(a)
 return a
- arrow.__doc__ = mpl.cbook.dedent(arrow.__doc__) % mpl.artist.kwdocd
+ arrow.__doc__ = cbook.dedent(arrow.__doc__) % martist.kwdocd
 
 def quiverkey(self, *args, **kw):
- qk = mpl.quiver.QuiverKey(*args, **kw)
+ qk = mquiver.QuiverKey(*args, **kw)
 self.add_artist(qk)
 return qk
- quiverkey.__doc__ = mpl.quiver.QuiverKey.quiverkey_doc
+ quiverkey.__doc__ = mquiver.QuiverKey.quiverkey_doc
 
 def quiver2(self, *args, **kw):
- q = mpl.quiver.Quiver(self, *args, **kw)
+ q = mquiver.Quiver(self, *args, **kw)
 self.add_collection(q)
 self.update_datalim_numerix(q.X, q.Y)
 self.autoscale_view()
 return q
- quiver2.__doc__ = mpl.quiver.Quiver.quiver_doc
+ quiver2.__doc__ = mquiver.Quiver.quiver_doc
 
 def quiver(self, *args, **kw):
- if (len(args) == 3 or len(args) == 5) and not mpl.cbook.iterable(args[-1]):
+ if (len(args) == 3 or len(args) == 5) and not iterable(args[-1]):
 return self.quiver_classic(*args, **kw)
 c = kw.get('color', None)
 if c is not None:
- if not mpl.colors.is_color_like(c):
+ if not mcolors.is_color_like(c):
 assert npy.shape(npy.asarray(c)) == npy.shape(npy.asarray(args[-1]))
 return self.quiver_classic(*args, **kw)
 return self.quiver2(*args, **kw)
- quiver.__doc__ = mpl.quiver.Quiver.quiver_doc
+ quiver.__doc__ = mquiver.Quiver.quiver_doc
 
 def quiver_classic(self, U, V, *args, **kwargs ):
 """
@@ -4119,12 +4148,12 @@
 # ( U, V )
 U = npy.asarray(U)
 V = npy.asarray(V)
- X,Y = mpl.mlab.meshgrid( npy.arange(U.shape[1]), npy.arange(U.shape[0]) )
+ X,Y = mlab.meshgrid( npy.arange(U.shape[1]), npy.arange(U.shape[0]) )
 elif len(args)==1:
 # ( U, V, S )
 U = npy.asarray(U)
 V = npy.asarray(V)
- X,Y = mpl.mlab.meshgrid( npy.arange(U.shape[1]), npy.arange(U.shape[0]) )
+ X,Y = mlab.meshgrid( npy.arange(U.shape[1]), npy.arange(U.shape[0]) )
 S = float(args[0])
 do_scale = ( S != 0.0 )
 elif len(args)==2:
@@ -4186,10 +4215,10 @@
 C = clr
 
 I = U.shape[0]
- arrows = [mpl.patches.FancyArrow(X[i],Y[i],U[i],V[i],0.1*S ).get_verts()
+ arrows = [mpatches.FancyArrow(X[i],Y[i],U[i],V[i],0.1*S ).get_verts()
 for i in xrange(I)]
 
- collection = mpl.collections.PolyCollection(
+ collection = mcoll.PolyCollection(
 arrows,
 edgecolors = 'None',
 antialiaseds = (1,),
@@ -4255,7 +4284,7 @@
 patches.append( poly )
 self.autoscale_view()
 return patches
- fill.__doc__ = mpl.cbook.dedent(fill.__doc__) % mpl.artist.kwdocd
+ fill.__doc__ = cbook.dedent(fill.__doc__) % martist.kwdocd
 #### plotting z(x,y): imshow, pcolor and relatives, contour
 
 
@@ -4299,7 +4328,7 @@
 The value for each component of MxNx3 and MxNx4 float arrays should be
 in the range 0.0 to 1.0; MxN float arrays may be normalised.
 
- A mpl.image.AxesImage instance is returned
+ A image.AxesImage instance is returned
 
 The following kwargs are allowed:
 
@@ -4320,7 +4349,7 @@
 image.interpolation. See also th the filternorm and
 filterrad parameters
 
- * norm is a mpl.colors.Normalize instance; default is
+ * norm is a mcolors.Normalize instance; default is
 normalization(). This scales luminance -> 0-1 (only used for an
 MxN float array).
 
@@ -4354,16 +4383,16 @@
 parameter, ie when interpolation is one of: 'sinc',
 'lanczos' or 'blackman'
 
- Additional kwargs are mpl.artist properties
+ Additional kwargs are martist properties
 """
 
 if not self._hold: self.cla()
 
- if norm is not None: assert(isinstance(norm, mpl.colors.Normalize))
- if cmap is not None: assert(isinstance(cmap, mpl.colors.Colormap))
+ if norm is not None: assert(isinstance(norm, mcolors.Normalize))
+ if cmap is not None: assert(isinstance(cmap, mcolors.Colormap))
 if aspect is None: aspect = rcParams['image.aspect']
 self.set_aspect(aspect)
- im = mpl.image.AxesImage(self, cmap, norm, interpolation, origin, extent,
+ im = mimage.AxesImage(self, cmap, norm, interpolation, origin, extent,
 filternorm=filternorm,
 filterrad=filterrad, **kwargs)
 
@@ -4423,9 +4452,9 @@
 Optional keyword args are shown with their defaults below (you must
 use kwargs for these):
 
- * cmap = mpl.cm.jet : a cm Colormap instance from mpl.cm
+ * cmap = cm.jet : a cm Colormap instance from cm
 
- * norm = Normalize() : mpl.colors.Normalize instance
+ * norm = Normalize() : mcolors.Normalize instance
 is used to scale luminance data to 0,1.
 
 * vmin=None and vmax=None : vmin and vmax are used in conjunction
@@ -4438,7 +4467,7 @@
 
 * alpha=1.0 : the alpha blending value
 
- Return value is a mpl.collections.PatchCollection
+ Return value is a mcoll.PatchCollection
 object
 
 Grid Orientation
@@ -4497,7 +4526,7 @@
 if len(args)==1:
 C = args[0]
 numRows, numCols = C.shape
- X, Y = mpl.mlab.meshgrid(npy.arange(numCols+1), npy.arange(numRows+1) )
+ X, Y = mlab.meshgrid(npy.arange(numCols+1), npy.arange(numRows+1) )
 elif len(args)==3:
 X, Y, C = args
 numRows, numCols = C.shape
@@ -4553,7 +4582,7 @@
 else:
 edgecolors = 'None'
 
- collection = mpl.collections.PolyCollection(
+ collection = mcoll.PolyCollection(
 verts,
 edgecolors = edgecolors,
 antialiaseds = (0,),
@@ -4563,8 +4592,8 @@
 
 collection.set_alpha(alpha)
 collection.set_array(C)
- if norm is not None: assert(isinstance(norm, mpl.colors.Normalize))
- if cmap is not None: assert(isinstance(cmap, mpl.colors.Colormap))
+ if norm is not None: assert(isinstance(norm, mcolors.Normalize))
+ if cmap is not None: assert(isinstance(cmap, mcolors.Colormap))
 collection.set_cmap(cmap)
 collection.set_norm(norm)
 if vmin is not None or vmax is not None:
@@ -4585,7 +4614,7 @@
 self.autoscale_view()
 self.add_collection(collection)
 return collection
- pcolor.__doc__ = mpl.cbook.dedent(pcolor.__doc__) % mpl.artist.kwdocd
+ pcolor.__doc__ = cbook.dedent(pcolor.__doc__) % martist.kwdocd
 
 def pcolormesh(self, *args, **kwargs):
 """
@@ -4646,7 +4675,7 @@
 if len(args)==1:
 C = args[0]
 numRows, numCols = C.shape
- X, Y = mpl.mlab.meshgrid(npy.arange(numCols+1), npy.arange(numRows+1) )
+ X, Y = mlab.meshgrid(npy.arange(numCols+1), npy.arange(numRows+1) )
 elif len(args)==3:
 X, Y, C = args
 numRows, numCols = C.shape
@@ -4674,12 +4703,12 @@
 else:
 showedges = 0
 
- collection = mpl.collections.QuadMesh(
+ collection = mcoll.QuadMesh(
 Nx - 1, Ny - 1, coords, showedges, **kwargs)
 collection.set_alpha(alpha)
 collection.set_array(C)
- if norm is not None: assert(isinstance(norm, mpl.colors.Normalize))
- if cmap is not None: assert(isinstance(cmap, mpl.colors.Colormap))
+ if norm is not None: assert(isinstance(norm, mcolors.Normalize))
+ if cmap is not None: assert(isinstance(cmap, mcolors.Colormap))
 collection.set_cmap(cmap)
 collection.set_norm(norm)
 if vmin is not None or vmax is not None:
@@ -4699,21 +4728,21 @@
 self.autoscale_view()
 self.add_collection(collection)
 return collection
- pcolormesh.__doc__ = mpl.cbook.dedent(pcolormesh.__doc__) % mpl.artist.kwdocd
+ pcolormesh.__doc__ = cbook.dedent(pcolormesh.__doc__) % martist.kwdocd
 
 def contour(self, *args, **kwargs):
 kwargs['filled'] = False
- return mpl.contour.ContourSet(self, *args, **kwargs)
- contour.__doc__ = mpl.contour.ContourSet.contour_doc
+ return mcontour.ContourSet(self, *args, **kwargs)
+ contour.__doc__ = mcontour.ContourSet.contour_doc
 
 def contourf(self, *args, **kwargs):
 kwargs['filled'] = True
- return mpl.contour.ContourSet(self, *args, **kwargs)
- contourf.__doc__ = mpl.contour.ContourSet.contour_doc
+ return mcontour.ContourSet(self, *args, **kwargs)
+ contourf.__doc__ = mcontour.ContourSet.contour_doc
 
 def clabel(self, CS, *args, **kwargs):
 return CS.clabel(*args, **kwargs)
- clabel.__doc__ = mpl.contour.ContourSet.clabel.__doc__
+ ...
 
[truncated message content]
From: <ds...@us...> - 2007年07月18日 16:53:13
Revision: 3562
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3562&view=rev
Author: dsdale
Date: 2007年07月18日 09:53:11 -0700 (2007年7月18日)
Log Message:
-----------
make texmanager respect changes to rcParams after initial import
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/lib/matplotlib/texmanager.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2007年07月18日 16:45:55 UTC (rev 3561)
+++ trunk/matplotlib/CHANGELOG	2007年07月18日 16:53:11 UTC (rev 3562)
@@ -1,3 +1,8 @@
+2007年07月18日 make usetex respect changes to rcParams. texmanager used to 
+ only configure itself when it was created, now it 
+ reconfigures when rcParams are changed. Thank you Alexander 
+ Schmolck for contributing a patch - DSD
+
 2007年07月17日 added validation to setting and changing rcParams - DSD
 
 2007年07月17日 bugfix segfault in transforms module. Thanks Ben North for
Modified: trunk/matplotlib/lib/matplotlib/texmanager.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/texmanager.py	2007年07月18日 16:45:55 UTC (rev 3561)
+++ trunk/matplotlib/lib/matplotlib/texmanager.py	2007年07月18日 16:53:11 UTC (rev 3562)
@@ -33,26 +33,23 @@
 
 """
 
-import glob, md5, os, shutil, sys, warnings
-from tempfile import gettempdir
-from matplotlib import get_configdir, get_home, get_data_path, \
- rcParams, verbose
+import copy, glob, md5, os, shutil, sys, warnings
+import numpy as npy
+import matplotlib as mpl
+from matplotlib import rcParams
 from matplotlib._image import readpng
-from matplotlib.numerix import ravel, where, array, \
- zeros, Float, absolute, nonzero, sqrt
 
-debug = False
+DEBUG = False
 
 if sys.platform.startswith('win'): cmd_split = '&'
 else: cmd_split = ';'
 
-
 def get_dvipng_version():
 stdin, stdout = os.popen4('dvipng -version')
 for line in stdout:
 if line.startswith('dvipng '):
 version = line.split()[-1]
- verbose.report('Found dvipng version %s'% version,
+ mpl.verbose.report('Found dvipng version %s'% version,
 'helpful')
 return version
 raise RuntimeError('Could not obtain dvipng version')
@@ -64,14 +61,13 @@
 working dir
 """
 
- oldpath = get_home()
- if oldpath is None: oldpath = get_data_path()
+ oldpath = mpl.get_home()
+ if oldpath is None: oldpath = mpl.get_data_path()
 oldcache = os.path.join(oldpath, '.tex.cache')
 
- configdir = get_configdir()
+ configdir = mpl.get_configdir()
 texcache = os.path.join(configdir, 'tex.cache')
 
-
 if os.path.exists(oldcache):
 print >> sys.stderr, """\
 WARNING: found a TeX cache dir in the deprecated location "%s".
@@ -82,6 +78,7 @@
 
 dvipngVersion = get_dvipng_version()
 
+ # mappable cache of 
 arrayd = {}
 postscriptd = {}
 pscnt = 0
@@ -91,12 +88,15 @@
 monospace = ('cmtt', '')
 cursive = ('pzc', r'\usepackage{chancery}')
 font_family = 'serif'
+ font_families = ('serif', 'sans-serif', 'cursive', 'monospace')
 
- font_info = {'new century schoolbook': ('pnc', r'\renewcommand{\rmdefault}{pnc}'),
+ font_info = {'new century schoolbook': ('pnc', 
+ r'\renewcommand{\rmdefault}{pnc}'),
 'bookman': ('pbk', r'\renewcommand{\rmdefault}{pbk}'),
 'times': ('ptm', r'\usepackage{mathptmx}'),
 'palatino': ('ppl', r'\usepackage{mathpazo}'),
 'zapf chancery': ('pzc', r'\usepackage{chancery}'),
+ 'cursive': ('pzc', r'\usepackage{chancery}'),
 'charter': ('pch', r'\usepackage{charter}'),
 'serif': ('cmr', ''),
 'sans-serif': ('cmss', ''),
@@ -107,49 +107,37 @@
 'computer modern roman': ('cmr', ''),
 'computer modern sans serif': ('cmss', ''),
 'computer modern typewriter': ('cmtt', '')}
+ 
+ _rc_cache = None
+ _rc_cache_keys = ('text.latex.preamble', )\
+ + tuple('font.'+n for n in ('family', ) + font_families)
 
 def __init__(self):
 
 if not os.path.isdir(self.texcache):
 os.mkdir(self.texcache)
- if rcParams['font.family'].lower() in ('serif', 'sans-serif', 'cursive', 'monospace'):
- self.font_family = rcParams['font.family'].lower()
+ ff = rcParams['font.family'].lower()
+ if ff in self.font_families:
+ self.font_family = ff
 else:
 warnings.warn('The %s font family is not compatible with LaTeX. serif will be used by default.' % ff)
 self.font_family = 'serif'
- self._fontconfig = self.font_family
- for font in rcParams['font.serif']:
- try:
- self.serif = self.font_info[font.lower()]
- except KeyError:
- continue
- else:
- break
- self._fontconfig += self.serif[0]
- for font in rcParams['font.sans-serif']:
- try:
- self.sans_serif = self.font_info[font.lower()]
- except KeyError:
- continue
- else:
- break
- self._fontconfig += self.sans_serif[0]
- for font in rcParams['font.monospace']:
- try:
- self.monospace = self.font_info[font.lower()]
- except KeyError:
- continue
- else:
- break
- self._fontconfig += self.monospace[0]
- for font in rcParams['font.cursive']:
- try:
- self.cursive = self.font_info[font.lower()]
- except KeyError:
- continue
- else:
- break
- self._fontconfig += self.cursive[0]
+ 
+ fontconfig = [self.font_family]
+ for font_family, font_family_attr in \
+ ((ff, ff.replace('-', '_')) for ff in self.font_families):
+ for font in rcParams['font.'+font_family]:
+ if DEBUG: print 'family: %s, font: %s, info: %s'%(font_family, 
+ font, self.font_info[font.lower()])
+ if font.lower() in self.font_info:
+ setattr(self, font_family_attr, 
+ self.font_info[font.lower()])
+ break
+ else:
+ warnings.warn('No LaTeX-compatible font found for the %s font family in rcParams. Using default.' % ff)
+ setattr(self, font_family_attr, font_family)
+ fontconfig.append(getattr(self, font_family_attr)[0])
+ self._fontconfig = ''.join(fontconfig)
 
 # The following packages and commands need to be included in the latex
 # file's preamble:
@@ -158,17 +146,33 @@
 while r'\usepackage{type1cm}' in cmd:
 cmd.remove(r'\usepackage{type1cm}')
 cmd = '\n'.join(cmd)
- self._font_preamble = '\n'.join([r'\usepackage{type1cm}',
- cmd,
- r'\usepackage{textcomp}'])
+ self._font_preamble = '\n'.join([r'\usepackage{type1cm}', cmd,
+ r'\usepackage{textcomp}'])
 
 def get_basefile(self, tex, fontsize, dpi=None):
- s = tex + self._fontconfig + ('%f'%fontsize) + self.get_custom_preamble()
- if dpi: s += ('%s'%dpi)
- bytes = unicode(s).encode('utf-8') # make sure hash is consistent for all strings, regardless of encoding
+ s = ''.join([tex, self.get_font_config(), '%f'%fontsize,
+ self.get_custom_preamble(), str(dpi or '')])
+ # make sure hash is consistent for all strings, regardless of encoding:
+ bytes = unicode(s).encode('utf-8')
 return os.path.join(self.texcache, md5.md5(bytes).hexdigest())
 
 def get_font_config(self):
+ "Reinitializes self if rcParams self depends on have changed."
+ if self._rc_cache is None:
+ self._rc_cache = dict((k,None) for k in self._rc_cache_keys)
+ changed = [par for par in self._rc_cache_keys if rcParams[par] != \
+ self._rc_cache[par]]
+ if changed:
+ if DEBUG: print 'DEBUG following keys changed:', changed
+ for k in changed:
+ if DEBUG: 
+ print 'DEBUG %-20s: %-10s -> %-10s' % \
+ (k, self._rc_cache[k], rcParams[k])
+ # deepcopy may not be necessary, but feels more future-proof
+ self._rc_cache[k] = copy.deepcopy(rcParams[k])
+ if DEBUG: print 'DEBUG RE-INIT\nold fontconfig:', self._fontconfig
+ self.__init__()
+ if DEBUG: print 'DEBUG fontconfig:', self._fontconfig
 return self._fontconfig
 
 def get_font_preamble(self):
@@ -222,34 +226,33 @@
 try:
 fh.write(s)
 except UnicodeEncodeError, err:
- verbose.report("You are using unicode and latex, but have "
- "not enabled the matplotlib 'text.latex.unicode' "
- "rcParam.", 'helpful')
+ mpl.verbose.report("You are using unicode and latex, but have "
+ "not enabled the matplotlib 'text.latex.unicode' "
+ "rcParam.", 'helpful')
 raise
 
 fh.close()
 
 return texfile
 
- def make_dvi(self, tex, fontsize, force=0):
- if debug: force = True
+ def make_dvi(self, tex, fontsize):
 
 basefile = self.get_basefile(tex, fontsize)
 dvifile = '%s.dvi'% basefile
 
- if force or not os.path.exists(dvifile):
+ if DEBUG or not os.path.exists(dvifile):
 texfile = self.make_tex(tex, fontsize)
 outfile = basefile+'.output'
 command = self.get_shell_cmd('cd "%s"'% self.texcache,
 'latex -interaction=nonstopmode %s > "%s"'\
 %(os.path.split(texfile)[-1], outfile))
- verbose.report(command, 'debug')
+ mpl.verbose.report(command, 'debug')
 exit_status = os.system(command)
 fh = file(outfile)
 if exit_status:
 raise RuntimeError(('LaTeX was not able to process the following \
 string:\n%s\nHere is the full report generated by LaTeX: \n\n'% repr(tex)) + fh.read())
- else: verbose.report(fh.read(), 'debug')
+ else: mpl.verbose.report(fh.read(), 'debug')
 fh.close()
 for fname in glob.glob(basefile+'*'):
 if fname.endswith('dvi'): pass
@@ -258,54 +261,51 @@
 
 return dvifile
 
- def make_png(self, tex, fontsize, dpi, force=0):
- if debug: force = True
-
+ def make_png(self, tex, fontsize, dpi):
 basefile = self.get_basefile(tex, fontsize, dpi)
 pngfile = '%s.png'% basefile
 
 # see get_rgba for a discussion of the background
- if force or not os.path.exists(pngfile):
+ if DEBUG or not os.path.exists(pngfile):
 dvifile = self.make_dvi(tex, fontsize)
 outfile = basefile+'.output'
 command = self.get_shell_cmd('cd "%s"' % self.texcache,
 'dvipng -bg Transparent -D %s -T tight -o \
 "%s" "%s" > "%s"'%(dpi, os.path.split(pngfile)[-1],
 os.path.split(dvifile)[-1], outfile))
- verbose.report(command, 'debug')
+ mpl.verbose.report(command, 'debug')
 exit_status = os.system(command)
 fh = file(outfile)
 if exit_status:
 raise RuntimeError('dvipng was not able to \
 process the flowing file:\n%s\nHere is the full report generated by dvipng: \
 \n\n'% dvifile + fh.read())
- else: verbose.report(fh.read(), 'debug')
+ else: mpl.verbose.report(fh.read(), 'debug')
 fh.close()
 os.remove(outfile)
 
 return pngfile
 
- def make_ps(self, tex, fontsize, force=0):
- if debug: force = True
+ def make_ps(self, tex, fontsize):
 
 basefile = self.get_basefile(tex, fontsize)
 psfile = '%s.epsf'% basefile
 
- if force or not os.path.exists(psfile):
+ if DEBUG or not os.path.exists(psfile):
 dvifile = self.make_dvi(tex, fontsize)
 outfile = basefile+'.output'
 command = self.get_shell_cmd('cd "%s"'% self.texcache,
 'dvips -q -E -o "%s" "%s" > "%s"'\
 %(os.path.split(psfile)[-1],
 os.path.split(dvifile)[-1], outfile))
- verbose.report(command, 'debug')
+ mpl.verbose.report(command, 'debug')
 exit_status = os.system(command)
 fh = file(outfile)
 if exit_status:
 raise RuntimeError('dvipng was not able to \
 process the flowing file:\n%s\nHere is the full report generated by dvipng: \
 \n\n'% dvifile + fh.read())
- else: verbose.report(fh.read(), 'debug')
+ else: mpl.verbose.report(fh.read(), 'debug')
 fh.close()
 os.remove(outfile)
 
@@ -346,21 +346,20 @@
 if not fontsize: fontsize = rcParams['font.size']
 if not dpi: dpi = rcParams['savefig.dpi']
 r,g,b = rgb
- key = tex, fontsize, dpi, tuple(rgb)
+ key = tex, self.get_font_config(), fontsize, dpi, tuple(rgb)
 Z = self.arrayd.get(key)
 
 if Z is None:
- # force=True to skip cacheing while debugging
- pngfile = self.make_png(tex, fontsize, dpi, force=False)
+ pngfile = self.make_png(tex, fontsize, dpi)
 X = readpng(os.path.join(self.texcache, pngfile))
 
 if (self.dvipngVersion < '1.6') or rcParams['text.dvipnghack']:
 # hack the alpha channel as described in comment above
- alpha = sqrt(1-X[:,:,0])
+ alpha = npy.sqrt(1-X[:,:,0])
 else:
 alpha = X[:,:,-1]
 
- Z = zeros(X.shape, Float)
+ Z = npy.zeros(X.shape, npy.float)
 Z[:,:,0] = r
 Z[:,:,1] = g
 Z[:,:,2] = b
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jd...@us...> - 2007年07月18日 20:38:34
Revision: 3566
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3566&view=rev
Author: jdh2358
Date: 2007年07月18日 13:38:32 -0700 (2007年7月18日)
Log Message:
-----------
added mpl1 sketch
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/agg.py
 trunk/matplotlib/lib/matplotlib/axes.py
 trunk/matplotlib/makeswig.py
 trunk/matplotlib/src/agg.cxx
 trunk/matplotlib/src/swig_runtime.h
 trunk/matplotlib/swig/agg.i
Added Paths:
-----------
 trunk/matplotlib/mpl1/
 trunk/matplotlib/mpl1/mpl1.py
 trunk/matplotlib/mpl1/mtraits.py
Modified: trunk/matplotlib/lib/matplotlib/agg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/agg.py	2007年07月18日 17:21:11 UTC (rev 3565)
+++ trunk/matplotlib/lib/matplotlib/agg.py	2007年07月18日 20:38:32 UTC (rev 3566)
@@ -1,10 +1,16 @@
-# This file was created automatically by SWIG 1.3.30.
+# This file was automatically generated by SWIG (http://www.swig.org).
+# Version 1.3.31
+#
 # Don't modify this file, modify the SWIG interface instead.
 # This file is compatible with both classic and new-style classes.
 
 import _agg
 import new
 new_instancemethod = new.instancemethod
+try:
+ _swig_property = property
+except NameError:
+ pass # Python < 2.2 doesn't have 'property'.
 def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
 if (name == "thisown"): return self.this.own(value)
 if (name == "this"):
@@ -90,11 +96,11 @@
 __repr__ = _swig_repr
 __swig_setmethods__["x"] = _agg.point_type_x_set
 __swig_getmethods__["x"] = _agg.point_type_x_get
- if _newclass:x = property(_agg.point_type_x_get, _agg.point_type_x_set)
+ if _newclass:x = _swig_property(_agg.point_type_x_get, _agg.point_type_x_set)
 __swig_setmethods__["y"] = _agg.point_type_y_set
 __swig_getmethods__["y"] = _agg.point_type_y_get
- if _newclass:y = property(_agg.point_type_y_get, _agg.point_type_y_set)
- def __init__(self, *args):
+ if _newclass:y = _swig_property(_agg.point_type_y_get, _agg.point_type_y_set)
+ def __init__(self, *args): 
 this = _agg.new_point_type(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -113,14 +119,14 @@
 __repr__ = _swig_repr
 __swig_setmethods__["x"] = _agg.vertex_type_x_set
 __swig_getmethods__["x"] = _agg.vertex_type_x_get
- if _newclass:x = property(_agg.vertex_type_x_get, _agg.vertex_type_x_set)
+ if _newclass:x = _swig_property(_agg.vertex_type_x_get, _agg.vertex_type_x_set)
 __swig_setmethods__["y"] = _agg.vertex_type_y_set
 __swig_getmethods__["y"] = _agg.vertex_type_y_get
- if _newclass:y = property(_agg.vertex_type_y_get, _agg.vertex_type_y_set)
+ if _newclass:y = _swig_property(_agg.vertex_type_y_get, _agg.vertex_type_y_set)
 __swig_setmethods__["cmd"] = _agg.vertex_type_cmd_set
 __swig_getmethods__["cmd"] = _agg.vertex_type_cmd_get
- if _newclass:cmd = property(_agg.vertex_type_cmd_get, _agg.vertex_type_cmd_set)
- def __init__(self, *args):
+ if _newclass:cmd = _swig_property(_agg.vertex_type_cmd_get, _agg.vertex_type_cmd_set)
+ def __init__(self, *args): 
 this = _agg.new_vertex_type(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -137,17 +143,17 @@
 __repr__ = _swig_repr
 __swig_setmethods__["x1"] = _agg.rect_x1_set
 __swig_getmethods__["x1"] = _agg.rect_x1_get
- if _newclass:x1 = property(_agg.rect_x1_get, _agg.rect_x1_set)
+ if _newclass:x1 = _swig_property(_agg.rect_x1_get, _agg.rect_x1_set)
 __swig_setmethods__["y1"] = _agg.rect_y1_set
 __swig_getmethods__["y1"] = _agg.rect_y1_get
- if _newclass:y1 = property(_agg.rect_y1_get, _agg.rect_y1_set)
+ if _newclass:y1 = _swig_property(_agg.rect_y1_get, _agg.rect_y1_set)
 __swig_setmethods__["x2"] = _agg.rect_x2_set
 __swig_getmethods__["x2"] = _agg.rect_x2_get
- if _newclass:x2 = property(_agg.rect_x2_get, _agg.rect_x2_set)
+ if _newclass:x2 = _swig_property(_agg.rect_x2_get, _agg.rect_x2_set)
 __swig_setmethods__["y2"] = _agg.rect_y2_set
 __swig_getmethods__["y2"] = _agg.rect_y2_get
- if _newclass:y2 = property(_agg.rect_y2_get, _agg.rect_y2_set)
- def __init__(self, *args):
+ if _newclass:y2 = _swig_property(_agg.rect_y2_get, _agg.rect_y2_set)
+ def __init__(self, *args): 
 this = _agg.new_rect(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -167,17 +173,17 @@
 __repr__ = _swig_repr
 __swig_setmethods__["x1"] = _agg.rect_d_x1_set
 __swig_getmethods__["x1"] = _agg.rect_d_x1_get
- if _newclass:x1 = property(_agg.rect_d_x1_get, _agg.rect_d_x1_set)
+ if _newclass:x1 = _swig_property(_agg.rect_d_x1_get, _agg.rect_d_x1_set)
 __swig_setmethods__["y1"] = _agg.rect_d_y1_set
 __swig_getmethods__["y1"] = _agg.rect_d_y1_get
- if _newclass:y1 = property(_agg.rect_d_y1_get, _agg.rect_d_y1_set)
+ if _newclass:y1 = _swig_property(_agg.rect_d_y1_get, _agg.rect_d_y1_set)
 __swig_setmethods__["x2"] = _agg.rect_d_x2_set
 __swig_getmethods__["x2"] = _agg.rect_d_x2_get
- if _newclass:x2 = property(_agg.rect_d_x2_get, _agg.rect_d_x2_set)
+ if _newclass:x2 = _swig_property(_agg.rect_d_x2_get, _agg.rect_d_x2_set)
 __swig_setmethods__["y2"] = _agg.rect_d_y2_set
 __swig_getmethods__["y2"] = _agg.rect_d_y2_get
- if _newclass:y2 = property(_agg.rect_d_y2_get, _agg.rect_d_y2_set)
- def __init__(self, *args):
+ if _newclass:y2 = _swig_property(_agg.rect_d_y2_get, _agg.rect_d_y2_set)
+ def __init__(self, *args): 
 this = _agg.new_rect_d(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -201,11 +207,11 @@
 __repr__ = _swig_repr
 __swig_setmethods__["size"] = _agg.binary_data_size_set
 __swig_getmethods__["size"] = _agg.binary_data_size_get
- if _newclass:size = property(_agg.binary_data_size_get, _agg.binary_data_size_set)
+ if _newclass:size = _swig_property(_agg.binary_data_size_get, _agg.binary_data_size_set)
 __swig_setmethods__["data"] = _agg.binary_data_data_set
 __swig_getmethods__["data"] = _agg.binary_data_data_get
- if _newclass:data = property(_agg.binary_data_data_get, _agg.binary_data_data_set)
- def __init__(self, *args):
+ if _newclass:data = _swig_property(_agg.binary_data_data_get, _agg.binary_data_data_set)
+ def __init__(self, *args): 
 this = _agg.new_binary_data(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -220,7 +226,7 @@
 __swig_getmethods__ = {}
 __getattr__ = lambda self, name: _swig_getattr(self, buffer, name)
 __repr__ = _swig_repr
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_buffer(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -228,17 +234,17 @@
 __del__ = lambda self : None;
 def to_string(*args): return _agg.buffer_to_string(*args)
 __swig_getmethods__["width"] = _agg.buffer_width_get
- if _newclass:width = property(_agg.buffer_width_get)
+ if _newclass:width = _swig_property(_agg.buffer_width_get)
 __swig_getmethods__["height"] = _agg.buffer_height_get
- if _newclass:height = property(_agg.buffer_height_get)
+ if _newclass:height = _swig_property(_agg.buffer_height_get)
 __swig_getmethods__["stride"] = _agg.buffer_stride_get
- if _newclass:stride = property(_agg.buffer_stride_get)
+ if _newclass:stride = _swig_property(_agg.buffer_stride_get)
 __swig_setmethods__["data"] = _agg.buffer_data_set
 __swig_getmethods__["data"] = _agg.buffer_data_get
- if _newclass:data = property(_agg.buffer_data_get, _agg.buffer_data_set)
+ if _newclass:data = _swig_property(_agg.buffer_data_get, _agg.buffer_data_set)
 __swig_setmethods__["freemem"] = _agg.buffer_freemem_set
 __swig_getmethods__["freemem"] = _agg.buffer_freemem_get
- if _newclass:freemem = property(_agg.buffer_freemem_get, _agg.buffer_freemem_set)
+ if _newclass:freemem = _swig_property(_agg.buffer_freemem_get, _agg.buffer_freemem_set)
 buffer_swigregister = _agg.buffer_swigregister
 buffer_swigregister(buffer)
 
@@ -252,7 +258,7 @@
 G = _agg.order_rgb_G
 B = _agg.order_rgb_B
 rgb_tag = _agg.order_rgb_rgb_tag
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_order_rgb(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -271,7 +277,7 @@
 G = _agg.order_bgr_G
 R = _agg.order_bgr_R
 rgb_tag = _agg.order_bgr_rgb_tag
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_order_bgr(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -291,7 +297,7 @@
 B = _agg.order_rgba_B
 A = _agg.order_rgba_A
 rgba_tag = _agg.order_rgba_rgba_tag
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_order_rgba(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -311,7 +317,7 @@
 G = _agg.order_argb_G
 B = _agg.order_argb_B
 rgba_tag = _agg.order_argb_rgba_tag
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_order_argb(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -331,7 +337,7 @@
 G = _agg.order_abgr_G
 R = _agg.order_abgr_R
 rgba_tag = _agg.order_abgr_rgba_tag
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_order_abgr(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -351,7 +357,7 @@
 R = _agg.order_bgra_R
 A = _agg.order_bgra_A
 rgba_tag = _agg.order_bgra_rgba_tag
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_order_bgra(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -368,16 +374,16 @@
 __repr__ = _swig_repr
 __swig_setmethods__["r"] = _agg.rgba_r_set
 __swig_getmethods__["r"] = _agg.rgba_r_get
- if _newclass:r = property(_agg.rgba_r_get, _agg.rgba_r_set)
+ if _newclass:r = _swig_property(_agg.rgba_r_get, _agg.rgba_r_set)
 __swig_setmethods__["g"] = _agg.rgba_g_set
 __swig_getmethods__["g"] = _agg.rgba_g_get
- if _newclass:g = property(_agg.rgba_g_get, _agg.rgba_g_set)
+ if _newclass:g = _swig_property(_agg.rgba_g_get, _agg.rgba_g_set)
 __swig_setmethods__["b"] = _agg.rgba_b_set
 __swig_getmethods__["b"] = _agg.rgba_b_get
- if _newclass:b = property(_agg.rgba_b_get, _agg.rgba_b_set)
+ if _newclass:b = _swig_property(_agg.rgba_b_get, _agg.rgba_b_set)
 __swig_setmethods__["a"] = _agg.rgba_a_set
 __swig_getmethods__["a"] = _agg.rgba_a_get
- if _newclass:a = property(_agg.rgba_a_get, _agg.rgba_a_set)
+ if _newclass:a = _swig_property(_agg.rgba_a_get, _agg.rgba_a_set)
 def clear(*args): return _agg.rgba_clear(*args)
 def transparent(*args): return _agg.rgba_transparent(*args)
 def opacity(*args): return _agg.rgba_opacity(*args)
@@ -388,7 +394,7 @@
 if _newclass:no_color = staticmethod(_agg.rgba_no_color)
 __swig_getmethods__["from_wavelength"] = lambda x: _agg.rgba_from_wavelength
 if _newclass:from_wavelength = staticmethod(_agg.rgba_from_wavelength)
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_rgba(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -410,17 +416,17 @@
 base_mask = _agg.rgba8_base_mask
 __swig_setmethods__["r"] = _agg.rgba8_r_set
 __swig_getmethods__["r"] = _agg.rgba8_r_get
- if _newclass:r = property(_agg.rgba8_r_get, _agg.rgba8_r_set)
+ if _newclass:r = _swig_property(_agg.rgba8_r_get, _agg.rgba8_r_set)
 __swig_setmethods__["g"] = _agg.rgba8_g_set
 __swig_getmethods__["g"] = _agg.rgba8_g_get
- if _newclass:g = property(_agg.rgba8_g_get, _agg.rgba8_g_set)
+ if _newclass:g = _swig_property(_agg.rgba8_g_get, _agg.rgba8_g_set)
 __swig_setmethods__["b"] = _agg.rgba8_b_set
 __swig_getmethods__["b"] = _agg.rgba8_b_get
- if _newclass:b = property(_agg.rgba8_b_get, _agg.rgba8_b_set)
+ if _newclass:b = _swig_property(_agg.rgba8_b_get, _agg.rgba8_b_set)
 __swig_setmethods__["a"] = _agg.rgba8_a_set
 __swig_getmethods__["a"] = _agg.rgba8_a_get
- if _newclass:a = property(_agg.rgba8_a_get, _agg.rgba8_a_set)
- def __init__(self, *args):
+ if _newclass:a = _swig_property(_agg.rgba8_a_get, _agg.rgba8_a_set)
+ def __init__(self, *args): 
 this = _agg.new_rgba8(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -456,17 +462,17 @@
 base_mask = _agg.rgba16_base_mask
 __swig_setmethods__["r"] = _agg.rgba16_r_set
 __swig_getmethods__["r"] = _agg.rgba16_r_get
- if _newclass:r = property(_agg.rgba16_r_get, _agg.rgba16_r_set)
+ if _newclass:r = _swig_property(_agg.rgba16_r_get, _agg.rgba16_r_set)
 __swig_setmethods__["g"] = _agg.rgba16_g_set
 __swig_getmethods__["g"] = _agg.rgba16_g_get
- if _newclass:g = property(_agg.rgba16_g_get, _agg.rgba16_g_set)
+ if _newclass:g = _swig_property(_agg.rgba16_g_get, _agg.rgba16_g_set)
 __swig_setmethods__["b"] = _agg.rgba16_b_set
 __swig_getmethods__["b"] = _agg.rgba16_b_get
- if _newclass:b = property(_agg.rgba16_b_get, _agg.rgba16_b_set)
+ if _newclass:b = _swig_property(_agg.rgba16_b_get, _agg.rgba16_b_set)
 __swig_setmethods__["a"] = _agg.rgba16_a_set
 __swig_getmethods__["a"] = _agg.rgba16_a_get
- if _newclass:a = property(_agg.rgba16_a_get, _agg.rgba16_a_set)
- def __init__(self, *args):
+ if _newclass:a = _swig_property(_agg.rgba16_a_get, _agg.rgba16_a_set)
+ def __init__(self, *args): 
 this = _agg.new_rgba16(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -494,7 +500,7 @@
 __swig_getmethods__ = {}
 __getattr__ = lambda self, name: _swig_getattr(self, trans_affine, name)
 __repr__ = _swig_repr
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_trans_affine(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -531,13 +537,13 @@
 
 class trans_affine_rotation(trans_affine):
 __swig_setmethods__ = {}
- for _s in [trans_affine]: __swig_setmethods__.update(_s.__swig_setmethods__)
+ for _s in [trans_affine]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
 __setattr__ = lambda self, name, value: _swig_setattr(self, trans_affine_rotation, name, value)
 __swig_getmethods__ = {}
- for _s in [trans_affine]: __swig_getmethods__.update(_s.__swig_getmethods__)
+ for _s in [trans_affine]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
 __getattr__ = lambda self, name: _swig_getattr(self, trans_affine_rotation, name)
 __repr__ = _swig_repr
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_trans_affine_rotation(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -548,13 +554,13 @@
 
 class trans_affine_scaling(trans_affine):
 __swig_setmethods__ = {}
- for _s in [trans_affine]: __swig_setmethods__.update(_s.__swig_setmethods__)
+ for _s in [trans_affine]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
 __setattr__ = lambda self, name, value: _swig_setattr(self, trans_affine_scaling, name, value)
 __swig_getmethods__ = {}
- for _s in [trans_affine]: __swig_getmethods__.update(_s.__swig_getmethods__)
+ for _s in [trans_affine]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
 __getattr__ = lambda self, name: _swig_getattr(self, trans_affine_scaling, name)
 __repr__ = _swig_repr
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_trans_affine_scaling(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -565,13 +571,13 @@
 
 class trans_affine_translation(trans_affine):
 __swig_setmethods__ = {}
- for _s in [trans_affine]: __swig_setmethods__.update(_s.__swig_setmethods__)
+ for _s in [trans_affine]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
 __setattr__ = lambda self, name, value: _swig_setattr(self, trans_affine_translation, name, value)
 __swig_getmethods__ = {}
- for _s in [trans_affine]: __swig_getmethods__.update(_s.__swig_getmethods__)
+ for _s in [trans_affine]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
 __getattr__ = lambda self, name: _swig_getattr(self, trans_affine_translation, name)
 __repr__ = _swig_repr
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_trans_affine_translation(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -582,13 +588,13 @@
 
 class trans_affine_skewing(trans_affine):
 __swig_setmethods__ = {}
- for _s in [trans_affine]: __swig_setmethods__.update(_s.__swig_setmethods__)
+ for _s in [trans_affine]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
 __setattr__ = lambda self, name, value: _swig_setattr(self, trans_affine_skewing, name, value)
 __swig_getmethods__ = {}
- for _s in [trans_affine]: __swig_getmethods__.update(_s.__swig_getmethods__)
+ for _s in [trans_affine]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
 __getattr__ = lambda self, name: _swig_getattr(self, trans_affine_skewing, name)
 __repr__ = _swig_repr
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_trans_affine_skewing(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -605,7 +611,7 @@
 __repr__ = _swig_repr
 __swig_destroy__ = _agg.delete_path_storage
 __del__ = lambda self : None;
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_path_storage(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -657,7 +663,7 @@
 __repr__ = _swig_repr
 __swig_destroy__ = _agg.delete_rendering_buffer
 __del__ = lambda self : None;
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_rendering_buffer(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -712,8 +718,8 @@
 __repr__ = _swig_repr
 __swig_setmethods__["c"] = _agg.pixel64_type_c_set
 __swig_getmethods__["c"] = _agg.pixel64_type_c_get
- if _newclass:c = property(_agg.pixel64_type_c_get, _agg.pixel64_type_c_set)
- def __init__(self, *args):
+ if _newclass:c = _swig_property(_agg.pixel64_type_c_get, _agg.pixel64_type_c_set)
+ def __init__(self, *args): 
 this = _agg.new_pixel64_type(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -731,7 +737,7 @@
 base_shift = _agg.pixel_format_rgba_base_shift
 base_size = _agg.pixel_format_rgba_base_size
 base_mask = _agg.pixel_format_rgba_base_mask
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_pixel_format_rgba(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -766,7 +772,7 @@
 __swig_getmethods__ = {}
 __getattr__ = lambda self, name: _swig_getattr(self, renderer_base_rgba, name)
 __repr__ = _swig_repr
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_renderer_base_rgba(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -823,7 +829,7 @@
 __swig_getmethods__ = {}
 __getattr__ = lambda self, name: _swig_getattr(self, conv_curve_path, name)
 __repr__ = _swig_repr
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_conv_curve_path(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -842,7 +848,7 @@
 __swig_getmethods__ = {}
 __getattr__ = lambda self, name: _swig_getattr(self, conv_curve_trans, name)
 __repr__ = _swig_repr
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_conv_curve_trans(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -861,7 +867,7 @@
 __swig_getmethods__ = {}
 __getattr__ = lambda self, name: _swig_getattr(self, conv_transform_path, name)
 __repr__ = _swig_repr
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_conv_transform_path(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -880,7 +886,7 @@
 __swig_getmethods__ = {}
 __getattr__ = lambda self, name: _swig_getattr(self, conv_transform_curve, name)
 __repr__ = _swig_repr
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_conv_transform_curve(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -899,7 +905,7 @@
 __swig_getmethods__ = {}
 __getattr__ = lambda self, name: _swig_getattr(self, vcgen_stroke, name)
 __repr__ = _swig_repr
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_vcgen_stroke(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -932,7 +938,7 @@
 def prepare_src(*args): return _agg.null_markers_prepare_src(*args)
 def rewind(*args): return _agg.null_markers_rewind(*args)
 def vertex(*args): return _agg.null_markers_vertex(*args)
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_null_markers(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -947,7 +953,7 @@
 __swig_getmethods__ = {}
 __getattr__ = lambda self, name: _swig_getattr(self, conv_adaptor_vcgen_path, name)
 __repr__ = _swig_repr
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_conv_adaptor_vcgen_path(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -967,7 +973,7 @@
 __swig_getmethods__ = {}
 __getattr__ = lambda self, name: _swig_getattr(self, conv_adaptor_vcgen_transpath, name)
 __repr__ = _swig_repr
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_conv_adaptor_vcgen_transpath(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -987,7 +993,7 @@
 __swig_getmethods__ = {}
 __getattr__ = lambda self, name: _swig_getattr(self, conv_adaptor_vcgen_curve, name)
 __repr__ = _swig_repr
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_conv_adaptor_vcgen_curve(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -1007,7 +1013,7 @@
 __swig_getmethods__ = {}
 __getattr__ = lambda self, name: _swig_getattr(self, conv_adaptor_vcgen_transcurve, name)
 __repr__ = _swig_repr
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_conv_adaptor_vcgen_transcurve(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -1027,7 +1033,7 @@
 __swig_getmethods__ = {}
 __getattr__ = lambda self, name: _swig_getattr(self, conv_adaptor_vcgen_curvetrans, name)
 __repr__ = _swig_repr
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_conv_adaptor_vcgen_curvetrans(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -1043,13 +1049,13 @@
 
 class conv_stroke_path(conv_adaptor_vcgen_path):
 __swig_setmethods__ = {}
- for _s in [conv_adaptor_vcgen_path]: __swig_setmethods__.update(_s.__swig_setmethods__)
+ for _s in [conv_adaptor_vcgen_path]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
 __setattr__ = lambda self, name, value: _swig_setattr(self, conv_stroke_path, name, value)
 __swig_getmethods__ = {}
- for _s in [conv_adaptor_vcgen_path]: __swig_getmethods__.update(_s.__swig_getmethods__)
+ for _s in [conv_adaptor_vcgen_path]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
 __getattr__ = lambda self, name: _swig_getattr(self, conv_stroke_path, name)
 __repr__ = _swig_repr
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_conv_stroke_path(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -1069,13 +1075,13 @@
 
 class conv_stroke_transpath(conv_adaptor_vcgen_transpath):
 __swig_setmethods__ = {}
- for _s in [conv_adaptor_vcgen_transpath]: __swig_setmethods__.update(_s.__swig_setmethods__)
+ for _s in [conv_adaptor_vcgen_transpath]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
 __setattr__ = lambda self, name, value: _swig_setattr(self, conv_stroke_transpath, name, value)
 __swig_getmethods__ = {}
- for _s in [conv_adaptor_vcgen_transpath]: __swig_getmethods__.update(_s.__swig_getmethods__)
+ for _s in [conv_adaptor_vcgen_transpath]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
 __getattr__ = lambda self, name: _swig_getattr(self, conv_stroke_transpath, name)
 __repr__ = _swig_repr
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_conv_stroke_transpath(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -1095,13 +1101,13 @@
 
 class conv_stroke_curve(conv_adaptor_vcgen_curve):
 __swig_setmethods__ = {}
- for _s in [conv_adaptor_vcgen_curve]: __swig_setmethods__.update(_s.__swig_setmethods__)
+ for _s in [conv_adaptor_vcgen_curve]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
 __setattr__ = lambda self, name, value: _swig_setattr(self, conv_stroke_curve, name, value)
 __swig_getmethods__ = {}
- for _s in [conv_adaptor_vcgen_curve]: __swig_getmethods__.update(_s.__swig_getmethods__)
+ for _s in [conv_adaptor_vcgen_curve]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
 __getattr__ = lambda self, name: _swig_getattr(self, conv_stroke_curve, name)
 __repr__ = _swig_repr
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_conv_stroke_curve(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -1125,7 +1131,7 @@
 __swig_getmethods__ = {}
 __getattr__ = lambda self, name: _swig_getattr(self, conv_stroke_transcurve, name)
 __repr__ = _swig_repr
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_conv_stroke_transcurve(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -1149,7 +1155,7 @@
 __swig_getmethods__ = {}
 __getattr__ = lambda self, name: _swig_getattr(self, conv_stroke_curvetrans, name)
 __repr__ = _swig_repr
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_conv_stroke_curvetrans(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -1173,7 +1179,7 @@
 __swig_getmethods__ = {}
 __getattr__ = lambda self, name: _swig_getattr(self, rasterizer_scanline_aa, name)
 __repr__ = _swig_repr
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_rasterizer_scanline_aa(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -1208,7 +1214,7 @@
 __swig_getmethods__ = {}
 __getattr__ = lambda self, name: _swig_getattr(self, renderer_scanline_aa_solid_rgba, name)
 __repr__ = _swig_repr
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_renderer_scanline_aa_solid_rgba(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -1228,7 +1234,7 @@
 __swig_getmethods__ = {}
 __getattr__ = lambda self, name: _swig_getattr(self, renderer_scanline_bin_solid_rgba, name)
 __repr__ = _swig_repr
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_renderer_scanline_bin_solid_rgba(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -1250,7 +1256,7 @@
 __repr__ = _swig_repr
 __swig_destroy__ = _agg.delete_scanline_p8
 __del__ = lambda self : None;
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_scanline_p8(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -1274,7 +1280,7 @@
 __repr__ = _swig_repr
 __swig_destroy__ = _agg.delete_scanline_bin
 __del__ = lambda self : None;
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_scanline_bin(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -1297,7 +1303,7 @@
 __repr__ = _swig_repr
 __swig_destroy__ = _agg.delete_scanline32_bin
 __del__ = lambda self : None;
- def __init__(self, *args):
+ def __init__(self, *args): 
 this = _agg.new_scanline32_bin(*args)
 try: self.this.append(this)
 except: self.this = this
@@ -1313,5 +1319,6 @@
 scanline32_bin_swigregister(scanline32_bin)
 
 render_scanlines_rgba = _agg.render_scanlines_rgba
+render_scanlines_bin_rgba = _agg.render_scanlines_bin_rgba
 
 
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py	2007年07月18日 17:21:11 UTC (rev 3565)
+++ trunk/matplotlib/lib/matplotlib/axes.py	2007年07月18日 20:38:32 UTC (rev 3566)
@@ -5820,7 +5820,8 @@
 """
 # this is some discarded code I was using to find the minimum positive
 # data point for some log scaling fixes. I realized there was a
-# cleaner way to do it, but am keeping this around as an example for
+# cleaner way to do it, but am ke
+eping this around as an example for
 # how to get the data out of the axes. Might want to make something
 # like this a method one day, or better yet make get_verts and Artist
 # method
Modified: trunk/matplotlib/makeswig.py
===================================================================
--- trunk/matplotlib/makeswig.py	2007年07月18日 17:21:11 UTC (rev 3565)
+++ trunk/matplotlib/makeswig.py	2007年07月18日 20:38:32 UTC (rev 3566)
@@ -6,7 +6,7 @@
 'agg',
 )
 #SWIG = 'swig'
-SWIG = '/home/jdhunter/local/bin/swig'
+SWIG = '/home/titan/johnh/dev/bin/swig'
 AGGINCLUDE = 'agg23/include'
 
 swigit = '%(SWIG)s -python -c++ -outdir lib/matplotlib -o src/%(SWIGFILE)s.cxx -I%(AGGINCLUDE)s swig/%(SWIGFILE)s.i '
Added: trunk/matplotlib/mpl1/mpl1.py
===================================================================
--- trunk/matplotlib/mpl1/mpl1.py	 (rev 0)
+++ trunk/matplotlib/mpl1/mpl1.py	2007年07月18日 20:38:32 UTC (rev 3566)
@@ -0,0 +1,421 @@
+from matplotlib.enthought.traits import HasTraits
+import matplotlib.enthought.traits as traits
+
+from matplotlib import agg
+import numpy as npy
+
+import mtraits # some handy traits for mpl
+
+class Func:
+ def __call__(self, X):
+ 'transform the numpy array with shape N,2'
+ raise NotImplementedError
+ 
+ def invert(self, x, y):
+ 'invert the point x, y'
+ raise NotImplementedError
+
+ def point(self, x, y):
+ 'transform the point x, y'
+ raise NotImplementedError
+
+class Identity(Func):
+ def __call__(self, X):
+ 'transform the numpy array with shape N,2'
+ return X
+ 
+ def invert(self, x, y):
+ 'invert the point x, y'
+ return x, y
+
+ def point(self, x, y):
+ 'transform the point x, y'
+ return x, y
+
+
+class Polar(Func):
+ def __call__(self, X):
+ 'transform the numpy array with shape N,2'
+ r = X[:,0]
+ theta = X[:,1]
+ x = r*npy.cos(theta)
+ y = r*npy.sin(theta)
+ return npy.array([x,y]).T
+ 
+ def invert(self, x, y):
+ 'invert the point x, y'
+ raise NotImplementedError
+
+ def point(self, x, y):
+ 'transform the point x, y'
+ raise NotImplementedError
+
+ 
+identity = Identity()
+
+
+class Path(HasTraits):
+ """
+ The path is an object that talks to the backends, and is an
+ intermediary between the high level path artists like Line and
+ Polygon, and the backend renderer
+ """
+ MOVETO, LINETO, CLOSEPOLY = range(3)
+ 
+ strokecolor = mtraits.color('black')
+ fillcolor = mtraits.color('blue')
+ alpha = mtraits.alpha(1.0)
+ linewidth = mtraits.linewidth(1.0)
+ antialiased = mtraits.flexible_true_trait
+ verts= mtraits.verts
+ codes = mtraits.codes
+
+mtraits.path = traits.Trait(Path())
+ 
+class AggPath:
+ def __init__(self, path):
+ """
+ Path stored with agg data structs 
+ """
+ MOVETO, LINETO, CLOSEPOLY = Path.MOVETO, Path.LINETO, Path.CLOSEPOLY
+ aggpath = agg.path_storage()
+ verts = path.verts
+ codes = path.codes
+ for i in range(len(verts)):
+ x, y = verts[i]
+ code = codes[i]
+ if code==MOVETO:
+ aggpath.move_to(x, y)
+ elif code==LINETO:
+ aggpath.line_to(x, y) 
+ elif code==CLOSEPOLY:
+ aggpath.close_polygon()
+
+ self.fillcolor = self.color_to_rgba8(path.fillcolor)
+ self.strokecolor = self.color_to_rgba8(path.strokecolor)
+
+ self.aggpath = aggpath
+ self.alpha = float(path.alpha)
+ self.linewidth = float(path.linewidth)
+ self.antialiased = bool(path.antialiased)
+
+ def color_to_rgba8(self, color):
+ if color is None: return None
+ rgba = [int(255*c) for c in color.r, color.g, color.b, color.a]
+ return agg.rgba8(*rgba)
+
+# coordinates:
+#
+# artist model : a possibly nonlinear transformation (Func instance)
+# to a separable cartesian coordinate, eg for polar is takes r,
+# theta -> r*cos(theta), r*sin(theta)
+#
+# affineData : an affine 3x3 matrix that takes model output and
+# transforms it to axes 0,1. We are kind of stuck with the
+# mpl/matlab convention that 0,0 is the bottom left of the axes,
+# even though it contradicts pretty much every GUI layout in the
+# world
+#
+# affineFigure: an affine 3x3 that transforms an axes.view into figure
+# 0,1 
+#
+# affineDisplay : takes an affine 3x3 and puts figure view into display. 0,
+# 0 is left, top, which is the typical coordinate system of most
+# graphics formats
+
+class Renderer:
+ def __init__(self, width, height):
+ self.width, self.height = width, height
+
+ # almost all renderers assume 0,0 is left, upper, so we'll flip y here by default
+ self.displayview = npy.array(
+ [[width, 0, 0], [0, -height, height], [0, 0, 1]], dtype=npy.float_)
+ self.pathd = dict() # dict mapping path id -> path instance
+ 
+ def push_affine(self, affine):
+ 'set the current affine'
+ self.affine = npy.dot(self.displayview, affine)
+
+ def add_path(self, pathid, path):
+ self.pathd[pathid] = path
+
+ def remove_path(self, pathid):
+ if pathid in self.pathd:
+ del self.pathd[pathid]
+
+ def render_path(self, pathid):
+ pass
+ 
+
+
+class RendererAgg(Renderer):
+ gray = agg.rgba8(128,128,128,255) 
+ white = agg.rgba8(255,255,255,255)
+ blue = agg.rgba8(0,0,255,255)
+
+ def __init__(self, width, height):
+ Renderer.__init__(self, width, height)
+
+ self.aggpathd = dict() # map path ids to AggPaths
+ stride = width*4
+ self.buf = buf = agg.buffer(width, height, stride)
+
+ self.rbuf = rbuf = agg.rendering_buffer()
+ rbuf.attachb(buf)
+
+ self.pf = pf = agg.pixel_format_rgba(rbuf)
+ self.rbase = rbase = agg.renderer_base_rgba(pf)
+ rbase.clear_rgba8(self.gray)
+
+ # the antialiased renderers
+ self.renderer = agg.renderer_scanline_aa_solid_rgba(rbase); 
+ self.rasterizer = agg.rasterizer_scanline_aa()
+ self.scanline = agg.scanline_p8()
+ self.trans = None
+
+ # the aliased renderers
+ self.rendererbin = agg.renderer_scanline_bin_solid_rgba(rbase);
+ self.scanlinebin = agg.scanline_bin()
+
+ def add_path(self, pathid, path):
+ pathid = Renderer.add_path(self, pathid, path)
+ self.aggpathd[pathid] = AggPath(path)
+
+ def remove_path(self, pathid):
+ Renderer.remove_path(self, pathid)
+ if pathid in self.aggpathd:
+ del self.aggpathd[pathid]
+
+ def push_affine(self, affine):
+ 'set the current affine'
+ Renderer.push_affine(self, affine)
+ a, b, tx = self.affine[0]
+ c, d, ty = self.affine[1]
+ self.trans = agg.trans_affine(a,b,c,d,tx,ty)
+
+
+ def render_path(self, pathid):
+ if self.trans is None:
+ raise RuntimeError('you must first push_affine')
+
+
+
+ aggpath = self.aggpathd[pathid]
+
+ if aggpath.antialiased:
+ renderer = self.renderer
+ scanline = self.scanline
+ render_scanlines = agg.render_scanlines_rgba
+ else:
+ renderer = self.rendererbin
+ scanline = self.scanlinebin
+ render_scanlines = agg.render_scanlines_bin_rgba
+
+ renderer.color_rgba8( aggpath.strokecolor )
+ transpath = agg.conv_transform_path(aggpath.aggpath, self.trans)
+
+ if aggpath.fillcolor is not None:
+ self.rasterizer.add_path(transpath)
+ renderer.color_rgba8( aggpath.fillcolor )
+ render_scanlines(self.rasterizer, scanline, renderer);
+ 
+ stroke = agg.conv_stroke_transpath(transpath)
+ stroke.width(aggpath.linewidth)
+ self.rasterizer.add_path(stroke)
+ renderer.color_rgba8( aggpath.strokecolor ) 
+ render_scanlines(self.rasterizer, scanline, renderer);
+
+
+ def show(self):
+ # we'll cheat a little and use pylab for display
+
+ X = npy.fromstring(self.buf.to_string(), npy.uint8)
+ X.shape = self.height, self.width, 4
+ if 1:
+ import pylab
+ fig = pylab.figure()
+ ax = fig.add_axes([0,0,1,1], xticks=[], yticks=[],
+ frameon=False, aspect='auto')
+ ax.imshow(X, aspect='auto')
+ pylab.show()
+
+
+
+
+
+def rectangle(l, b, w, h, facecolor='yellow', edgecolor='black',
+ edgewidth=1.0, alpha=1.0):
+
+ t = b+h
+ r = l+w
+ verts = npy.array([(l,b), (l,t), (r, t), (r, b), (0,0)], npy.float_)
+ codes = Path.LINETO*npy.ones(5, npy.uint8)
+ codes[0] = Path.MOVETO
+ codes[-1] = Path.CLOSEPOLY
+
+ path = Path()
+ part.verts = verts
+ path.codes = codes
+ path.strokecolor = edgecolor
+ path.fillcolor = facecolor
+ path.linewidth = edgewidth
+ path.alpha = alpha
+ return path
+
+def line(x, y, color='black', linewidth=1.0, alpha=1.0, antialiased=True,
+ model=identity):
+ X = npy.asarray([x,y]).T
+ numrows, numcols = X.shape
+
+ codes = Path.LINETO*npy.ones(numrows, npy.uint8)
+ codes[0] = Path.MOVETO
+
+ path = Path()
+ path.verts = model(X)
+ path.codes = codes 
+ path.fillcolor = None
+ path.strokewidth = linewidth
+ path.alpha = alpha
+ path.antialiased = antialiased
+ return path
+ 
+ 
+
+class AxesCoords(HasTraits):
+ xviewlim = mtraits.interval
+ yviewlim = mtraits.interval
+ affineview = mtraits.affine
+ affineaxes = mtraits.affine 
+ affine = mtraits.affine 
+
+ def _affineview_changed(self, old, new):
+ self.affine = npy.dot(
+ npy.dot(self.affineaxes, new), self.affinedata)
+
+ def _affineaxes_changed(self, old, new):
+ self.affine = npy.dot(
+ npy.dot(new, self.affineview), self.affinedata)
+
+
+ def _xviewlim_changed(self, old, new):
+ xmin, xmax = new
+ scale = 1./(xmax-xmin)
+ tx = -xmin*scale
+ self.affineview[0][0] = scale
+ self.affineview[0][-1] = tx
+
+ def _yviewlim_changed(self, old, new):
+ ymin, ymax = new
+ scale = 1./(ymax-ymin)
+ ty = -ymin*scale
+ self.affineview[1][1] = scale
+ self.affineview[1][-1] = ty
+
+ 
+
+class Figure:
+ def __init__(self):
+ self.renderer = None
+ self._pathid = 0
+ self._pathd = dict()
+
+ def add_path(self, path):
+ id_ = self._pathid
+ self.pathd[id_] = path
+ self._pathid += 1
+ return id_
+
+ def remove_path(self, pathid):
+ if pathid in self.pathd: 
+ del self.pathd[pathid]
+ if self.renderer is not None:
+ self.renderer.remove_path(pathid)
+ 
+ def draw(self):
+ if self.renderer is None:
+ raise RuntimeError('call set_renderer renderer first')
+
+ for pathid, path in self.pathd.items():
+ renderer.push_affine(path.affine)
+ renderer.render_path(pathid)
+
+ 
+ def set_renderer(self, renderer):
+ self.renderer = renderer
+ for pathid, path in self.pathd.items():
+ renderer.add_path(pathid, path)
+
+
+def affine_axes(rect):
+ 'make an affine for a typical l,b,w,h axes rectangle'
+ l,b,w,h = rect
+ return npy.array([[w, 0, l], [0, h, b], [0, 0, 1]], dtype=npy.float_)
+
+def affine_identity():
+ return npy.array([[1,0,0],
+ [0,1,0],
+ [0,0,1]],
+ dtype=npy.float_)
+
+def affine_translation(tx, ty):
+ return npy.array([[1,0,tx],
+ [0,1,ty],
+ [0,0,1]],
+ dtype=npy.float_)
+
+def affine_rotation(theta):
+ a = npy.cos(theta)
+ b = -npy.sin(theta)
+ c = npy.sin(theta)
+ d = npy.cos(theta)
+ 
+ return npy.array([[a,b,0],
+ [c,d,0],
+ [0,0,1]],
+ dtype=npy.float_)
+
+xlim = mtraits.interval()
+ylim1 = mtraits.interval()
+ylim2 = mtraits.interval()
+
+affineaxes = affine_axes([0.1, 0.1, 0.4, 0.4]) # lower, left quadrant
+
+coords1 = AxesCoords()
+coords1.xlim = xlim
+coords1.ylim = ylim1
+print 'typedata', affineaxes.shape, affineaxes.dtype
+coords1.affineaxes = affineaxes
+
+coords2 = AxesCoords()
+coords2.xlim = xlim
+coords2.ylim = ylim2
+coords2.affineaxes = affineaxes
+
+
+
+fig = Figure()
+
+x = npy.arange(0, 10, 0.01)
+y1 = npy.cos(2*npy.pi*x)
+y2 = 10*npy.exp(-x)
+
+line1 = line(x, y1, color='blue', linewidth=2.0)
+line1.affine = coords1.affime
+
+line2 = line(x, y2, color='red', linewidth=2.0)
+line2.affine = coords1.affime
+
+fig.add_path(line1)
+fig.add_path(line2)
+
+# update the view limits, all the affines should be automagically updated
+xlim = 0,10
+ylim1 = -1.1, 1.1
+ylim2 = 0, 10
+
+
+renderer = RendererAgg(600,400)
+fig.set_renderer(renderer)
+fig.draw()
+print 'renderer affine', renderer.affine
+renderer.show()
Added: trunk/matplotlib/mpl1/mtraits.py
===================================================================
--- trunk/matplotlib/mpl1/mtraits.py	 (rev 0)
+++ trunk/matplotlib/mpl1/mtraits.py	2007年07月18日 20:38:32 UTC (rev 3566)
@@ -0,0 +1,113 @@
+# Here is some example code showing how to define some representative
+# rc properties and construct a matplotlib artist using traits.
+# Because matplotlib ships with enthought traits already, you can run
+# this script with just matplotlib. Unfortunately, we do not ship the
+# ex UI component so you can't test that part. I'm a bit of a traits
+# newbie so there are probably better ways to do what I have done
+# below.
+
+import sys, os, re
+import matplotlib.enthought.traits as traits
+from matplotlib.cbook import is_string_like
+from matplotlib import colors as mcolors
+import numpy as npy
+
+doprint = True
+flexible_true_trait = traits.Trait(
+ True,
+ { 'true': True, 't': True, 'yes': True, 'y': True, 'on': True, True: True,
+ 'false': False, 'f': False, 'no': False, 'n': False, 'off': False, False: False
+ } )
+flexible_false_trait = traits.Trait( False, flexible_true_trait )
+
+colors = mcolors.cnames
+
+def hex2color(s):
+ "Convert hex string (like html uses, eg, #efefef) to a r,g,b tuple"
+ return tuple([int(n, 16)/255.0 for n in (s[1:3], s[3:5], s[5:7])])
+
+class RGBA(traits.HasTraits):
+ # r,g,b,a in the range 0-1 with default color 0,0,0,1 (black)
+ r = traits.Range(0., 1., 0.)
+ g = traits.Range(0., 1., 0.)
+ b = traits.Range(0., 1., 0.)
+ a = traits.Range(0., 1., 1.)
+ def __init__(self, r=0., g=0., b=0., a=1.):
+ self.r = r
+ self.g = g
+ self.b = b
+ self.a = a
+ def __repr__(self):
+ return 'r,g,b,a = (%1.2f, %1.2f, %1.2f, %1.2f)'%\
+ (self.r, self.g, self.b, self.a)
+
+def tuple_to_rgba(ob, name, val):
+ tup = [float(x) for x in val]
+ if len(tup)==3:
+ r,g,b = tup
+ return RGBA(r,g,b)
+ elif len(tup)==4:
+ r,g,b,a = tup
+ return RGBA(r,g,b,a)
+ else:
+ raise ValueError
+tuple_to_rgba.info = 'a RGB or RGBA tuple of floats'
+
+def hex_to_rgba(ob, name, val):
+ rgx = re.compile('^#[0-9A-Fa-f]{6}$')
+
+ if not is_string_like(val):
+ raise TypeError
+ if rgx.match(val) is None:
+ raise ValueError
+ r,g,b = hex2color(val)
+ return RGBA(r,g,b,1.0)
+hex_to_rgba.info = 'a hex color string'
+
+def colorname_to_rgba(ob, name, val):
+ hex = colors[val.lower()]
+ r,g,b = hex2color(hex)
+ return RGBA(r,g,b,1.0)
+colorname_to_rgba.info = 'a named color'
+
+def float_to_rgba(ob, name, val):
+ val = float(val)
+ return RGBA(val, val, val, 1.)
+float_to_rgba.info = 'a grayscale intensity'
+
+
+
+Color = traits.Trait(RGBA(), float_to_rgba, colorname_to_rgba, RGBA,
+ hex_to_rgba, tuple_to_rgba, None)
+
+def file_exists(ob, name, val):
+ fh = file(val, 'r')
+ return val
+
+def path_exists(ob, name, val):
+ os.path.exists(val)
+linestyles = ('-', '--', '-.', ':', 'steps', 'None')
+TICKLEFT, TICKRIGHT, TICKUP, TICKDOWN = range(4)
+linemarkers = (None, '.', ',', 'o', '^', 'v', '<', '>', 's',
+ '+', 'x', 'd', 'D', '|', '_', 'h', 'H',
+ 'p', '1', '2', '3', '4',
+ TICKLEFT,
+ TICKRIGHT,
+ TICKUP,
+ TICKDOWN,
+ 'None')
+ 
+
+linewidth = traits.Float(0.5)
+linestyle = traits.Trait(*linestyles)
+color = Color
+marker = traits.Trait(*linemarkers)
+markersize = traits.Float(6)
+antialiased = flexible_true_trait
+alpha = traits.Range(0., 1., 0.)
+interval = traits.Array('d', (2,))
+affine = traits.Array('d', (3,3))
+verts = traits.Array('d')
+codes = traits.Array('b')
+
+
Modified: trunk/matplotlib/src/agg.cxx
===================================================================
--- trunk/matplotlib/src/agg.cxx	2007年07月18日 17:21:11 UTC (rev 3565)
+++ trunk/matplotlib/src/agg.cxx	2007年07月18日 20:38:32 UTC (rev 3566)
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.30
+ * Version 1.3.31
 * 
 * This file is not intended to be easily readable and contains a number of 
 * coding conventions designed to improve portability and efficiency. Do not make
@@ -795,11 +795,14 @@
 #endif
 
 /* Py_ssize_t for old Pythons */
-#if PY_VERSION_HEX < 0x02050000
+/* This code is as recommended by: */
+/* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */
+#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
 typedef int Py_ssize_t;
+# define PY_SSIZE_T_MAX INT_MAX
+# define PY_SSIZE_T_MIN INT_MIN
 #endif
 
-
 /* -----------------------------------------------------------------------------
 * error manipulation
 * ----------------------------------------------------------------------------- */
@@ -2597,7 +2600,7 @@
 
 #if (PY_VERSION_HEX <= 0x02000000)
 # if !defined(SWIG_PYTHON_CLASSIC)
-# error "This python version requires to use swig with the '-classic' option"
+# error "This python version requires swig to be run with the '-classic' option"
 # endif
 #endif
 
@@ -2608,7 +2611,7 @@
 
 #define SWIG_name "_agg"
 
-#define SWIGVERSION 0x010330 
+#define SWIGVERSION 0x010331 
 #define SWIG_VERSION SWIGVERSION
 
 
@@ -30221,6 +30224,54 @@
 }
 
 
+SWIGINTERN PyObject *_wrap_render_scanlines_bin_rgba(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ agg::rasterizer_scanline_aa< > *arg1 = 0 ;
+ agg::scanline_bin *arg2 = 0 ;
+ agg::renderer_scanline_bin_solid<renderer_base_rgba_t > *arg3 = 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ void *argp3 = 0 ;
+ int res3 = 0 ;
+ PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+ PyObject * obj2 = 0 ;
+ 
+ if (!PyArg_ParseTuple(args,(char *)"OOO:render_scanlines_bin_rgba",&obj0,&obj1,&obj2)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_rasterizer_scanline_aaT_t, 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "render_scanlines_bin_rgba" "', argument " "1"" of type '" "agg::rasterizer_scanline_aa< > &""'"); 
+ }
+ if (!argp1) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "render_scanlines_bin_rgba" "', argument " "1"" of type '" "agg::rasterizer_scanline_aa< > &""'"); 
+ }
+ arg1 = reinterpret_cast< agg::rasterizer_scanline_aa< > * >(argp1);
+ res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_agg__scanline_bin, 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "render_scanlines_bin_rgba" "', argument " "2"" of type '" "agg::scanline_bin &""'"); 
+ }
+ if (!argp2) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "render_scanlines_bin_rgba" "', argument " "2"" of type '" "agg::scanline_bin &""'"); 
+ }
+ arg2 = reinterpret_cast< agg::scanline_bin * >(argp2);
+ res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_agg__renderer_scanline_bin_solidTagg__renderer_baseTpixfmt_rgba_t_t_t, 0 );
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "render_scanlines_bin_rgba" "', argument " "3"" of type '" "agg::renderer_scanline_bin_solid<renderer_base_rgba_t > &""'"); 
+ }
+ if (!argp3) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "render_scanlines_bin_rgba" "', argument " "3"" of type '" "agg::renderer_scanline_bin_solid<renderer_base_rgba_t > &""'"); 
+ }
+ arg3 = reinterpret_cast< agg::renderer_scanline_bin_solid<renderer_base_rgba_t > * >(argp3);
+ agg::SWIGTEMPLATEDISAMBIGUATOR render_scanlines<agg::rasterizer_scanline_aa< >,agg::scanline_bin,agg::renderer_scanline_bin_solid<renderer_base_rgba_t > >(*arg1,*arg2,*arg3);
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+fail:
+ return NULL;
+}
+
+
 static PyMethodDef SwigMethods[] = {
 	 { (char *)"deg2rad", _wrap_deg2rad, METH_VARARGS, NULL},
 	 { (char *)"rad2deg", _wrap_rad2deg, METH_VARARGS, NULL},
@@ -30776,6 +30827,7 @@
 	 { (char *)"scanline32_bin_num_spans", _wrap_scanline32_bin_num_spans, METH_VARARGS, NULL},
 	 { (char *)"scanline32_bin_swigregister", scanline32_bin_swigregister, METH_VARARGS, NULL},
 	 { (char *)"render_scanlines_rgba", _wrap_render_scanlines_rgba, METH_VARARGS, NULL},
+	 { (char *)"render_scanlines_bin_rgba", _wrap_render_scanlines_bin_rgba, METH_VARARGS, NULL},
 	 { NULL, NULL, 0, NULL }
 };
 
@@ -31338,7 +31390,7 @@
 * structures together.
 *
 * The generated swig_type_info structures are assigned staticly to an initial 
- * array. We just loop though that array, and handle each type individually.
+ * array. We just loop through that array, and handle each type individually.
 * First we lookup if this type has been already loaded, and if so, use the
 * loaded structure instead of the generated one. Then we have to fill in the
 * cast linked list. The cast data is initially stored in something like a
Modified: trunk/matplotlib/src/swig_runtime.h
===================================================================
--- trunk/matplotlib/src/swig_runtime.h	2007年07月18日 17:21:11 UTC (rev 3565)
+++ trunk/matplotlib/src/swig_runtime.h	2007年07月18日 20:38:32 UTC (rev 3566)
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.30
+ * Version 1.3.31
 * 
 * This file is not intended to be easily readable and contains a number of 
 * coding conventions designed to improve portability and efficiency. Do not make
@@ -785,10 +785,13 @@
 #endif
 
 /* Py_ssize_t for old Pythons */
-#if PY_VERSION_HEX < 0x02050000
+/* This code is as recommended by: */
+/* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */
+#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
 typedef int Py_ssize_t;
+# define PY_SSIZE_T_MAX INT_MAX
+# define PY_SSIZE_T_MIN INT_MIN
 #endif
-
 /* -----------------------------------------------------------------------------
 * error manipulation
 * ----------------------------------------------------------------------------- */
Modified: trunk/matplotlib/swig/agg.i
===================================================================
--- trunk/matplotlib/swig/agg.i	2007年07月18日 17:21:11 UTC (rev 3565)
+++ trunk/matplotlib/swig/agg.i	2007年07月18日 20:38:32 UTC (rev 3566)
@@ -107,4 +107,8 @@
 
 
 
+%template(render_scanlines_bin_rgba) agg::render_scanlines<
+ agg::rasterizer_scanline_aa<>,
+ agg::scanline_bin,
+ agg::renderer_scanline_bin_solid<renderer_base_rgba_t> >;
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <nn...@us...> - 2007年07月19日 15:26:28
Revision: 3574
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3574&view=rev
Author: nnemec
Date: 2007年07月19日 08:26:27 -0700 (2007年7月19日)
Log Message:
-----------
minimized remaining numerix wrapper code
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/lib/matplotlib/numerix/__init__.py
 trunk/matplotlib/setup.py
Added Paths:
-----------
 trunk/matplotlib/lib/matplotlib/numerix/fft.py
 trunk/matplotlib/lib/matplotlib/numerix/linear_algebra.py
 trunk/matplotlib/lib/matplotlib/numerix/ma.py
 trunk/matplotlib/lib/matplotlib/numerix/mlab.py
 trunk/matplotlib/lib/matplotlib/numerix/npyma.py
 trunk/matplotlib/lib/matplotlib/numerix/random_array.py
Removed Paths:
-------------
 trunk/matplotlib/NUMARRAY_ISSUES
 trunk/matplotlib/lib/matplotlib/numerix/_na_imports.py
 trunk/matplotlib/lib/matplotlib/numerix/_nc_imports.py
 trunk/matplotlib/lib/matplotlib/numerix/_sp_imports.py
 trunk/matplotlib/lib/matplotlib/numerix/fft/
 trunk/matplotlib/lib/matplotlib/numerix/linear_algebra/
 trunk/matplotlib/lib/matplotlib/numerix/ma/
 trunk/matplotlib/lib/matplotlib/numerix/mlab/
 trunk/matplotlib/lib/matplotlib/numerix/npyma/
 trunk/matplotlib/lib/matplotlib/numerix/random_array/
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2007年07月19日 03:53:37 UTC (rev 3573)
+++ trunk/matplotlib/CHANGELOG	2007年07月19日 15:26:27 UTC (rev 3574)
@@ -1,3 +1,7 @@
+2007年07月19日 replaced the Python code in numerix/ by a minimal wrapper around
+ numpy that explicitly mentions all symbols that need to be
+	 addressed for further numpification - NN
+
 2007年07月18日 make usetex respect changes to rcParams. texmanager used to 
 only configure itself when it was created, now it 
 reconfigures when rcParams are changed. Thank you Alexander 
Deleted: trunk/matplotlib/NUMARRAY_ISSUES
===================================================================
--- trunk/matplotlib/NUMARRAY_ISSUES	2007年07月19日 03:53:37 UTC (rev 3573)
+++ trunk/matplotlib/NUMARRAY_ISSUES	2007年07月19日 15:26:27 UTC (rev 3574)
@@ -1,27 +0,0 @@
-Todd Miller has added a matplotlib.numerix module to allow matplotlib
-to choose between Numeric or numarry. See the header of that file for
-information on how to choose between Numeric or Numarray from the
-command line or using environment variables. 
-
-For the most part this is seamless and should provide any problems.
-Below is a status report of known issues
-
-* divide array by float - Many of the matplotlib examples do things
- like exp(-t/2.0) where t is an array. If you have 'from __future__
- import division (as matplotlib.matlab does) then you will get an
- error along the lines of 
-
- TypeError: unsupported operand type(s) for /: 'NumArray' and 'float'"
-
- Solution: use numarray 0.9 or later; for older versions, use
- divide(-t, 2.0)
-
-* stock demo does not run with "TypeError: unsubscriptable object"
-
- Solution: array resize/reshape bug fixed in numarray CVS
-
-* Use of convolve in csd demo fails with "ValueError: Invalid
- convolution mode"
-
- Solution: fixed in numarray CVS 
- 
Modified: trunk/matplotlib/lib/matplotlib/numerix/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/__init__.py	2007年07月19日 03:53:37 UTC (rev 3573)
+++ trunk/matplotlib/lib/matplotlib/numerix/__init__.py	2007年07月19日 15:26:27 UTC (rev 3574)
@@ -1,171 +1,54 @@
-"""
-numerix imports either Numeric or numarray based on various selectors.
+import sys
 
-0. If the value "--numpy","--numarray" or "--Numeric" is specified on the
- command line, then numerix imports the specified
- array package.
-
-1. The value of numerix in matplotlibrc: either Numeric or numarray
-
-2. If none of the above is done, the default array package is Numeric.
- Because the matplotlibrc always provides *some* value for numerix
- (it has it's own system of default values), this default is most
- likely never used.
-
-To summarize: the commandline is examined first, the rc file second,
-and the default array package is Numeric.
-"""
-
-import sys, os, struct
-from matplotlib import rcParams, verbose
-
-which = None, None
 use_maskedarray = None
 
-# First, see if --numarray or --Numeric was specified on the command
-# line:
-
 for a in sys.argv:
- if a in ["--Numeric", "--numeric", "--NUMERIC",
- "--Numarray", "--numarray", "--NUMARRAY",
- "--NumPy", "--numpy", "--NUMPY", "--Numpy",
- ]:
- which = a[2:], "command line"
 if a == "--maskedarray":
 use_maskedarray = True
 if a == "--ma":
 use_maskedarray = False
 del a
 
-if which[0] is None:
- try: # In theory, rcParams always has *some* value for numerix.
- which = rcParams['numerix'], "rc"
- except KeyError:
- pass
-
 if use_maskedarray is None:
+ import matplotlib
 try:
- use_maskedarray = rcParams['maskedarray']
+ use_maskedarray = matplotlib.rcParams['maskedarray']
 except KeyError:
 use_maskedarray = False
 
-# If all the above fail, default to Numeric. Most likely not used.
-if which[0] is None:
- which = "numeric", "defaulted"
+#########################
 
-which = which[0].strip().lower(), which[1]
-if which[0] not in ["numeric", "numarray", "numpy"]:
- raise ValueError("numerix selector must be either 'Numeric', 'numarray', or 'numpy' but the value obtained from the %s was '%s'." % (which[1], which[0]))
+from numpy import *
 
-if which[0] == "numarray":
- import warnings
- warnings.warn("numarray use as a numerix backed for matplotlib is deprecated",
- DeprecationWarning, stacklevel=1)
+#########################
 
- #from na_imports import *
- from numarray import *
- from _na_imports import nx, inf, infinity, Infinity, Matrix, isnan, all
- from numarray.numeric import nonzero
- from numarray.convolve import cross_correlate, convolve
- import numarray
- version = 'numarray %s'%numarray.__version__
- nan = struct.unpack('d', struct.pack('Q', 0x7ff8000000000000))[0]
+asum = sum
+matrixmultiply = dot
 
-elif which[0] == "numeric":
- import warnings
- warnings.warn("Numeric use as a numerix backed for matplotlib is deprecated",
- DeprecationWarning, stacklevel=1)
+#from numpy.oldnumeric import *
+from numpy.oldnumeric import \
+ ArrayType, cross_correlate, NewAxis, \
+ arrayrange, innerproduct, outerproduct
 
- #from nc_imports import *
- from Numeric import *
- from _nc_imports import nx, inf, infinity, Infinity, isnan, all, any
- from Matrix import Matrix
- import Numeric
- version = 'Numeric %s'%Numeric.__version__
- nan = struct.unpack('d', struct.pack('Q', 0x7ff8000000000000))[0]
+newaxis = NewAxis
 
-elif which[0] == "numpy":
- try:
- import numpy.oldnumeric as numpy
- from numpy.oldnumeric import *
- except ImportError:
- import numpy
- from numpy import *
- print 'except asarray', asarray
- from _sp_imports import nx, infinity, rand, randn, isnan, all, any
- from _sp_imports import UInt8, UInt16, UInt32, Infinity
- try:
- from numpy.oldnumeric.matrix import Matrix
- except ImportError:
- Matrix = matrix
- version = 'numpy %s' % numpy.__version__
- from numpy import nan
-else:
- raise RuntimeError("invalid numerix selector")
+from numpy.oldnumeric import Int8, UInt8, \
+ Int16, UInt16, \
+ Int32, UInt32, \
+ Float32, Float64, \
+ Complex32, Complex64, \
+ Float, Int, Complex
 
+from numpy.oldnumeric.matrix import Matrix
 
-# Some changes are only applicable to the new numpy:
-if (which[0] == 'numarray' or
- which[0] == 'numeric'):
- from mlab import amin, amax
- newaxis = NewAxis
- def typecode(a):
- return a.typecode()
- def iscontiguous(a):
- return a.iscontiguous()
- def byteswapped(a):
- return a.byteswapped()
- def itemsize(a):
- return a.itemsize()
- def angle(a):
- return arctan2(a.imag, a.real)
+from numpy.oldnumeric.mlab import min as amin
+from numpy.oldnumeric.mlab import max as amax
 
-else:
- # We've already checked for a valid numerix selector,
- # so assume numpy.
- from mlab import amin, amax
- newaxis = NewAxis
- from numpy import angle
- def typecode(a):
- return a.dtype.char
- def iscontiguous(a):
- return a.flags.contiguous
- def byteswapped(a):
- return a.byteswap()
- def itemsize(a):
- return a.itemsize
-
-verbose.report('numerix %s'%version)
-# a bug fix for blas numeric suggested by Fernando Perez
-matrixmultiply=dot
-asum = sum
-
-
-def _import_fail_message(module, version):
- """Prints a message when the array package specific version of an extension
- fails to import correctly.
- """
- _dict = { "which" : which[0],
- "module" : module,
- "specific" : version + module
- }
- print """
-The import of the %(which)s version of the %(module)s module,
-%(specific)s, failed. This is is either because %(which)s was
-unavailable when matplotlib was compiled, because a dependency of
-%(specific)s could not be satisfied, or because the build flag for
-this module was turned off in setup.py. If it appears that
-%(specific)s was not built, make sure you have a working copy of
-%(which)s and then re-install matplotlib. Otherwise, the following
-traceback gives more details:\n""" % _dict
-
-g = globals()
-l = locals()
-__import__('ma', g, l)
-__import__('fft', g, l)
-__import__('linear_algebra', g, l)
-__import__('random_array', g, l)
-__import__('mlab', g, l)
-
-la = linear_algebra
-ra = random_array
+def typecode(a):
+ return a.dtype.char
+def iscontiguous(a):
+ return a.flags.contiguous
+def byteswapped(a):
+ return a.byteswap()
+def itemsize(a):
+ return a.itemsize
Deleted: trunk/matplotlib/lib/matplotlib/numerix/_na_imports.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/_na_imports.py	2007年07月19日 03:53:37 UTC (rev 3573)
+++ trunk/matplotlib/lib/matplotlib/numerix/_na_imports.py	2007年07月19日 15:26:27 UTC (rev 3574)
@@ -1,76 +0,0 @@
-"""Imports from numarray for numerix, the numarray/Numeric interchangeability
-module. These array functions are used when numarray is chosen.
-"""
-from numarray import Int8, UInt8, Int16, UInt16, Int32, UInt32, \
- Float32, Float64, Complex32, Complex64, Float, Int, Complex,\
- typecode
-import numarray.ieeespecial as _ieee
-inf = infinity = infty = Infinity = _ieee.inf
-isnan = _ieee.isnan
-
-class _TypeNamespace:
- """Numeric compatible type aliases for use with extension functions."""
- Int8 = typecode[Int8]
- UInt8 = typecode[UInt8]
- Int16 = typecode[Int16]
- UInt16 = typecode[UInt16]
- Int32 = typecode[Int32]
- #UInt32 = typecode[UInt32] # Todd: this appears broken
- Float32 = typecode[Float32]
- Float64 = typecode[Float64]
- Complex32 = typecode[Complex32]
- Complex64 = typecode[Complex64]
-
-nx = _TypeNamespace()
-
-from numarray import asarray, dot, fromlist, NumArray, shape, alltrue
-from numarray import all as _all
-
-def all(a, axis=None):
- '''Numpy-compatible version of all()'''
- if axis is None:
- return _all(a)
- return alltrue(a, axis)
-
-class _Matrix(NumArray):
- """_Matrix is a ported, stripped down version of the Numeric Matrix
- class which supplies only matrix multiplication.
- """
- def _rc(self, a):
- if len(shape(a)) == 0:
- return a
- else:
- return Matrix(a)
-
- def __mul__(self, other):
- aother = asarray(other)
- #if len(aother.shape) == 0:
- # return self._rc(self*aother)
- #else:
- # return self._rc(dot(self, aother))
- #return self._rc(dot(self, aother))
- return dot(self, aother)
-
- def __rmul__(self, other):
- aother = asarray(other)
- if len(aother.shape) == 0:
- return self._rc(aother*self)
- else:
- return self._rc(dot(aother, self))
-
- def __imul__(self,other):
- aother = asarray(other)
- self[:] = dot(self, aother)
- return self
-
-def Matrix(data, typecode=None, copy=1, savespace=0):
- """Matrix constructs new matrices from 2D nested lists of numbers"""
- if isinstance(data, type("")):
- raise TypeError("numerix Matrix does not support Numeric matrix string notation. Use nested lists.")
- a = fromlist(data, type=typecode)
- if a.rank == 0:
- a.shape = (1,1)
- elif a.rank == 1:
- a.shape = (1,) + a.shape
- a.__class__ = _Matrix
- return a
Deleted: trunk/matplotlib/lib/matplotlib/numerix/_nc_imports.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/_nc_imports.py	2007年07月19日 03:53:37 UTC (rev 3573)
+++ trunk/matplotlib/lib/matplotlib/numerix/_nc_imports.py	2007年07月19日 15:26:27 UTC (rev 3574)
@@ -1,42 +0,0 @@
-from Numeric import array, ravel, reshape, shape, alltrue, sometrue
-from Numeric import Int8, UInt8, Int16, UInt16, Int32, UInt32, \
- Float32, Float64, Complex32, Complex64, Float, Int, Complex
-from numpy import isnan as _isnan
-
-class _TypeNamespace:
- """Numeric compatible type aliases for use with extension functions."""
- Int8 = Int8
- UInt8 = UInt8
- Int16 = Int16
- UInt16 = UInt16
- Int32 = Int32
- UInt32 = UInt32
- Float32 = Float32
- Float64 = Float64
- Complex32 = Complex32
- Complex64 = Complex64
-
-nx = _TypeNamespace()
-
-def isnan(a):
- """y = isnan(x) returns True where x is Not-A-Number"""
- return reshape(array([_isnan(i) for i in ravel(a)],'b'), shape(a))
-
-def all(a, axis=None):
- '''Numpy-compatible version of all()'''
- if axis is None:
- return alltrue(ravel(a))
- else:
- return alltrue(a, axis)
-
-def any(a, axis=None):
- if axis is None:
- return sometrue(ravel(a))
- else:
- return sometrue(a, axis)
-
-
-# inf is useful for testing infinities in results of array divisions
-# (which don't raise exceptions)
-
-inf = infty = infinity = Infinity = (array([1])/0.0)[0]
Deleted: trunk/matplotlib/lib/matplotlib/numerix/_sp_imports.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/_sp_imports.py	2007年07月19日 03:53:37 UTC (rev 3573)
+++ trunk/matplotlib/lib/matplotlib/numerix/_sp_imports.py	2007年07月19日 15:26:27 UTC (rev 3574)
@@ -1,34 +0,0 @@
-try:
- from numpy.oldnumeric import Int8, UInt8, \
- Int16, UInt16, \
- Int32, UInt32, \
- Float32, Float64, \
- Complex32, Complex64, \
- Float, Int, Complex
-except ImportError:
- from numpy import Int8, UInt8, \
- Int16, UInt16, \
- Int32, UInt32, \
- Float32, Float64, \
- Complex32, Complex64, \
- Float, Int, Complex
-
-class _TypeNamespace:
- """Numeric compatible type aliases for use with extension functions."""
- Int8 = Int8
- UInt8 = UInt8
- Int16 = Int16
- UInt16 = UInt16
- Int32 = Int32
- UInt32 = UInt32
- Float32 = Float32
- Float64 = Float64
- Complex32 = Complex32
- Complex64 = Complex64
-
-nx = _TypeNamespace()
-
-from numpy import inf, infty, Infinity
-from numpy.random import rand, randn
-infinity = Infinity
-from numpy import all, isnan, any
Added: trunk/matplotlib/lib/matplotlib/numerix/fft.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/fft.py	 (rev 0)
+++ trunk/matplotlib/lib/matplotlib/numerix/fft.py	2007年07月19日 15:26:27 UTC (rev 3574)
@@ -0,0 +1 @@
+from numpy.oldnumeric.fft import *
Added: trunk/matplotlib/lib/matplotlib/numerix/linear_algebra.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/linear_algebra.py	 (rev 0)
+++ trunk/matplotlib/lib/matplotlib/numerix/linear_algebra.py	2007年07月19日 15:26:27 UTC (rev 3574)
@@ -0,0 +1 @@
+from numpy.oldnumeric.linear_algebra import *
Added: trunk/matplotlib/lib/matplotlib/numerix/ma.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/ma.py	 (rev 0)
+++ trunk/matplotlib/lib/matplotlib/numerix/ma.py	2007年07月19日 15:26:27 UTC (rev 3574)
@@ -0,0 +1,16 @@
+from matplotlib.numerix import use_maskedarray
+
+from numpy.core.ma import *
+
+if use_maskedarray:
+ from maskedarray import *
+ print "using maskedarray"
+else:
+ from numpy.core.ma import *
+ #print "using ma"
+
+def getmaskorNone(obj):
+ _msk = getmask(obj)
+ if _msk is nomask:
+ return None
+ return _msk
Added: trunk/matplotlib/lib/matplotlib/numerix/mlab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/mlab.py	 (rev 0)
+++ trunk/matplotlib/lib/matplotlib/numerix/mlab.py	2007年07月19日 15:26:27 UTC (rev 3574)
@@ -0,0 +1,4 @@
+from numpy.oldnumeric.mlab import *
+
+amin = min
+amax = max
Added: trunk/matplotlib/lib/matplotlib/numerix/npyma.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/npyma.py	 (rev 0)
+++ trunk/matplotlib/lib/matplotlib/numerix/npyma.py	2007年07月19日 15:26:27 UTC (rev 3574)
@@ -0,0 +1,10 @@
+from matplotlib.numerix import use_maskedarray
+
+from numpy.core.ma import *
+
+if use_maskedarray:
+ from maskedarray import *
+ print "using maskedarray"
+else:
+ from numpy.core.ma import *
+ #print "using ma"
Added: trunk/matplotlib/lib/matplotlib/numerix/random_array.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/random_array.py	 (rev 0)
+++ trunk/matplotlib/lib/matplotlib/numerix/random_array.py	2007年07月19日 15:26:27 UTC (rev 3574)
@@ -0,0 +1 @@
+from numpy.oldnumeric.random_array import *
Modified: trunk/matplotlib/setup.py
===================================================================
--- trunk/matplotlib/setup.py	2007年07月19日 03:53:37 UTC (rev 3573)
+++ trunk/matplotlib/setup.py	2007年07月19日 15:26:27 UTC (rev 3574)
@@ -124,12 +124,6 @@
 'matplotlib.backends',
 'matplotlib.toolkits',
 'matplotlib.numerix',
- 'matplotlib.numerix.mlab',
- 'matplotlib.numerix.ma',
- 'matplotlib.numerix.npyma',
- 'matplotlib.numerix.linear_algebra',
- 'matplotlib.numerix.random_array',
- 'matplotlib.numerix.fft',
 ]
 
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <nn...@us...> - 2007年07月19日 16:53:43
Revision: 3575
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3575&view=rev
Author: nnemec
Date: 2007年07月19日 09:53:36 -0700 (2007年7月19日)
Log Message:
-----------
converted many non-numpy relicts
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/lib/matplotlib/axes3d.py
 trunk/matplotlib/lib/matplotlib/axis.py
 trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
 trunk/matplotlib/lib/matplotlib/backends/backend_agg2.py
 trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py
 trunk/matplotlib/lib/matplotlib/backends/backend_gd.py
 trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py
 trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py
 trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
 trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
 trunk/matplotlib/lib/matplotlib/backends/backend_qt.py
 trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py
 trunk/matplotlib/lib/matplotlib/colors.py
 trunk/matplotlib/lib/matplotlib/image.py
 trunk/matplotlib/lib/matplotlib/legend.py
 trunk/matplotlib/lib/matplotlib/lines.py
 trunk/matplotlib/lib/matplotlib/mlab.py
 trunk/matplotlib/lib/matplotlib/numerix/__init__.py
 trunk/matplotlib/lib/matplotlib/patches.py
 trunk/matplotlib/lib/matplotlib/proj3d.py
 trunk/matplotlib/lib/matplotlib/table.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2007年07月19日 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/CHANGELOG	2007年07月19日 16:53:36 UTC (rev 3575)
@@ -1,3 +1,5 @@
+2007年07月19日 converted non-numpy relicts troughout the code
+
 2007年07月19日 replaced the Python code in numerix/ by a minimal wrapper around
 numpy that explicitly mentions all symbols that need to be
 	 addressed for further numpification - NN
Modified: trunk/matplotlib/lib/matplotlib/axes3d.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes3d.py	2007年07月19日 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/axes3d.py	2007年07月19日 16:53:36 UTC (rev 3575)
@@ -309,8 +309,8 @@
 
 viewM = proj3d.view_transformation(E,R,V)
 perspM = proj3d.persp_transformation(zfront,zback)
- M0 = nx.matrixmultiply(viewM,worldM)
- M = nx.matrixmultiply(perspM,M0)
+ M0 = nx.dot(viewM,worldM)
+ M = nx.dot(perspM,M0)
 return M
 
 def mouse_init(self):
Modified: trunk/matplotlib/lib/matplotlib/axis.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axis.py	2007年07月19日 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/axis.py	2007年07月19日 16:53:36 UTC (rev 3575)
@@ -8,7 +8,7 @@
 import sys
 
 from numerix import arange, array, asarray, ones, zeros, \
- nonzero, take, Float, log10, logical_and, \
+ nonzero, take, log10, logical_and, \
 dot, sin, cos, tan, pi, sqrt
 
 from artist import Artist, setp
@@ -118,7 +118,7 @@
 
 def contains(self, mouseevent):
 """Test whether the mouse event occured in the Tick marks.
- 
+
 This function always returns false. It is more useful to test if the
 axis as a whole contains the mouse rather than the set of tick marks.
 """
@@ -492,7 +492,7 @@
 LABELPAD = 5
 OFFSETTEXTPAD = 3
 
- def __str__(self): 
+ def __str__(self):
 return str(self.__class__).split('.')[-1] \
 + "(%d,%d)"%self.axes.transAxes.xy_tup((0,0))
 
@@ -657,7 +657,7 @@
 def get_offset_text(self):
 'Return the axis offsetText as a Text instance'
 return self.offsetText
- 
+
 def get_pickradius(self):
 'Return the depth of the axis used by the picker'
 return self.pickradius
@@ -901,11 +901,11 @@
 self.minor.locator = locator
 self.minor.locator.set_view_interval( self.get_view_interval() )
 self.minor.locator.set_data_interval( self.get_data_interval() )
- 
+
 def set_pickradius(self, pickradius):
 """
 Set the depth of the axis used by the picker
- 
+
 ACCEPTS: a distance in points
 """
 self.pickradius = pickradius
@@ -967,12 +967,12 @@
 
 class XAxis(Axis):
 __name__ = 'xaxis'
- 
+
 def contains(self,mouseevent):
 """Test whether the mouse event occured in the x axis.
 """
 if callable(self._contains): return self._contains(self,mouseevent)
- 
+
 xpixel,ypixel = mouseevent.x,mouseevent.y
 try:
 xaxes,yaxes = self.axes.transAxes.inverse_xy_tup((xpixel,ypixel))
@@ -1155,11 +1155,11 @@
 
 def contains(self,mouseevent):
 """Test whether the mouse event occurred in the y axis.
- 
+
 Returns T/F, {}
 """
 if callable(self._contains): return self._contains(self,mouseevent)
- 
+
 xpixel,ypixel = mouseevent.x,mouseevent.y
 try:
 xaxes,yaxes = self.axes.transAxes.inverse_xy_tup((xpixel,ypixel))
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py	2007年07月19日 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py	2007年07月19日 16:53:36 UTC (rev 3575)
@@ -73,7 +73,7 @@
 import os, sys
 import matplotlib
 from matplotlib import verbose, rcParams
-from matplotlib.numerix import array, Float, zeros, transpose
+from numpy import array, zeros, transpose
 from matplotlib._image import fromarray
 from matplotlib._pylab_helpers import Gcf
 from matplotlib.backend_bases import RendererBase,\
@@ -154,8 +154,8 @@
 point in x, y
 """
 if __debug__: verbose.report('RendererAgg.draw_line', 'debug-annoying')
- x = array([x1,x2], typecode=Float)
- y = array([y1,y2], typecode=Float)
+ x = array([x1,x2], float)
+ y = array([y1,y2], float)
 self._renderer.draw_lines(gc, x, y)
 
 
@@ -273,7 +273,7 @@
 def func(x):
 return transpose(fliplr(x))
 
- Z = zeros((n,m,4), typecode=Float)
+ Z = zeros((n,m,4), float)
 Z[:,:,0] = func(r)
 Z[:,:,1] = func(g)
 Z[:,:,2] = func(b)
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg2.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_agg2.py	2007年07月19日 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_agg2.py	2007年07月19日 16:53:36 UTC (rev 3575)
@@ -8,7 +8,7 @@
 import matplotlib.agg as agg
 
 from matplotlib import verbose
-from matplotlib.numerix import array, Float
+from numpy import array
 
 from matplotlib._pylab_helpers import Gcf
 from matplotlib.backend_bases import RendererBase,\
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py	2007年07月19日 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py	2007年07月19日 16:53:36 UTC (rev 3575)
@@ -38,7 +38,7 @@
 from matplotlib.cbook import enumerate, izip
 from matplotlib.figure import Figure
 from matplotlib.mathtext import math_parse_s_ft2font
-import matplotlib.numerix as numx
+import numpy as npy
 from matplotlib.transforms import Bbox
 from matplotlib import rcParams
 
@@ -137,8 +137,8 @@
 ctx.rotate(rotation)
 ctx.scale(width / 2.0, height / 2.0)
 ctx.new_sub_path()
- ctx.arc(0.0, 0.0, 1.0, numx.pi * angle1 / 180.,
- numx.pi * angle2 / 180.)
+ ctx.arc(0.0, 0.0, 1.0, npy.pi * angle1 / 180.,
+ npy.pi * angle2 / 180.)
 ctx.restore()
 
 self._fill_and_stroke (ctx, rgbFace)
@@ -243,7 +243,7 @@
 # render by drawing a 0.5 radius circle
 ctx = gc.ctx
 ctx.new_path()
- ctx.arc (x, self.height - y, 0.5, 0, 2*numx.pi)
+ ctx.arc (x, self.height - y, 0.5, 0, 2*npy.pi)
 self._fill_and_stroke (ctx, gc.get_rgb())
 
 
@@ -294,7 +294,7 @@
 
 ctx.save()
 if angle:
- ctx.rotate (-angle * numx.pi / 180)
+ ctx.rotate (-angle * npy.pi / 180)
 ctx.set_font_size (size)
 ctx.show_text (s)
 ctx.restore()
@@ -304,7 +304,7 @@
 if _debug: print '%s.%s()' % (self.__class__.__name__, _fn_name())
 # mathtext using the gtk/gdk method
 
- #if numx.which[0] == "numarray":
+ #if npy.which[0] == "numarray":
 # warnings.warn("_draw_mathtext() currently works for numpy, but "
 # "not numarray")
 # return
@@ -327,21 +327,21 @@
 N = imw*imh
 
 # a numpixels by num fonts array
- Xall = numx.zeros((N,len(fonts)), typecode=numx.UInt8)
+ Xall = npy.zeros((N,len(fonts)), npy.uint8)
 
 for i, font in enumerate(fonts):
 if angle == 90:
 font.horiz_image_to_vert_image() # <-- Rotate
 imw, imh, s = font.image_as_str()
- Xall[:,i] = numx.fromstring(s, numx.UInt8)
+ Xall[:,i] = npy.fromstring(s, npy.uint8)
 
 # get the max alpha at each pixel
- Xs = numx.mlab.max (Xall,1)
+ Xs = npy.mlab.max (Xall,1)
 
 # convert it to it's proper shape
 Xs.shape = imh, imw
 
- pa = numx.zeros(shape=(imh,imw,4), typecode=numx.UInt8)
+ pa = npy.zeros((imh,imw,4), npy.uint8)
 rgb = gc.get_rgb()
 pa[:,:,0] = int(rgb[0]*255)
 pa[:,:,1] = int(rgb[1]*255)
@@ -469,7 +469,7 @@
 self.ctx.set_dash([], 0) # switch dashes off
 else:
 self.ctx.set_dash (
- self.renderer.points_to_pixels (numx.asarray(dashes)), offset)
+ self.renderer.points_to_pixels (npy.asarray(dashes)), offset)
 
 
 def set_foreground(self, fg, isRGB=None):
@@ -593,7 +593,7 @@
 ctx = renderer.ctx
 
 if orientation == 'landscape':
- ctx.rotate (numx.pi/2)
+ ctx.rotate (npy.pi/2)
 ctx.translate (0, -height_in_points)
 # cairo/src/cairo_ps_surface.c
 # '%%Orientation: Portrait' is always written to the file header
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gd.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_gd.py	2007年07月19日 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_gd.py	2007年07月19日 16:53:36 UTC (rev 3575)
@@ -115,8 +115,8 @@
 point in x, y
 """
 
- x = x.astype(nx.Int16)
- y = self.height*ones(y.shape, nx.Int16) - y.astype(nx.Int16)
+ x = x.astype(nx.int16)
+ y = self.height*ones(y.shape, nx.int16) - y.astype(nx.int16)
 style = self._set_gd_style(gc)
 self.im.lines( zip(x,y), style)
 self.flush_clip()
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py	2007年07月19日 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py	2007年07月19日 16:53:36 UTC (rev 3575)
@@ -24,7 +24,7 @@
 from matplotlib.figure import Figure
 from matplotlib.mathtext import math_parse_s_ft2font
 import matplotlib.numerix as numerix
-from matplotlib.numerix import asarray, fromstring, UInt8, zeros, \
+from matplotlib.numerix import asarray, fromstring, uint8, zeros, \
 where, transpose, nonzero, indices, ones, nx
 
 
@@ -106,7 +106,7 @@
 im.flipud_out()
 rows, cols, image_str = im.as_rgba_str()
 
- image_array = fromstring(image_str, UInt8)
+ image_array = fromstring(image_str, uint8)
 image_array.shape = rows, cols, 4
 
 pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB,
@@ -144,8 +144,8 @@
 
 def draw_lines(self, gc, x, y, transform=None):
 if gc.gdkGC.line_width > 0:
- x = x.astype(nx.Int16)
- y = self.height - y.astype(nx.Int16)
+ x = x.astype(nx.int16)
+ y = self.height - y.astype(nx.int16)
 self.gdkDrawable.draw_lines(gc.gdkGC, zip(x,y))
 
 
@@ -213,13 +213,13 @@
 N = imw*imh
 
 # a numpixels by num fonts array
- Xall = zeros((N,len(fonts)), typecode=UInt8)
+ Xall = zeros((N,len(fonts)), uint8)
 
 for i, font in enumerate(fonts):
 if angle == 90:
 font.horiz_image_to_vert_image() # <-- Rotate
 imw, imh, image_str = font.image_as_str()
- Xall[:,i] = fromstring(image_str, UInt8)
+ Xall[:,i] = fromstring(image_str, uint8)
 
 # get the max alpha at each pixel
 Xs = numerix.mlab.max(Xall,1)
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py	2007年07月19日 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py	2007年07月19日 16:53:36 UTC (rev 3575)
@@ -22,9 +22,8 @@
 from matplotlib.cbook import is_string_like, enumerate
 from matplotlib.colors import colorConverter
 from matplotlib.figure import Figure
-import matplotlib.numerix as numerix
-from matplotlib.numerix import asarray, fromstring, UInt8, zeros, \
- where, transpose, nonzero, indices, ones, nx
+from numpy import asarray, fromstring, zeros, \
+ where, transpose, nonzero, indices, ones
 from matplotlib.widgets import SubplotTool
 
 from matplotlib import lines
@@ -156,7 +155,7 @@
 gdk.LEAVE_NOTIFY_MASK |
 gdk.POINTER_MOTION_MASK |
 gdk.POINTER_MOTION_HINT_MASK)
- 
+
 def __init__(self, figure):
 if _debug: print 'FigureCanvasGTK.%s' % fn_name()
 FigureCanvasBase.__init__(self, figure)
@@ -1087,7 +1086,7 @@
 
 hbox.show_all()
 self.set_extra_widget(hbox)
- 
+
 def get_filename_from_user (self):
 while True:
 filename = None
@@ -1137,7 +1136,7 @@
 
 def __init__(self, lines):
 import gtk.glade
- 
+
 datadir = matplotlib.get_data_path()
 gladefile = os.path.join(datadir, 'lineprops.glade')
 if not os.path.exists(gladefile):
@@ -1279,7 +1278,7 @@
 # Unfortunately, the SVG renderer (rsvg) leaks memory under earlier
 # versions of pygtk, so we have to use a PNG file instead.
 try:
- 
+
 if gtk.pygtk_version < (2, 8, 0):
 icon_filename = 'matplotlib.png'
 else:
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py	2007年07月19日 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py	2007年07月19日 16:53:36 UTC (rev 3575)
@@ -28,7 +28,7 @@
 from matplotlib.dviread import Dvi
 from matplotlib.ft2font import FT2Font, FIXED_WIDTH, ITALIC, LOAD_NO_SCALE
 from matplotlib.mathtext import math_parse_s_pdf
-from matplotlib.numerix import Float32, UInt8, fromstring, arange, infinity, isnan, asarray
+from numpy import float32, uint8, fromstring, arange, infinity, isnan, asarray
 from matplotlib.transforms import Bbox
 from matplotlib import ttconv
 
@@ -543,13 +543,13 @@
 fontdict['FontMatrix'] = [ .001, 0, 0, .001, 0, 0 ]
 fontdict['CharProcs'] = charprocsObject
 fontdict['Encoding'] = {
- 'Type': Name('Encoding'), 
+ 'Type': Name('Encoding'),
 'Differences': differencesArray}
 elif fonttype == 42:
 fontdict['Subtype'] = Name('TrueType')
 fontdict['Encoding'] = Name('WinAnsiEncoding')
 
- 
+
 flags = 0
 symbolic = False #ps_name.name in ('Cmsy10', 'Cmmi10', 'Cmex10')
 if ff & FIXED_WIDTH: flags |= 1 << 0
@@ -632,7 +632,7 @@
 self.beginStream(charprocObject.id,
 None,
 {'Length': len(stream)})
- self.currentstream.write(stream) 
+ self.currentstream.write(stream)
 self.endStream()
 charprocs[charname] = charprocObject
 self.writeObject(charprocsObject, charprocs)
@@ -755,20 +755,20 @@
 def _rgb(self, im):
 h,w,s = im.as_rgba_str()
 
- rgba = fromstring(s, UInt8)
+ rgba = fromstring(s, uint8)
 rgba.shape = (h, w, 4)
 rgb = rgba[:,:,:3]
 return h, w, rgb.tostring()
 
 def _gray(self, im, rc=0.3, gc=0.59, bc=0.11):
 rgbat = im.as_rgba_str()
- rgba = fromstring(rgbat[2], UInt8)
+ rgba = fromstring(rgbat[2], uint8)
 rgba.shape = (rgbat[0], rgbat[1], 4)
- rgba_f = rgba.astype(Float32)
+ rgba_f = rgba.astype(float32)
 r = rgba_f[:,:,0]
 g = rgba_f[:,:,1]
 b = rgba_f[:,:,2]
- gray = (r*rc + g*gc + b*bc).astype(UInt8)
+ gray = (r*rc + g*gc + b*bc).astype(uint8)
 return rgbat[0], rgbat[1], gray.tostring()
 
 def writeImages(self):
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py	2007年07月19日 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py	2007年07月19日 16:53:36 UTC (rev 3575)
@@ -26,7 +26,7 @@
 
 from matplotlib.transforms import get_vec6_scales
 
-from matplotlib.numerix import UInt8, Float32, alltrue, array, ceil, equal, \
+from matplotlib.numerix import uint8, float32, alltrue, array, ceil, equal, \
 fromstring, nonzero, ones, put, take, where, isnan
 import binascii
 import re
@@ -336,20 +336,20 @@
 def _rgb(self, im):
 h,w,s = im.as_rgba_str()
 
- rgba = fromstring(s, UInt8)
+ rgba = fromstring(s, uint8)
 rgba.shape = (h, w, 4)
 rgb = rgba[:,:,:3]
 return h, w, rgb.tostring()
 
 def _gray(self, im, rc=0.3, gc=0.59, bc=0.11):
 rgbat = im.as_rgba_str()
- rgba = fromstring(rgbat[2], UInt8)
+ rgba = fromstring(rgbat[2], uint8)
 rgba.shape = (rgbat[0], rgbat[1], 4)
- rgba_f = rgba.astype(Float32)
+ rgba_f = rgba.astype(float32)
 r = rgba_f[:,:,0]
 g = rgba_f[:,:,1]
 b = rgba_f[:,:,2]
- gray = (r*rc + g*gc + b*bc).astype(UInt8)
+ gray = (r*rc + g*gc + b*bc).astype(uint8)
 return rgbat[0], rgbat[1], gray.tostring()
 
 def _hex_lines(self, s, chars_per_line=128):
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_qt.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_qt.py	2007年07月19日 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_qt.py	2007年07月19日 16:53:36 UTC (rev 3575)
@@ -5,9 +5,8 @@
 
 import matplotlib
 from matplotlib import verbose
-from matplotlib.numerix import asarray, fromstring, UInt8, zeros, \
- where, transpose, nonzero, indices, ones, nx
-import matplotlib.numerix as numerix
+from numpy import asarray, fromstring, zeros, \
+ where, transpose, nonzero, indices, ones
 from matplotlib.cbook import is_string_like, enumerate, onetrue
 from matplotlib.font_manager import fontManager
 from matplotlib.backend_bases import RendererBase, GraphicsContextBase, \
@@ -323,7 +322,7 @@
 for text, tooltip_text, image_file, callback in self.toolitems:
 if text is not None:
 qt.QObject.disconnect( self.buttons[ text ],
- qt.SIGNAL( 'clicked()' ), 
+ qt.SIGNAL( 'clicked()' ),
 getattr( self, callback ) )
 
 def pan( self, *args ):
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py	2007年07月19日 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py	2007年07月19日 16:53:36 UTC (rev 3575)
@@ -5,9 +5,8 @@
 
 import matplotlib
 from matplotlib import verbose
-from matplotlib.numerix import asarray, fromstring, UInt8, zeros, \
- where, transpose, nonzero, indices, ones, nx
-import matplotlib.numerix as numerix
+from numpy import asarray, fromstring, zeros, \
+ where, transpose, nonzero, indices, ones
 from matplotlib.cbook import is_string_like, enumerate, onetrue
 from matplotlib.font_manager import fontManager
 from matplotlib.backend_bases import RendererBase, GraphicsContextBase, \
Modified: trunk/matplotlib/lib/matplotlib/colors.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/colors.py	2007年07月19日 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/colors.py	2007年07月19日 16:53:36 UTC (rev 3575)
@@ -432,7 +432,7 @@
 mask_bad = ma.getmask(xma)
 if xa.dtype.char in npy.typecodes['Float']:
 npy.putmask(xa, xa==1.0, 0.9999999) #Treat 1.0 as slightly less than 1.
- xa = (xa * self.N).astype(npy.int)
+ xa = (xa * self.N).astype(int)
 # Set the over-range indices before the under-range;
 # otherwise the under-range values get converted to over-range.
 npy.putmask(xa, xa>self.N-1, self._i_over)
Modified: trunk/matplotlib/lib/matplotlib/image.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/image.py	2007年07月19日 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/image.py	2007年07月19日 16:53:36 UTC (rev 3575)
@@ -11,7 +11,7 @@
 import cm
 import numerix
 import numerix.ma as ma
-from numerix import arange, asarray, UInt8, Float32, repeat, NewAxis, typecode
+from numerix import arange, asarray, uint8, float32, repeat, newaxis
 import _image
 
 
@@ -117,7 +117,7 @@
 raise RuntimeError('You must first set the image array or the image attribute')
 
 if self._imcache is None:
- if typecode(self._A) == UInt8 and len(self._A.shape) == 3:
+ if self._A.dtype == uint8 and len(self._A.shape) == 3:
 im = _image.frombyte(self._A, 0)
 im.is_grayscale = False
 else:
@@ -186,7 +186,7 @@
 """Test whether the mouse event occured within the image.
 """
 if callable(self._contains): return self._contains(self,mouseevent)
- # TODO: make sure this is consistent with patch and patch 
+ # TODO: make sure this is consistent with patch and patch
 # collection on nonlinear transformed coordinates.
 # TODO: consider returning image coordinates (shouldn't
 # be too difficult given that the image is rectilinear
@@ -197,7 +197,7 @@
 inside = xdata>=xmin and xdata<=xmax and ydata>=ymin and ydata<=ymax
 else:
 inside = False
- 
+
 return inside,{}
 
 def write_png(self, fname, noscale=False):
@@ -333,8 +333,8 @@
 return im
 
 def set_data(self, x, y, A):
- x = asarray(x).astype(Float32)
- y = asarray(y).astype(Float32)
+ x = asarray(x,float32)
+ y = asarray(y,float32)
 A = asarray(A)
 if len(x.shape) != 1 or len(y.shape) != 1\
 or A.shape[0:2] != (y.shape[0], x.shape[0]):
@@ -346,16 +346,16 @@
 if len(A.shape) == 3 and A.shape[2] == 1:
 A.shape = A.shape[0:2]
 if len(A.shape) == 2:
- if typecode(A) != UInt8:
- A = (self.cmap(self.norm(A))*255).astype(UInt8)
+ if A.dtype != uint8:
+ A = (self.cmap(self.norm(A))*255).astype(uint8)
 else:
- A = repeat(A[:,:,NewAxis], 4, 2)
+ A = repeat(A[:,:,newaxis], 4, 2)
 A[:,:,3] = 255
 else:
- if typecode(A) != UInt8:
- A = (255*A).astype(UInt8)
+ if A.dtype != uint8:
+ A = (255*A).astype(uint8)
 if A.shape[2] == 3:
- B = zeros(tuple(list(A.shape[0:2]) + [4]), UInt8)
+ B = zeros(tuple(list(A.shape[0:2]) + [4]), uint8)
 B[:,:,0:3] = A
 B[:,:,3] = 255
 A = B
@@ -428,7 +428,7 @@
 inside = xdata>=xmin and xdata<=xmax and ydata>=ymin and ydata<=ymax
 else:
 inside = False
- 
+
 return inside,{}
 
 def get_size(self):
@@ -441,7 +441,7 @@
 def get_extent(self):
 'get the image extent: left, right, bottom, top'
 numrows, numcols = self.get_size()
- return (-0.5+self.ox, numcols-0.5+self.ox, 
+ return (-0.5+self.ox, numcols-0.5+self.ox,
 -0.5+self.oy, numrows-0.5+self.oy)
 
 def make_image(self, magnification=1.0):
@@ -504,6 +504,6 @@
 raise RuntimeError('Unknown image mode')
 
 x_str = im.tostring('raw',im.mode,0,-1)
- x = numerix.fromstring(x_str,numerix.UInt8)
+ x = numerix.fromstring(x_str,numerix.uint8)
 x.shape = im.size[1], im.size[0], 4
 return x
Modified: trunk/matplotlib/lib/matplotlib/legend.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/legend.py	2007年07月19日 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/legend.py	2007年07月19日 16:53:36 UTC (rev 3575)
@@ -22,7 +22,7 @@
 """
 from __future__ import division
 import sys, warnings
-from numerix import array, ones, Float
+from numerix import array, ones
 
 
 from matplotlib import verbose, rcParams
@@ -280,7 +280,7 @@
 x, y = label.get_position()
 x -= self.handlelen + self.handletextsep
 if isinstance(handle, Line2D):
- ydata = (y-HEIGHT/2)*ones(self._xdata.shape, Float)
+ ydata = (y-HEIGHT/2)*ones(self._xdata.shape, float)
 legline = Line2D(self._xdata, ydata)
 legline.update_from(handle)
 self._set_artist_props(legline) # after update
@@ -298,7 +298,7 @@
 p.set_clip_box(None)
 ret.append(p)
 elif isinstance(handle, LineCollection):
- ydata = (y-HEIGHT/2)*ones(self._xdata.shape, Float)
+ ydata = (y-HEIGHT/2)*ones(self._xdata.shape, float)
 legline = Line2D(self._xdata, ydata)
 self._set_artist_props(legline)
 legline.set_clip_box(None)
@@ -555,7 +555,7 @@
 for handle, tup in zip(self.legendHandles, hpos):
 y,h = tup
 if isinstance(handle, Line2D):
- ydata = y*ones(self._xdata.shape, Float)
+ ydata = y*ones(self._xdata.shape, float)
 handle.set_ydata(ydata+h/2)
 elif isinstance(handle, Rectangle):
 handle.set_y(y+1/4*h)
Modified: trunk/matplotlib/lib/matplotlib/lines.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/lines.py	2007年07月19日 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/lines.py	2007年07月19日 16:53:36 UTC (rev 3575)
@@ -9,10 +9,10 @@
 import sys, math, warnings
 
 import agg
-from numerix import Float, alltrue, arange, array, logical_and, \
+from numerix import alltrue, arange, array, logical_and, \
 nonzero, searchsorted, take, asarray, ones, where, less, ravel, \
 greater, cos, sin, pi, sqrt, less_equal, \
- compress, zeros, concatenate, cumsum, typecode, NewAxis
+ compress, zeros, concatenate, cumsum, newaxis
 import numerix.ma as ma
 from matplotlib import verbose
 import artist
@@ -64,12 +64,12 @@
 if len(i1) == 0:
 return None
 if not compressed:
- return concatenate((i0[:, NewAxis], i1[:, NewAxis]), axis=1)
+ return concatenate((i0[:, newaxis], i1[:, newaxis]), axis=1)
 seglengths = i1 - i0
 breakpoints = cumsum(seglengths)
 ic0 = concatenate(((0,), breakpoints[:-1]))
 ic1 = breakpoints
- return concatenate((ic0[:, NewAxis], ic1[:, NewAxis]), axis=1)
+ return concatenate((ic0[:, newaxis], ic1[:, newaxis]), axis=1)
 
 def segment_hits(cx,cy,x,y,radius):
 """Determine if any line segments are within radius of a point. Returns
@@ -88,7 +88,7 @@
 u = ( (cx-xr)*dx + (cy-yr)*dy )/Lnorm_sq
 candidates = (u>=0) & (u<=1)
 #if any(candidates): print "candidates",xr[candidates]
- 
+
 # Note that there is a little area near one side of each point
 # which will be near neither segment, and another which will
 # be near both, depending on the angle of the lines. The
@@ -96,7 +96,7 @@
 point_hits = (cx - x)**2 + (cy - y)**2 <= radius**2
 #if any(point_hits): print "points",xr[candidates]
 candidates = candidates & ~point_hits[:-1] & ~point_hits[1:]
- 
+
 # For those candidates which remain, determine how far they lie away
 # from the line.
 px,py = xr+u*dx,yr+u*dy
@@ -164,7 +164,7 @@
 else:
 return "Line2D(%s)"\
 %(",".join(["(%g,%g)"%(x,y) for x,y in zip(self._x,self._y)]))
- 
+
 def __init__(self, xdata, ydata,
 linewidth = None, # all Nones default to rc
 linestyle = None,
@@ -274,25 +274,25 @@
 
 self.set_data(xdata, ydata)
 self._logcache = None
- 
+
 # TODO: do we really need 'newstyle'
 self._newstyle = False
 
 def contains(self, mouseevent):
 """Test whether the mouse event occurred on the line. The pick radius determines
 the precision of the location test (usually within five points of the value). Use
- get/set pickradius() to view or modify it. 
- 
- Returns True if any values are within the radius along with {'ind': pointlist}, 
+ get/set pickradius() to view or modify it.
+
+ Returns True if any values are within the radius along with {'ind': pointlist},
 where pointlist is the set of points within the radius.
- 
+
 TODO: sort returned indices by distance
 """
 if callable(self._contains): return self._contains(self,mouseevent)
- 
+
 if not is_numlike(self.pickradius):
 raise ValueError,"pick radius should be a distance"
- 
+
 if self._newstyle:
 # transform in backend
 x = self._x
@@ -308,7 +308,7 @@
 pixels = self.pickradius
 else:
 pixels = self.figure.dpi.get()/72. * self.pickradius
- 
+
 if self._linestyle == 'None':
 # If no line, return the nearby point(s)
 d = sqrt((xt-mouseevent.x)**2 + (yt-mouseevent.y)**2)
@@ -322,21 +322,21 @@
 print 'd', (xt-mouseevent.x)**2., (yt-mouseevent.y)**2.
 print d, pixels, ind
 return len(ind)>0,dict(ind=ind)
- 
+
 def get_pickradius(self):
 'return the pick radius used for containment tests'
 return self.pickradius
 
- def set_pickradius(self,d): 
+ def set_pickradius(self,d):
 """Sets the pick radius used for containment tests
- 
+
 Accepts: float distance in points.
 """
 self.pickradius = d
- 
+
 def set_picker(self,p):
 """Sets the event picker details for the line.
- 
+
 Accepts: float distance in points or callable pick function fn(artist,event)
 """
 if callable(p):
@@ -344,7 +344,7 @@
 else:
 self.pickradius = p
 self._picker = p
- 
+
 def get_window_extent(self, renderer):
 self._newstyle = hasattr(renderer, 'draw_markers')
 if self._newstyle:
@@ -398,15 +398,15 @@
 def recache(self):
 #if self.axes is None: print 'recache no axes'
 #else: print 'recache units', self.axes.xaxis.units, self.axes.yaxis.units
- x = ma.asarray(self.convert_xunits(self._xorig), Float)
- y = ma.asarray(self.convert_yunits(self._yorig), Float)
+ x = ma.asarray(self.convert_xunits(self._xorig), float)
+ y = ma.asarray(self.convert_yunits(self._yorig), float)
 
 x = ma.ravel(x)
 y = ma.ravel(y)
 if len(x)==1 and len(y)>1:
- x = x * ones(y.shape, Float)
+ x = x * ones(y.shape, float)
 if len(y)==1 and len(x)>1:
- y = y * ones(x.shape, Float)
+ y = y * ones(x.shape, float)
 
 if len(x) != len(y):
 raise RuntimeError('xdata and ydata must be the same length')
@@ -421,8 +421,8 @@
 else:
 self._segments = None
 
- self._x = asarray(x, Float)
- self._y = asarray(y, Float)
+ self._x = asarray(x, float)
+ self._y = asarray(y, float)
 
 self._logcache = None
 
@@ -557,7 +557,7 @@
 else:
 return self._markerfacecolor
 
- 
+
 def get_markersize(self): return self._markersize
 
 def get_xdata(self, orig=True):
@@ -708,9 +708,9 @@
 def _draw_steps(self, renderer, gc, xt, yt):
 siz=len(xt)
 if siz<2: return
- xt2=ones((2*siz,), typecode(xt))
+ xt2=ones((2*siz,), xt.dtype)
 xt2[0:-1:2], xt2[1:-1:2], xt2[-1]=xt, xt[1:], xt[-1]
- yt2=ones((2*siz,), typecode(yt))
+ yt2=ones((2*siz,), yt.dtype)
 yt2[0:-1:2], yt2[1::2]=yt, yt
 gc.set_linestyle('solid')
 
Modified: trunk/matplotlib/lib/matplotlib/mlab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mlab.py	2007年07月19日 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/mlab.py	2007年07月19日 16:53:36 UTC (rev 3575)
@@ -71,7 +71,7 @@
 multiply, transpose, ravel, repeat, resize, reshape, floor, ceil,\
 absolute, matrixmultiply, power, take, where, Float, Int, asum,\
 dot, convolve, pi, Complex, ones, zeros, diagonal, Matrix, nonzero, \
- log, searchsorted, concatenate, sort, ArrayType, clip, size, indices,\
+ log, searchsorted, concatenate, sort, ArrayType, ndarray, clip, size, indices,\
 conjugate, typecode, iscontiguous
 
 
@@ -184,7 +184,7 @@
 
 
 # for real x, ignore the negative frequencies
- if typecode(x)==Complex: numFreqs = NFFT
+ if npy.iscomplexobj(x): numFreqs = NFFT
 else: numFreqs = NFFT//2+1
 
 if iterable(window):
@@ -195,7 +195,7 @@
 step = NFFT-noverlap
 ind = range(0,len(x)-NFFT+1,step)
 n = len(ind)
- Pxx = zeros((numFreqs,n), Float)
+ Pxx = zeros((numFreqs,n), float)
 # do the ffts of the slices
 for i in range(n):
 thisX = x[ind[i]:ind[i]+NFFT]
@@ -243,7 +243,7 @@
 
 if NFFT % 2:
 raise ValueError, 'NFFT must be a power of 2'
- 
+
 x = asarray(x) # make sure we're dealing with a numpy array
 y = asarray(y) # make sure we're dealing with a numpy array
 
@@ -258,7 +258,7 @@
 y[n:] = 0
 
 # for real x, ignore the negative frequencies
- if typecode(x)==Complex: numFreqs = NFFT
+ if npy.iscomplexobj(x): numFreqs = NFFT
 else: numFreqs = NFFT//2+1
 
 if iterable(window):
@@ -269,7 +269,7 @@
 step = NFFT-noverlap
 ind = range(0,len(x)-NFFT+1,step)
 n = len(ind)
- Pxy = zeros((numFreqs,n), Complex)
+ Pxy = zeros((numFreqs,n), complex)
 
 # do the ffts of the slices
 for i in range(n):
@@ -542,7 +542,7 @@
 del seen
 
 # for real X, ignore the negative frequencies
- if typecode(X)==Complex: numFreqs = NFFT
+ if npy.iscomplexobj(X): numFreqs = NFFT
 else: numFreqs = NFFT//2+1
 
 # cache the FFT of every windowed, detrended NFFT length segement
@@ -562,7 +562,7 @@
 normVal = norm(windowVals)**2
 for iCol in allColumns:
 progressCallback(i/Ncols, 'Cacheing FFTs')
- Slices = zeros( (numSlices,numFreqs), Complex)
+ Slices = zeros( (numSlices,numFreqs), complex)
 for iSlice in slices:
 thisSlice = X[ind[iSlice]:ind[iSlice]+NFFT, iCol]
 thisSlice = windowVals*detrend(thisSlice)
@@ -618,7 +618,7 @@
 
 
 n,bins = hist(y, bins)
- n = n.astype(Float)
+ n = n.astype(float)
 
 n = take(n, nonzero(n)) # get the positive
 
@@ -691,14 +691,14 @@
 dx = x[1]-x[0]
 
 
- f = 1/(N*dx)*arange(-N/2, N/2, Float)
+ f = 1/(N*dx)*arange(-N/2, N/2, float)
 
- ind = concatenate([arange(N/2, N, Int),
- arange(N/2,Int)])
+ ind = concatenate([arange(N/2, N, int),
+ arange(0, N/2, int)])
 df = f[1]-f[0]
 cfl = exp(-gamma*absolute(2*pi*f)**alpha)
 
- px = fft(take(cfl,ind)*df).astype(Float)
+ px = fft(take(cfl,ind)*df).astype(float)
 return take(px, ind)
 
 
@@ -758,7 +758,7 @@
 if len(ind)==0: return arange(len(x))
 if len(ind)==len(x): return array([])
 
- y = zeros( (len(x)+2,), Int)
+ y = zeros( (len(x)+2,), int)
 y[1:-1] = x
 d = diff(y)
 #print 'd', d
@@ -811,7 +811,7 @@
 return x[int(p*Nx/100.0)]
 
 p = multiply(array(p), Nx/100.0)
- ind = p.astype(Int)
+ ind = p.astype(int)
 ind = where(ind>=Nx, Nx-1, ind)
 return take(x, ind)
 
@@ -846,7 +846,7 @@
 # todo: implement this w/o loop. Allow optional arg to specify
 # dimension to remove the mean from
 if dim==1: M = transpose(M)
- M = array(M, Float)
+ M = array(M, float)
 if len(M.shape)==1 or M.shape[0]==1 or M.shape[1]==1:
 M = M-mean(M)
 sigma = std(M)
@@ -938,9 +938,9 @@
 
 try: Ny = len(y0)
 except TypeError:
- yout = zeros( (len(t),), Float)
+ yout = zeros( (len(t),), float)
 else:
- yout = zeros( (len(t), Ny), Float)
+ yout = zeros( (len(t), Ny), float)
 
 
 yout[0] = y0
@@ -997,7 +997,7 @@
 
 
 # for real x, ignore the negative frequencies
- if typecode(x)==Complex: numFreqs=NFFT
+ if npy.iscomplexobj(x): numFreqs=NFFT
 else: numFreqs = NFFT//2+1
 
 if iterable(window):
@@ -1008,7 +1008,7 @@
 step = NFFT-noverlap
 ind = arange(0,len(x)-NFFT+1,step)
 n = len(ind)
- Pxx = zeros((numFreqs,n), Float)
+ Pxx = zeros((numFreqs,n), float)
 # do the ffts of the slices
 
 for i in range(n):
@@ -1021,7 +1021,7 @@
 t = 1/Fs*(ind+NFFT/2)
 freqs = Fs/NFFT*arange(numFreqs)
 
- if typecode(x) == Complex:
+ if npy.iscomplexobj(x):
 freqs = concatenate((freqs[NFFT/2:]-Fs,freqs[:NFFT/2]))
 Pxx = concatenate((Pxx[NFFT/2:,:],Pxx[:NFFT/2,:]),0)
 
@@ -1092,9 +1092,9 @@
 This algorithm from
 http://softsurfer.com/Archive/algorithm_0102/algorithm_0102.htm#Distance%20to%20Ray%20or%20Segment
 """
- p = asarray(p, Float)
- s0 = asarray(s0, Float)
- s1 = asarray(s1, Float)
+ p = asarray(p, float)
+ s0 = asarray(s0, float)
+ s1 = asarray(s1, float)
 v = s1 - s0
 w = p - s0
 
@@ -1178,10 +1178,10 @@
 """
 def __init__(self, nmax):
 'buffer up to nmax points'
- self._xa = nx.zeros((nmax,), typecode=nx.Float)
- self._ya = nx.zeros((nmax,), typecode=nx.Float)
- self._xs = nx.zeros((nmax,), typecode=nx.Float)
- self._ys = nx.zeros((nmax,), typecode=nx.Float)
+ self._xa = nx.zeros((nmax,), typecode=float)
+ self._ya = nx.zeros((nmax,), typecode=float)
+ self._xs = nx.zeros((nmax,), typecode=float)
+ self._ys = nx.zeros((nmax,), typecode=float)
 self._ind = 0
 self._nmax = nmax
 self.dataLim = None
@@ -1242,7 +1242,7 @@
 n = int(n)
 N = len(x)
 assert(N>n)
- y = zeros(N-(n-1),Float)
+ y = zeros(N-(n-1),float)
 for i in range(n):
 y += x[i:N-(n-1)+i]
 y /= float(n)
@@ -1363,7 +1363,7 @@
 thisLen = len(row)
 X.append(row)
 
- X = array(X, nx.Float)
+ X = array(X, float)
 r,c = X.shape
 if r==1 or c==1:
 X.shape = max([r,c]),
@@ -1397,15 +1397,15 @@
 converterd, if not None, is a dictionary mapping column number or
 munged column name to a converter function
 
- 
+
 See examples/loadrec.py
 """
 
 
- 
+
 if converterd is None:
 converterd = dict()
- 
+
 import dateutil.parser
 parsedate = dateutil.parser.parse
 
@@ -1423,8 +1423,8 @@
 process_skiprows(reader)
 
 
- 
 
+
 def get_func(item, func):
 # promote functions in this order
 funcmap = {int:float, float:dateutil.parser.parse, dateutil.parser.parse:str}
@@ -1434,7 +1434,7 @@
 raise ValueError('Could not find a working conversion function')
 else: return get_func(item, funcmap[func]) # recurse
 else: return func
- 
+
 def get_converters(reader):
 
 converters = None
@@ -1534,10 +1534,10 @@
 Icelandic Meteorological Office, March 2006 halldor at vedur.is)
 """
 # Cast key variables as float.
- x=nx.asarray(x, nx.Float)
- y=nx.asarray(y, nx.Float)
+ x=nx.asarray(x, float)
+ y=nx.asarray(y, float)
 
- yp=nx.zeros(y.shape, nx.Float)
+ yp=nx.zeros(y.shape, float)
 
 dx=x[1:] - x[:-1]
 dy=y[1:] - y[:-1]
@@ -1592,18 +1592,18 @@
 """
 
 # Cast key variables as float.
- x=nx.asarray(x, nx.Float)
- y=nx.asarray(y, nx.Float)
+ x=nx.asarray(x, float)
+ y=nx.asarray(y, float)
 assert x.shape == y.shape
 N=len(y)
 
 if yp is None:
 yp = slopes(x,y)
 else:
- yp=nx.asarray(yp, nx.Float)
+ yp=nx.asarray(yp, float)
 
- xi=nx.asarray(xi, nx.Float)
- yi=nx.zeros(xi.shape, nx.Float)
+ xi=nx.asarray(xi, float)
+ yi=nx.zeros(xi.shape, float)
 
 # calculate linear slopes
 dx = x[1:] - x[:-1]
@@ -1633,7 +1633,7 @@
 # does more calculations than necessary but exploiting the power
 # of numpy, this is far more efficient than coding a loop by hand
 # in Python
- yi = yo + dy1dy2 * nx.choose(nx.array(nx.sign(dy1dy2), nx.Int32)+1,
+ yi = yo + dy1dy2 * nx.choose(nx.array(nx.sign(dy1dy2), nx.int32)+1,
 ((2*xi-xidx-xidxp1)/((dy1-dy2)*(xidxp1-xidx)),
 0.0,
 1/(dy1+dy2),))
@@ -1662,11 +1662,11 @@
 d = nx.where(nx.less(d, 0), twopi + d, d)
 return nx.where(nx.greater(d,nx.pi), d-twopi, d)
 
- angles = nx.zeros((Nxy,), nx.Float)
- x1 = nx.zeros((Nxy,), nx.Float)
- y1 = nx.zeros((Nxy,), nx.Float)
- x2 = nx.zeros((Nxy,), nx.Float)
- y2 = nx.zeros((Nxy,), nx.Float)
+ angles = nx.zeros((Nxy,), float)
+ x1 = nx.zeros((Nxy,), float)
+ y1 = nx.zeros((Nxy,), float)
+ x2 = nx.zeros((Nxy,), float)
+ y2 = nx.zeros((Nxy,), float)
 x = xys[:,0]
 y = xys[:,1]
 for i in range(Nv):
@@ -1726,7 +1726,7 @@
 Nx = len(x)
 if not iterable(ylower):
 ylower = ylower*npy.ones(Nx)
- 
+
 if not iterable(yupper):
 yupper = yupper*npy.ones(Nx)
 
@@ -1796,7 +1796,7 @@
 floating point exception handling with access to the underlying
 hardware."""
 
- if type(x) is ArrayType:
+ if type(x) is ndarray:
 return exp(clip(x,exp_safe_MIN,exp_safe_MAX))
 else:
 return math.exp(x)
Modified: trunk/matplotlib/lib/matplotlib/numerix/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/__init__.py	2007年07月19日 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/numerix/__init__.py	2007年07月19日 16:53:36 UTC (rev 3575)
@@ -22,16 +22,18 @@
 
 #########################
 
+# the following is exclusively used and/or reexported by pylab.py and mlab.py:
+
 asum = sum
 matrixmultiply = dot
 
-#from numpy.oldnumeric import *
 from numpy.oldnumeric import \
- ArrayType, cross_correlate, NewAxis, \
- arrayrange, innerproduct, outerproduct
+ ArrayType, \
+ cross_correlate, \
+ arrayrange, \
+ innerproduct, \
+ outerproduct
 
-newaxis = NewAxis
-
 from numpy.oldnumeric import Int8, UInt8, \
 Int16, UInt16, \
 Int32, UInt32, \
@@ -48,7 +50,3 @@
 return a.dtype.char
 def iscontiguous(a):
 return a.flags.contiguous
-def byteswapped(a):
- return a.byteswap()
-def itemsize(a):
- return a.itemsize
Modified: trunk/matplotlib/lib/matplotlib/patches.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/patches.py	2007年07月19日 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/patches.py	2007年07月19日 16:53:36 UTC (rev 3575)
@@ -46,7 +46,7 @@
 zorder = 1
 def __str__(self):
 return str(self.__class__).split('.')[-1]
- 
+
 def __init__(self,
 edgecolor=None,
 facecolor=None,
@@ -78,12 +78,12 @@
 __init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
 
 def contains(self, mouseevent):
- """Test whether the mouse event occurred in the patch. 
- 
+ """Test whether the mouse event occurred in the patch.
+
 Returns T/F, {}
 """
 if callable(self._contains): return self._contains(self,mouseevent)
- 
+
 try:
 # TODO: make this consistent with patch collection algorithm
 x, y = self.get_transform().inverse_xy_tup((mouseevent.x, mouseevent.y))
@@ -268,7 +268,7 @@
 class Shadow(Patch):
 def __str__(self):
 return "Shadow(%s)"%(str(self.patch))
- 
+
 def __init__(self, patch, ox, oy, props=None, **kwargs):
 """
 Create a shadow of the patch offset by ox, oy. props, if not None is
@@ -321,7 +321,7 @@
 def __str__(self):
 return str(self.__class__).split('.')[-1] \
 + "(%g,%g;%gx%g)"%(self.xy[0],self.xy[1],self.width,self.height)
- 
+
 def __init__(self, xy, width, height,
 **kwargs):
 """
@@ -424,7 +424,7 @@
 """
 def __str__(self):
 return "Poly%d(%g,%g)"%(self.numVertices,self.xy[0],self.xy[1])
- 
+
 def __init__(self, xy, numVertices, radius=5, orientation=0,
 **kwargs):
 """
@@ -470,7 +470,7 @@
 """
 def __str__(self):
 return "Poly(%g,%g)"%self.xy[0]
- 
+
 def __init__(self, xy, **kwargs):
 """
 xy is a sequence of (x,y) 2 tuples
@@ -529,7 +529,7 @@
 x2,y2 = self.xy[1]
 cx,cy = (x1+x2)/2.,(y1+y2)/2.
 return "Arrow(%g,%g)"%(cx,cy)
- 
+
 def __init__( self, x, y, dx, dy, width=1.0, **kwargs ):
 """Draws an arrow, starting at (x,y), direction and length
 given by (dx,dy) the width of the arrow is scaled by width
@@ -548,7 +548,7 @@
 cx = float(dx)/L
 sx = float(dy)/L
 M = npy.array( [ [ cx, sx],[ -sx, cx ] ] )
- verts = npy.matrixmultiply( arrow, M )+ [x,y]
+ verts = npy.dot( arrow, M )+ [x,y]
 Polygon.__init__( self, [ tuple(t) for t in verts ], **kwargs )
 __init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
 
@@ -560,7 +560,7 @@
 x2,y2 = self.xy[1]
 cx,cy = (x1+x2)/2.,(y1+y2)/2.
 return "FancyArrow(%g,%g)"%(cx,cy)
- 
+
 def __init__(self, x, y, dx, dy, width=0.001, length_includes_head=False, \
 head_width=None, head_length=None, shape='full', overhang=0, \
 head_starts_at_zero=False,**kwargs):
@@ -622,7 +622,7 @@
 cx = float(dx)/distance
 sx = float(dy)/distance
 M = npy.array([[cx, sx],[-sx,cx]])
- verts = npy.matrixmultiply(coords, M) + (x+dx, y+dy)
+ verts = npy.dot(coords, M) + (x+dx, y+dy)
 
 Polygon.__init__(self, map(tuple, verts), **kwargs)
 __init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
@@ -639,7 +639,7 @@
 x2,y2 = self.xy[1]
 cx,cy = (x1+x2)/2.,(y1+y2)/2.
 return "YAArrow(%g,%g)"%(cx,cy)
- 
+
 def __init__(self, dpi, xytip, xybase, width=4, frac=0.1, headwidth=12, **kwargs):
 """
 xytip : (x,y) location of arrow tip
@@ -768,7 +768,7 @@
 self.center = xy
 self.width, self.height = width, height
 self.angle = angle
- 
+
 def contains(self,ev):
 if ev.xdata is None or ev.ydata is None: return False,{}
 inside = inellipse(ev.xdata,ev.ydata,
Modified: trunk/matplotlib/lib/matplotlib/proj3d.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/proj3d.py	2007年07月19日 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/proj3d.py	2007年07月19日 16:53:36 UTC (rev 3575)
@@ -146,7 +146,7 @@
 [0, 0, 0, 1]]
 ## end old
 
- return nx.matrixmultiply(Mr,Mt)
+ return nx.dot(Mr,Mt)
 
 def persp_transformation(zfront,zback):
 a = (zfront+zback)/(zfront-zback)
@@ -158,14 +158,14 @@
 ])
 
 def proj_transform_vec(vec, M):
- vecw = nx.matrixmultiply(M,vec)
+ vecw = nx.dot(M,vec)
 w = vecw[3]
 # clip here..
 txs,tys,tzs = vecw[0]/w,vecw[1]/w,vecw[2]/w
 return txs,tys,tzs
 
 def proj_transform_vec_clip(vec, M):
- vecw = nx.matrixmultiply(M,vec)
+ vecw = nx.dot(M,vec)
 w = vecw[3]
 # clip here..
 txs,tys,tzs = vecw[0]/w,vecw[1]/w,vecw[2]/w
@@ -177,7 +177,7 @@
 def inv_transform(xs,ys,zs,M):
 iM = linear_algebra.inverse(M)
 vec = vec_pad_ones(xs,ys,zs)
- vecr = nx.matrixmultiply(iM,vec)
+ vecr = nx.dot(iM,vec)
 try:
 vecr = vecr/vecr[3]
 except OverflowError:
@@ -242,7 +242,7 @@
 V = nx.array([0,0,1])
 viewM = view_transformation(E,R,V)
 perspM = persp_transformation(100,-100)
- M = nx.matrixmultiply(perspM,viewM)
+ M = nx.dot(perspM,viewM)
 return M
 
 def test_proj():
@@ -274,7 +274,7 @@
 [0,sina,cosa,0],
 [0,0,0,0]])
 #
- return nx.matrixmultiply(M1,V)
+ return nx.dot(M1,V)
 
 def test_rot():
 V = [1,0,0,1]
Modified: trunk/matplotlib/lib/matplotlib/table.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/table.py	2007年07月19日 15:26:27 UTC (rev 3574)
+++ trunk/matplotlib/lib/matplotlib/table.py	2007年07月19日 16:53:36 UTC (rev 3575)
@@ -22,7 +22,7 @@
 from __future__ import division
 import sys, warnings
 from matplotlib import verbose
-from numerix import ones, Float, add, asarray
+from numpy import ones, add, asarray
 
 import artist
 from artist import Artist
@@ -248,10 +248,10 @@
 
 bbox = bbox_all(boxes)
 return inverse_transform_bbox(self.get_transform(), bbox)
- 
+
 def contains(self,mouseevent):
- """Test whether the mouse event occurred in the table. 
- 
+ """Test whether the mouse event occurred in the table.
+
 Returns T/F, {}
 """
 if callable(self._contains): return self._contains(self,mouseevent)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <nn...@us...> - 2007年07月19日 17:23:44
Revision: 3577
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3577&view=rev
Author: nnemec
Date: 2007年07月19日 10:23:41 -0700 (2007年7月19日)
Log Message:
-----------
completed numpification of most trivial cases
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/lib/matplotlib/art3d.py
 trunk/matplotlib/lib/matplotlib/axes3d.py
 trunk/matplotlib/lib/matplotlib/axis.py
 trunk/matplotlib/lib/matplotlib/axis3d.py
 trunk/matplotlib/lib/matplotlib/backend_bases.py
 trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
 trunk/matplotlib/lib/matplotlib/backends/backend_fltkagg.py
 trunk/matplotlib/lib/matplotlib/backends/backend_gd.py
 trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py
 trunk/matplotlib/lib/matplotlib/backends/backend_paint.py
 trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
 trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py
 trunk/matplotlib/lib/matplotlib/collections.py
 trunk/matplotlib/lib/matplotlib/figure.py
 trunk/matplotlib/lib/matplotlib/finance.py
 trunk/matplotlib/lib/matplotlib/image.py
 trunk/matplotlib/lib/matplotlib/legend.py
 trunk/matplotlib/lib/matplotlib/lines.py
 trunk/matplotlib/lib/matplotlib/mathtext.py
 trunk/matplotlib/lib/matplotlib/mlab.py
 trunk/matplotlib/lib/matplotlib/proj3d.py
 trunk/matplotlib/lib/matplotlib/texmanager.py
 trunk/matplotlib/lib/matplotlib/text.py
 trunk/matplotlib/lib/matplotlib/units.py
 trunk/matplotlib/lib/matplotlib/widgets.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2007年07月19日 17:04:19 UTC (rev 3576)
+++ trunk/matplotlib/CHANGELOG	2007年07月19日 17:23:41 UTC (rev 3577)
@@ -1,5 +1,7 @@
-2007年07月19日 converted non-numpy relicts troughout the code
+2007年07月19日 completed numpification of most trivial cases - NN
 
+2007年07月19日 converted non-numpy relicts troughout the code - NN
+
 2007年07月19日 replaced the Python code in numerix/ by a minimal wrapper around
 numpy that explicitly mentions all symbols that need to be
 	 addressed for further numpification - NN
Modified: trunk/matplotlib/lib/matplotlib/art3d.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/art3d.py	2007年07月19日 17:04:19 UTC (rev 3576)
+++ trunk/matplotlib/lib/matplotlib/art3d.py	2007年07月19日 17:23:41 UTC (rev 3577)
@@ -12,7 +12,7 @@
 from colors import Normalize
 from cm import jet
 
-import numerix as nx
+import numpy as npy
 import proj3d
 
 class Wrap2D:
@@ -254,8 +254,8 @@
 segis.append((si,ei))
 si = ei
 xs,ys,zs = zip(*points)
- ones = nx.ones(len(xs))
- self.vec = nx.array([xs,ys,zs,ones])
+ ones = npy.ones(len(xs))
+ self.vec = npy.array([xs,ys,zs,ones])
 self.segis = segis
 
 def draw3d(self, renderer):
Modified: trunk/matplotlib/lib/matplotlib/axes3d.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes3d.py	2007年07月19日 17:04:19 UTC (rev 3576)
+++ trunk/matplotlib/lib/matplotlib/axes3d.py	2007年07月19日 17:23:41 UTC (rev 3577)
@@ -17,7 +17,7 @@
 from transforms import unit_bbox
 
 import figure
-import numerix as nx
+import numpy as npy
 from colors import Normalize
 
 import art3d
@@ -122,8 +122,8 @@
 self.zz_dataLim.intervalx, self)
 
 def unit_cube(self,vals=None):
- minx,maxx,miny,maxy,minz,maxz = vals or self.get_w_lims()
- xs,ys,zs = ([minx,maxx,maxx,minx,minx,maxx,maxx,minx],
+ minpy,maxx,miny,maxy,minz,maxz = vals or self.get_w_lims()
+ xs,ys,zs = ([minpy,maxx,maxx,minpy,minpy,maxx,maxx,minpy],
 [miny,miny,maxy,maxy,miny,miny,maxy,maxy],
 [minz,minz,minz,minz,maxz,maxz,maxz,maxz])
 return zip(xs,ys,zs)
@@ -186,7 +186,7 @@
 pass
 
 def auto_scale_xyz(self, X,Y,Z=None,had_data=None):
- x,y,z = map(nx.asarray, (X,Y,Z))
+ x,y,z = map(npy.asarray, (X,Y,Z))
 try:
 x,y = X.flat,Y.flat
 if Z is not None:
@@ -216,10 +216,10 @@
 self.set_w_zlim(locator.autoscale())
 
 def get_w_lims(self):
- minx,maxx = self.get_w_xlim()
+ minpy,maxx = self.get_w_xlim()
 miny,maxy = self.get_w_ylim()
 minz,maxz = self.get_w_zlim()
- return minx,maxx,miny,maxy,minz,maxz
+ return minpy,maxx,miny,maxy,minz,maxz
 
 def set_w_zlim(self, *args, **kwargs):
 gl,self.get_xlim = self.get_xlim,self.get_w_zlim
@@ -257,7 +257,7 @@
 def pany(self, numsteps):
 print 'numsteps', numsteps
 
- def panx(self, numsteps):
+ def panpy(self, numsteps):
 print 'numsteps', numsteps
 
 def view_init(self, elev, azim):
@@ -276,7 +276,7 @@
 point.
 
 """
- relev,razim = nx.pi * self.elev/180, nx.pi * self.azim/180
+ relev,razim = npy.pi * self.elev/180, npy.pi * self.azim/180
 
 xmin,xmax = self.get_w_xlim()
 ymin,ymax = self.get_w_ylim()
@@ -288,29 +288,29 @@
 zmin,zmax)
 
 # look into the middle of the new coordinates
- R = nx.array([0.5,0.5,0.5])
+ R = npy.array([0.5,0.5,0.5])
 #
- xp = R[0] + nx.cos(razim)*nx.cos(relev)*self.dist
- yp = R[1] + nx.sin(razim)*nx.cos(relev)*self.dist
- zp = R[2] + nx.sin(relev)*self.dist
+ xp = R[0] + npy.cos(razim)*npy.cos(relev)*self.dist
+ yp = R[1] + npy.sin(razim)*npy.cos(relev)*self.dist
+ zp = R[2] + npy.sin(relev)*self.dist
 
- E = nx.array((xp, yp, zp))
+ E = npy.array((xp, yp, zp))
 #
 self.eye = E
 self.vvec = R - E
 self.vvec = self.vvec / proj3d.mod(self.vvec)
 
- if abs(relev) > nx.pi/2:
+ if abs(relev) > npy.pi/2:
 # upside down
- V = nx.array((0,0,-1))
+ V = npy.array((0,0,-1))
 else:
- V = nx.array((0,0,1))
+ V = npy.array((0,0,1))
 zfront,zback = -self.dist,self.dist
 
 viewM = proj3d.view_transformation(E,R,V)
 perspM = proj3d.persp_transformation(zfront,zback)
- M0 = nx.dot(viewM,worldM)
- M = nx.dot(perspM,M0)
+ M0 = npy.dot(viewM,worldM)
+ M = npy.dot(perspM,M0)
 return M
 
 def mouse_init(self):
@@ -383,8 +383,8 @@
 # scale the z value to match
 x0,y0,z0 = p0
 x1,y1,z1 = p1
- d0 = nx.hypot(x0-xd,y0-yd)
- d1 = nx.hypot(x1-xd,y1-yd)
+ d0 = npy.hypot(x0-xd,y0-yd)
+ d1 = npy.hypot(x1-xd,y1-yd)
 dt = d0+d1
 z = d1/dt * z0 + d0/dt * z1
 #print 'mid', edgei, d0, d1, z0, z1, z
@@ -435,12 +435,12 @@
 elif self.button_pressed == 3:
 # zoom view
 # hmmm..this needs some help from clipping....
- minx,maxx,miny,maxy,minz,maxz = self.get_w_lims()
+ minpy,maxx,miny,maxy,minz,maxz = self.get_w_lims()
 df = 1-((h - dy)/h)
- dx = (maxx-minx)*df
+ dx = (maxx-minpy)*df
 dy = (maxy-miny)*df
 dz = (maxz-minz)*df
- self.set_w_xlim(minx-dx,maxx+dx)
+ self.set_w_xlim(minpy-dx,maxx+dx)
 self.set_w_ylim(miny-dy,maxy+dy)
 self.set_w_zlim(minz-dz,maxz+dz)
 self.get_proj()
@@ -504,14 +504,14 @@
 had_data = self.has_data()
 
 rows, cols = Z.shape
- tX,tY,tZ = nx.transpose(X), nx.transpose(Y), nx.transpose(Z)
+ tX,tY,tZ = npy.transpose(X), npy.transpose(Y), npy.transpose(Z)
 rstride = cbook.popd(kwargs, 'rstride', 10)
 cstride = cbook.popd(kwargs, 'cstride', 10)
 #
 polys = []
 boxes = []
- for rs in nx.arange(0,rows,rstride):
- for cs in nx.arange(0,cols,cstride):
+ for rs in npy.arange(0,rows,rstride):
+ for cs in npy.arange(0,cols,cstride):
 ps = []
 corners = []
 for a,ta in [(X,tX),(Y,tY),(Z,tZ)]:
@@ -522,9 +522,9 @@
 zright = ta[cs][rs:min(rows-1,rs+rstride):]
 zright = zright[::-1]
 corners.append([ztop[0],ztop[-1],zbase[0],zbase[-1]])
- z = nx.concatenate((ztop,zleft,zbase,zright))
+ z = npy.concatenate((ztop,zleft,zbase,zright))
 ps.append(z)
- boxes.append(map(nx.array,zip(*corners)))
+ boxes.append(map(npy.array,zip(*corners)))
 polys.append(zip(*ps))
 #
 lines = []
@@ -533,10 +533,10 @@
 n = proj3d.cross(box[0]-box[1],
 box[0]-box[2])
 n = n/proj3d.mod(n)*5
- shade.append(nx.dot(n,[-1,-1,0.5]))
+ shade.append(npy.dot(n,[-1,-1,0.5]))
 lines.append((box[0],n+box[0]))
 #
- color = nx.array([0,0,1,1])
+ color = npy.array([0,0,1,1])
 norm = Normalize(min(shade),max(shade))
 colors = [color * (0.5+norm(v)*0.5) for v in shade]
 for c in colors: c[3] = 1
@@ -554,7 +554,7 @@
 had_data = self.has_data()
 rows,cols = Z.shape
 
- tX,tY,tZ = nx.transpose(X), nx.transpose(Y), nx.transpose(Z)
+ tX,tY,tZ = npy.transpose(X), npy.transpose(Y), npy.transpose(Z)
 
 rii = [i for i in range(0,rows,rstride)]+[rows-1]
 cii = [i for i in range(0,cols,cstride)]+[cols-1]
@@ -718,7 +718,7 @@
 
 def get_test_data(delta=0.05):
 from mlab import meshgrid, bivariate_normal
- x = y = nx.arange(-3.0, 3.0, delta)
+ x = y = npy.arange(-3.0, 3.0, delta)
 X, Y = meshgrid(x,y)
 
 Z1 = bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
@@ -764,8 +764,8 @@
 
 def test_plot():
 ax = Axes3D()
- xs = nx.arange(0,4*nx.pi+0.1,0.1)
- ys = nx.sin(xs)
+ xs = npy.arange(0,4*npy.pi+0.1,0.1)
+ ys = npy.sin(xs)
 ax.plot(xs,ys, label='zl')
 ax.plot(xs,ys+max(xs),label='zh')
 ax.plot(xs,ys,dir='x', label='xl')
@@ -785,7 +785,7 @@
 cc = lambda arg: colorConverter.to_rgba(arg, alpha=0.6)
 
 ax = Axes3D()
- xs = nx.arange(0,10,0.4)
+ xs = npy.arange(0,10,0.4)
 verts = []
 zs = [0.0,1.0,2.0,3.0]
 for z in zs:
@@ -817,7 +817,7 @@
 ax = Axes3D()
 
 for c,z in zip(['r','g','b','y'],[30,20,10,0]):
- xs = nx.arange(20)
+ xs = npy.arange(20)
 ys = [random.random() for x in xs]
 ax.bar(xs,ys,z=z,dir='y',color=c)
 #ax.plot(xs,ys)
Modified: trunk/matplotlib/lib/matplotlib/axis.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axis.py	2007年07月19日 17:04:19 UTC (rev 3576)
+++ trunk/matplotlib/lib/matplotlib/axis.py	2007年07月19日 17:23:41 UTC (rev 3577)
@@ -7,14 +7,13 @@
 import re
 import sys
 
-from numerix import arange, array, asarray, ones, zeros, \
+from numpy import arange, array, asarray, ones, zeros, \
 nonzero, take, log10, logical_and, \
- dot, sin, cos, tan, pi, sqrt
+ dot, sin, cos, tan, pi, sqrt, linspace
 
 from artist import Artist, setp
 from cbook import enumerate, silent_list, popall, CallbackRegistry
 from lines import Line2D, TICKLEFT, TICKRIGHT, TICKUP, TICKDOWN
-from mlab import linspace
 from matplotlib import rcParams
 from patches import bbox_artist
 from ticker import NullFormatter, FixedFormatter, ScalarFormatter, LogFormatter
Modified: trunk/matplotlib/lib/matplotlib/axis3d.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axis3d.py	2007年07月19日 17:04:19 UTC (rev 3576)
+++ trunk/matplotlib/lib/matplotlib/axis3d.py	2007年07月19日 17:23:41 UTC (rev 3577)
@@ -13,7 +13,7 @@
 import art3d
 import proj3d
 
-from numerix import sin, cos, pi, cumsum, dot, asarray, array, \
+from numpy import sin, cos, pi, cumsum, dot, asarray, array, \
 where, nonzero, equal, sqrt
 
 def norm_angle(a):
Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backend_bases.py	2007年07月19日 17:04:19 UTC (rev 3576)
+++ trunk/matplotlib/lib/matplotlib/backend_bases.py	2007年07月19日 17:23:41 UTC (rev 3577)
@@ -437,7 +437,7 @@
 def points_to_pixels(self, points):
 """
 Convert points to display units
- points - a float or a numerix array of float
+ points - a float or a numpy array of float
 return points converted to pixels
 
 You need to override this function (unless your backend doesn't have a
@@ -891,24 +891,24 @@
 #print "leaving:",[str(a) for a in leave]
 # On leave restore the captured colour
 for a in leave:
- if hasattr(a,'get_color'): 
+ if hasattr(a,'get_color'):
 a.set_color(self._active[a])
- elif hasattr(a,'get_edgecolor'): 
+ elif hasattr(a,'get_edgecolor'):
 a.set_edgecolor(self._active[a][0])
 a.set_facecolor(self._active[a][1])
 del self._active[a]
 # On enter, capture the color and repaint the artist
- # with the highlight colour. Capturing colour has to 
- # be done first in case the parent recolouring affects 
+ # with the highlight colour. Capturing colour has to
+ # be done first in case the parent recolouring affects
 # the child.
 for a in enter:
- if hasattr(a,'get_color'): 
+ if hasattr(a,'get_color'):
 self._active[a] = a.get_color()
 elif hasattr(a,'get_edgecolor'):
 self._active[a] = (a.get_edgecolor(),a.get_facecolor())
 else: self._active[a] = None
 for a in enter:
- if hasattr(a,'get_color'): 
+ if hasattr(a,'get_color'):
 a.set_color('red')
 elif hasattr(a,'get_edgecolor'):
 a.set_edgecolor('red')
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py	2007年07月19日 17:04:19 UTC (rev 3576)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py	2007年07月19日 17:23:41 UTC (rev 3577)
@@ -73,7 +73,7 @@
 import os, sys
 import matplotlib
 from matplotlib import verbose, rcParams
-from numpy import array, zeros, transpose
+from numpy import array, zeros, transpose, fliplr
 from matplotlib._image import fromarray
 from matplotlib._pylab_helpers import Gcf
 from matplotlib.backend_bases import RendererBase,\
@@ -85,7 +85,6 @@
 from matplotlib.ft2font import FT2Font
 from matplotlib.mathtext import math_parse_s_ft2font
 from matplotlib.transforms import lbwh_to_bbox
-from matplotlib.numerix.mlab import fliplr
 
 from _backend_agg import RendererAgg as _RendererAgg
 
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_fltkagg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_fltkagg.py	2007年07月19日 17:04:19 UTC (rev 3576)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_fltkagg.py	2007年07月19日 17:23:41 UTC (rev 3577)
@@ -17,6 +17,8 @@
 
 import os.path
 
+from numpy import asarray
+
 import matplotlib
 
 from matplotlib import rcParams, verbose
@@ -26,7 +28,6 @@
 NavigationToolbar2, cursors
 from matplotlib.figure import Figure
 from matplotlib._pylab_helpers import Gcf
-from matplotlib.numerix import asarray
 import matplotlib.windowing as windowing
 from matplotlib.widgets import SubplotTool
 
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gd.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_gd.py	2007年07月19日 17:04:19 UTC (rev 3576)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_gd.py	2007年07月19日 17:23:41 UTC (rev 3577)
@@ -12,6 +12,7 @@
 sys.exit()
 
 
+from numpy import ones, array, int16, asarray
 
 from matplotlib.backend_bases import RendererBase, \
 GraphicsContextBase, FigureManagerBase, FigureCanvasBase
@@ -22,7 +23,6 @@
 from matplotlib.figure import Figure
 from matplotlib.transforms import Bbox
 from matplotlib.font_manager import fontManager
-from matplotlib.numerix import ones, array, nx, asarray
 # support old font names
 if (os.environ.has_key('GDFONTPATH') and not
 os.environ.has_key('TTFPATH')):
@@ -115,8 +115,8 @@
 point in x, y
 """
 
- x = x.astype(nx.int16)
- y = self.height*ones(y.shape, nx.int16) - y.astype(nx.int16)
+ x = x.astype(int16)
+ y = self.height*ones(y.shape, int16) - y.astype(int16)
 style = self._set_gd_style(gc)
 self.im.lines( zip(x,y), style)
 self.flush_clip()
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py	2007年07月19日 17:04:19 UTC (rev 3576)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py	2007年07月19日 17:23:41 UTC (rev 3577)
@@ -16,6 +16,9 @@
 % (gtk.pygtk_version + pygtk_version_required))
 del pygtk_version_required
 
+from numpy import amax, asarray, fromstring, int16, uint8, zeros, \
+ where, transpose, nonzero, indices, ones
+
 import matplotlib
 from matplotlib._pylab_helpers import Gcf
 from matplotlib.backend_bases import RendererBase, GraphicsContextBase, \
@@ -23,11 +26,7 @@
 from matplotlib.cbook import is_string_like, enumerate
 from matplotlib.figure import Figure
 from matplotlib.mathtext import math_parse_s_ft2font
-import matplotlib.numerix as numerix
-from matplotlib.numerix import asarray, fromstring, uint8, zeros, \
- where, transpose, nonzero, indices, ones, nx
 
-
 from matplotlib.backends._backend_gdk import pixbuf_get_pixels_array
 
 
@@ -144,8 +143,8 @@
 
 def draw_lines(self, gc, x, y, transform=None):
 if gc.gdkGC.line_width > 0:
- x = x.astype(nx.int16)
- y = self.height - y.astype(nx.int16)
+ x = x.astype(int16)
+ y = self.height - y.astype(int16)
 self.gdkDrawable.draw_lines(gc.gdkGC, zip(x,y))
 
 
@@ -222,7 +221,7 @@
 Xall[:,i] = fromstring(image_str, uint8)
 
 # get the max alpha at each pixel
- Xs = numerix.mlab.max(Xall,1)
+ Xs = amax(Xall,axis=1)
 
 # convert it to it's proper shape
 Xs.shape = imh, imw
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_paint.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_paint.py	2007年07月19日 17:04:19 UTC (rev 3576)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_paint.py	2007年07月19日 17:23:41 UTC (rev 3577)
@@ -16,8 +16,10 @@
 import sys
 import os
 import paint
+
+from numpy import asarray
+
 from matplotlib import verbose
-from matplotlib.numerix import asarray
 
 from matplotlib._pylab_helpers import Gcf
 from matplotlib.backend_bases import RendererBase,\
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py	2007年07月19日 17:04:19 UTC (rev 3576)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py	2007年07月19日 17:23:41 UTC (rev 3577)
@@ -26,7 +26,7 @@
 
 from matplotlib.transforms import get_vec6_scales
 
-from matplotlib.numerix import uint8, float32, alltrue, array, ceil, equal, \
+from numpy import uint8, float32, alltrue, array, ceil, equal, \
 fromstring, nonzero, ones, put, take, where, isnan
 import binascii
 import re
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py	2007年07月19日 17:04:19 UTC (rev 3576)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py	2007年07月19日 17:23:41 UTC (rev 3577)
@@ -10,6 +10,8 @@
 
 import os.path
 
+from numpy import asarray
+
 import matplotlib
 from matplotlib.cbook import is_string_like, enumerate
 from matplotlib.backend_bases import RendererBase, GraphicsContextBase, \
@@ -17,7 +19,6 @@
 
 from matplotlib.figure import Figure
 from matplotlib._pylab_helpers import Gcf
-from matplotlib.numerix import asarray
 
 import matplotlib.windowing as windowing
 from matplotlib.widgets import SubplotTool
Modified: trunk/matplotlib/lib/matplotlib/collections.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/collections.py	2007年07月19日 17:04:19 UTC (rev 3576)
+++ trunk/matplotlib/lib/matplotlib/collections.py	2007年07月19日 17:23:41 UTC (rev 3577)
@@ -145,14 +145,14 @@
 def contains(self, mouseevent):
 """
 Test whether the mouse event occurred in the collection.
- 
+
 Returns T/F, dict(ind=itemlist), where every item in itemlist contains the event.
 """
 if callable(self._contains): return self._contains(self,mouseevent)
 # TODO: Consider doing the test in data coordinates
 # Patch transforms the mouse into data coordinates and does the
 # test for membership there. This is more efficient though it
- # may not match the visual appearance of the polygon on the 
+ # may not match the visual appearance of the polygon on the
 # screen. Regardless, patch and patch collection should use
 # the same algorithm. Here's the code in patch:
 #
@@ -338,7 +338,7 @@
 """
 verts is a sequence of ( verts0, verts1, ...) where verts_i is
 a sequence of xy tuples of vertices, or an equivalent
- numerix array of shape (nv,2).
+ numpy array of shape (nv,2).
 
 %(PatchCollection)s
 """
@@ -461,7 +461,7 @@
 def get_transformed_patches(self):
 # Shouldn't need all these calls to asarray;
 # the variables should be converted when stored.
- # Similar speedups with numerix should be attainable
+ # Similar speedups with numpy should be attainable
 # in many other places.
 verts = npy.asarray(self._verts)
 offsets = npy.asarray(self._offsets)
@@ -588,7 +588,7 @@
 """
 segments is a sequence of ( line0, line1, line2), where
 linen = (x0, y0), (x1, y1), ... (xm, ym), or the
- equivalent numerix array with two columns.
+ equivalent numpy array with two columns.
 Each line can be a different length.
 
 colors must be a tuple of RGBA tuples (eg arbitrary color
@@ -616,7 +616,7 @@
 
 norm = None, # optional for ScalarMappable
 cmap = None, # ditto
- 
+
 pickradius is the tolerance for mouse clicks picking a line. The
 default is 5 pt.
 
@@ -659,7 +659,7 @@
 def contains(self, mouseevent):
 """
 Test whether the mouse event occurred in the collection.
- 
+
 Returns T/F, dict(ind=itemlist), where every item in itemlist contains the event.
 """
 import matplotlib.lines as ML
@@ -679,7 +679,7 @@
 this_ind = ML.segment_hits(mx,my,xy[:,0],xy[:,1],self.pickradius)
 ind.extend([(this,k) for k in this_ind])
 return len(ind)>0,dict(ind=ind)
- 
+
 def set_pickradius(self,pickradius): self.pickradius = 5
 def get_pickradius(self): return self.pickradius
 
Modified: trunk/matplotlib/lib/matplotlib/figure.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/figure.py	2007年07月19日 17:04:19 UTC (rev 3576)
+++ trunk/matplotlib/lib/matplotlib/figure.py	2007年07月19日 17:23:41 UTC (rev 3577)
@@ -16,8 +16,7 @@
 
 from legend import Legend
 from transforms import Bbox, Value, Point, get_bbox_transform, unit_bbox
-from numerix import array, clip, transpose, minimum, maximum
-from mlab import linspace, meshgrid
+from numpy import array, clip, transpose, minimum, maximum, linspace, meshgrid
 from ticker import FormatStrFormatter
 from cm import ScalarMappable
 from contour import ContourSet
Modified: trunk/matplotlib/lib/matplotlib/finance.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/finance.py	2007年07月19日 17:04:19 UTC (rev 3576)
+++ trunk/matplotlib/lib/matplotlib/finance.py	2007年07月19日 17:23:41 UTC (rev 3577)
@@ -12,6 +12,8 @@
 except ImportError:
 raise SystemExit('The finance module requires datetime support (python2.3)')
 
+import numpy as npy
+
 from matplotlib import verbose, get_configdir
 from artist import Artist
 from dates import date2num, num2date
@@ -20,7 +22,6 @@
 from matplotlib.colors import colorConverter
 from lines import Line2D, TICKLEFT, TICKRIGHT
 from patches import Rectangle
-import matplotlib.numerix as nx
 from matplotlib.transforms import scale_transform, Value, zero, one, \
 scale_sep_transform, blend_xy_sep_transform
 
@@ -76,7 +77,7 @@
 if asobject:
 if len(results)==0: return None
 else:
- date, open, close, high, low, volume = map(nx.asarray, zip(*results))
+ date, open, close, high, low, volume = map(npy.asarray, zip(*results))
 return Bunch(date=date, open=open, close=close, high=high, low=low, volume=volume)
 else:
 
@@ -377,10 +378,10 @@
 )
 closeCollection.set_transform(tickTransform)
 
- minx, maxx = (0, len(rangeSegments))
+ minpy, maxx = (0, len(rangeSegments))
 miny = min([low for low in lows if low !=-1])
 maxy = max([high for high in highs if high != -1])
- corners = (minx, miny), (maxx, maxy)
+ corners = (minpy, miny), (maxx, maxy)
 ax.update_datalim(corners)
 ax.autoscale_view()
 
@@ -466,11 +467,11 @@
 
 
 
- minx, maxx = (0, len(rangeSegments))
+ minpy, maxx = (0, len(rangeSegments))
 miny = min([low for low in lows if low !=-1])
 maxy = max([high for high in highs if high != -1])
 
- corners = (minx, miny), (maxx, maxy)
+ corners = (minpy, miny), (maxx, maxy)
 ax.update_datalim(corners)
 ax.autoscale_view()
 
@@ -533,10 +534,10 @@
 
 
 
- minx, maxx = (0, len(offsetsBars))
+ minpy, maxx = (0, len(offsetsBars))
 miny = 0
 maxy = max([v for v in volumes if v!=-1])
- corners = (minx, miny), (maxx, maxy)
+ corners = (minpy, miny), (maxx, maxy)
 ax.update_datalim(corners)
 ax.autoscale_view()
 
@@ -626,10 +627,10 @@
 
 
 
- minx, maxx = (min(dates), max(dates))
+ minpy, maxx = (min(dates), max(dates))
 miny = 0
 maxy = max([volume for d, open, close, high, low, volume in quotes])
- corners = (minx, miny), (maxx, maxy)
+ corners = (minpy, miny), (maxx, maxy)
 ax.update_datalim(corners)
 #print 'datalim', ax.dataLim.get_bounds()
 #print 'viewlim', ax.viewLim.get_bounds()
@@ -683,10 +684,10 @@
 
 
 
- minx, maxx = (0, len(offsetsBars))
+ minpy, maxx = (0, len(offsetsBars))
 miny = 0
 maxy = max([v for v in vals if v!=-1])
- corners = (minx, miny), (maxx, maxy)
+ corners = (minpy, miny), (maxx, maxy)
 ax.update_datalim(corners)
 ax.autoscale_view()
 
Modified: trunk/matplotlib/lib/matplotlib/image.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/image.py	2007年07月19日 17:04:19 UTC (rev 3576)
+++ trunk/matplotlib/lib/matplotlib/image.py	2007年07月19日 17:23:41 UTC (rev 3577)
@@ -9,9 +9,8 @@
 from artist import Artist
 from colors import colorConverter
 import cm
-import numerix
 import numerix.ma as ma
-from numerix import arange, asarray, uint8, float32, repeat, newaxis
+from numpy import arange, asarray, uint8, float32, repeat, newaxis, fromstring
 import _image
 
 
@@ -477,7 +476,7 @@
 
 def imread(fname):
 """
- return image file in fname as numerix array
+ return image file in fname as numpy array
 
 Return value is a MxNx4 array of 0-1 normalized floats
 
@@ -504,6 +503,6 @@
 raise RuntimeError('Unknown image mode')
 
 x_str = im.tostring('raw',im.mode,0,-1)
- x = numerix.fromstring(x_str,numerix.uint8)
+ x = fromstring(x_str,uint8)
 x.shape = im.size[1], im.size[0], 4
 return x
Modified: trunk/matplotlib/lib/matplotlib/legend.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/legend.py	2007年07月19日 17:04:19 UTC (rev 3576)
+++ trunk/matplotlib/lib/matplotlib/legend.py	2007年07月19日 17:23:41 UTC (rev 3577)
@@ -22,7 +22,7 @@
 """
 from __future__ import division
 import sys, warnings
-from numerix import array, ones
+from numpy import array, ones, linspace
 
 
 from matplotlib import verbose, rcParams
@@ -30,7 +30,7 @@
 from cbook import enumerate, is_string_like, iterable, silent_list
 from font_manager import FontProperties
 from lines import Line2D
-from mlab import linspace, segments_intersect
+from mlab import segments_intersect
 from patches import Patch, Rectangle, RegularPolygon, Shadow, bbox_artist, draw_bbox
 from collections import LineCollection, RegularPolyCollection, PatchCollection
 from text import Text
Modified: trunk/matplotlib/lib/matplotlib/lines.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/lines.py	2007年07月19日 17:04:19 UTC (rev 3576)
+++ trunk/matplotlib/lib/matplotlib/lines.py	2007年07月19日 17:23:41 UTC (rev 3577)
@@ -9,7 +9,7 @@
 import sys, math, warnings
 
 import agg
-from numerix import alltrue, arange, array, logical_and, \
+from numpy import alltrue, arange, array, logical_and, \
 nonzero, searchsorted, take, asarray, ones, where, less, ravel, \
 greater, cos, sin, pi, sqrt, less_equal, \
 compress, zeros, concatenate, cumsum, newaxis
Modified: trunk/matplotlib/lib/matplotlib/mathtext.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mathtext.py	2007年07月19日 17:04:19 UTC (rev 3576)
+++ trunk/matplotlib/lib/matplotlib/mathtext.py	2007年07月19日 17:23:41 UTC (rev 3577)
@@ -143,7 +143,6 @@
 from matplotlib.font_manager import fontManager, FontProperties
 from matplotlib._mathtext_data import latex_to_bakoma, cmkern, \
 latex_to_standard, tex2uni, type12uni, tex2type1, uni2type1
-from matplotlib.numerix import absolute
 from matplotlib import get_data_path, rcParams
 
 # symbols that have the sub and superscripts over/under
Modified: trunk/matplotlib/lib/matplotlib/mlab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mlab.py	2007年07月19日 17:04:19 UTC (rev 3576)
+++ trunk/matplotlib/lib/matplotlib/mlab.py	2007年07月19日 17:23:41 UTC (rev 3577)
@@ -72,7 +72,7 @@
 absolute, matrixmultiply, power, take, where, Float, Int, asum,\
 dot, convolve, pi, Complex, ones, zeros, diagonal, Matrix, nonzero, \
 log, searchsorted, concatenate, sort, ArrayType, ndarray, clip, size, indices,\
- conjugate, typecode, iscontiguous
+ conjugate, typecode, iscontiguous, linspace, meshgrid
 
 
 from numerix.mlab import hanning, cov, diff, svd, rand, std
@@ -93,11 +93,6 @@
 else: return numerix.mlab.mean(x, dim)
 
 
-def linspace(xmin, xmax, N):
- if N==1: return array([xmax])
- dx = (xmax-xmin)/(N-1)
- return xmin + dx*arange(N)
-
 def logspace(xmin,xmax,N):
 return exp(linspace(log(xmin), log(xmax),Nh))
 
@@ -863,42 +858,8 @@
 if dim==1: M=transpose(M)
 return M
 
-def meshgrid(x,y):
- """
- For vectors x, y with lengths Nx=len(x) and Ny=len(y), return X, Y
- where X and Y are (Ny, Nx) shaped arrays with the elements of x
- and y repeated to fill the matrix
 
- EG,
 
- [X, Y] = meshgrid([1,2,3], [4,5,6,7])
-
- X =
- 1 2 3
- 1 2 3
- 1 2 3
- 1 2 3
-
-
- Y =
- 4 4 4
- 5 5 5
- 6 6 6
- 7 7 7
- """
-
- x = array(x)
- y = array(y)
- numRows, numCols = len(y), len(x) # yes, reversed
- x.shape = 1, numCols
- X = repeat(x, numRows)
-
- y.shape = numRows,1
- Y = repeat(y, numCols, 1)
- return X, Y
-
-
-
 def rk4(derivs, y0, t):
 """
 Integrate 1D or ND system of ODEs from initial state y0 at sample
Modified: trunk/matplotlib/lib/matplotlib/proj3d.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/proj3d.py	2007年07月19日 17:04:19 UTC (rev 3576)
+++ trunk/matplotlib/lib/matplotlib/proj3d.py	2007年07月19日 17:23:41 UTC (rev 3577)
@@ -7,8 +7,8 @@
 
 from collections import LineCollection
 from patches import Circle
-import numerix as nx
-from numerix import linear_algebra
+import numpy as npy
+import numpy.linalg as linalg
 from math import sqrt
 
 def _hide_cross(a,b):
@@ -17,7 +17,7 @@
 A x B = <Ay*Bz - Az*By, Az*Bx - Ax*Bz, Ax*By - Ay*Bx>
 a x b = [a2b3 - a3b2, a3b1 - a1b3, a1b2 - a2b1]
 """
- return nx.array([a[1]*b[2]-a[2]*b[1],a[2]*b[0]-a[0]*b[2],a[0]*b[1] - a[1]*b[0]])
+ return npy.array([a[1]*b[2]-a[2]*b[1],a[2]*b[0]-a[0]*b[2],a[0]*b[1] - a[1]*b[0]])
 cross = _hide_cross
 
 def line2d(p0,p1):
@@ -49,7 +49,7 @@
 """
 a,b,c = l
 x0,y0 = p
- return abs((a*x0 + b*y0 + c)/nx.sqrt(a**2+b**2))
+ return abs((a*x0 + b*y0 + c)/npy.sqrt(a**2+b**2))
 
 
 def line2d_seg_dist(p1,p2, p0):
@@ -64,12 +64,12 @@
 
 x21 = p2[0] - p1[0]
 y21 = p2[1] - p1[1]
- x01 = nx.asarray(p0[0]) - p1[0]
- y01 = nx.asarray(p0[1]) - p1[1]
+ x01 = npy.asarray(p0[0]) - p1[0]
+ y01 = npy.asarray(p0[1]) - p1[1]
 
 u = (x01*x21 + y01*y21)/float(abs(x21**2 + y21**2))
- u = nx.clip(u, 0, 1)
- d = nx.sqrt((x01 - u*x21)**2 + (y01 - u*y21)**2)
+ u = npy.clip(u, 0, 1)
+ d = npy.sqrt((x01 - u*x21)**2 + (y01 - u*y21)**2)
 
 return d
 
@@ -86,7 +86,7 @@
 pylab.scatter(xs,ys)
 #
 dist = line2d_seg_dist(p0,p1,(xs[0],ys[0]))
- dist = line2d_seg_dist(p0,p1,nx.array((xs,ys)))
+ dist = line2d_seg_dist(p0,p1,npy.array((xs,ys)))
 for x,y,d in zip(xs,ys,dist):
 c = Circle((x,y),d,fill=0)
 ax.add_patch(c)
@@ -97,13 +97,13 @@
 
 def mod(v):
 """3d vector length"""
- return nx.sqrt(v[0]**2+v[1]**2+v[2]**2)
+ return npy.sqrt(v[0]**2+v[1]**2+v[2]**2)
 
 def world_transformation(xmin,xmax,
 ymin,ymax,
 zmin,zmax):
 dx,dy,dz = (xmax-xmin),(ymax-ymin),(zmax-zmin)
- return nx.array([
+ return npy.array([
 [1.0/dx,0,0,-xmin/dx],
 [0,1.0/dy,0,-ymin/dy],
 [0,0,1.0/dz,-zmin/dz],
@@ -120,11 +120,11 @@
 n = (E - R)
 ## new
 # n /= mod(n)
-# u = nx.cross(V,n)
+# u = npy.cross(V,n)
 # u /= mod(u)
-# v = nx.cross(n,u)
-# Mr = nx.diag([1.]*4)
-# Mt = nx.diag([1.]*4)
+# v = npy.cross(n,u)
+# Mr = npy.diag([1.]*4)
+# Mt = npy.diag([1.]*4)
 # Mr[:3,:3] = u,v,n
 # Mt[:3,-1] = -E
 ## end new
@@ -146,38 +146,38 @@
 [0, 0, 0, 1]]
 ## end old
 
- return nx.dot(Mr,Mt)
+ return npy.dot(Mr,Mt)
 
 def persp_transformation(zfront,zback):
 a = (zfront+zback)/(zfront-zback)
 b = -2*(zfront*zback)/(zfront-zback)
- return nx.array([[1,0,0,0],
+ return npy.array([[1,0,0,0],
 [0,1,0,0],
 [0,0,a,b],
 [0,0,-1,0]
 ])
 
 def proj_transform_vec(vec, M):
- vecw = nx.dot(M,vec)
+ vecw = npy.dot(M,vec)
 w = vecw[3]
 # clip here..
 txs,tys,tzs = vecw[0]/w,vecw[1]/w,vecw[2]/w
 return txs,tys,tzs
 
 def proj_transform_vec_clip(vec, M):
- vecw = nx.dot(M,vec)
+ vecw = npy.dot(M,vec)
 w = vecw[3]
 # clip here..
 txs,tys,tzs = vecw[0]/w,vecw[1]/w,vecw[2]/w
 tis = (vecw[0] >= 0) * (vecw[0] <= 1) * (vecw[1] >= 0) * (vecw[1] <= 1)
- if nx.sometrue( tis ):
+ if npy.sometrue( tis ):
 tis = vecw[1]<1
 return txs,tys,tzs,tis
 
 def inv_transform(xs,ys,zs,M):
- iM = linear_algebra.inverse(M)
+ iM = linalg.inv(M)
 vec = vec_pad_ones(xs,ys,zs)
- vecr = nx.dot(iM,vec)
+ vecr = npy.dot(iM,vec)
 try:
 vecr = vecr/vecr[3]
 except OverflowError:
@@ -187,11 +187,11 @@
 def vec_pad_ones(xs,ys,zs):
 try:
 try:
- vec = nx.array([xs,ys,zs,nx.ones(xs.shape)])
+ vec = npy.array([xs,ys,zs,npy.ones(xs.shape)])
 except (AttributeError,TypeError):
- vec = nx.array([xs,ys,zs,nx.ones((len(xs)))])
+ vec = npy.array([xs,ys,zs,npy.ones((len(xs)))])
 except TypeError:
- vec = nx.array([xs,ys,zs,1])
+ vec = npy.array([xs,ys,zs,1])
 return vec
 
 def proj_transform(xs,ys,zs, M):
@@ -236,13 +236,13 @@
 
 def test_proj_make_M(E=None):
 # eye point
- E = E or nx.array([1,-1,2])*1000
- #E = nx.array([20,10,20])
- R = nx.array([1,1,1])*100
- V = nx.array([0,0,1])
+ E = E or npy.array([1,-1,2])*1000
+ #E = npy.array([20,10,20])
+ R = npy.array([1,1,1])*100
+ V = npy.array([0,0,1])
 viewM = view_transformation(E,R,V)
 perspM = persp_transformation(100,-100)
- M = nx.dot(perspM,viewM)
+ M = npy.dot(perspM,viewM)
 return M
 
 def test_proj():
@@ -251,7 +251,7 @@
 ts = ['%d' % i for i in [0,1,2,3,0,4,5,6,7,4]]
 #xs,ys,zs = [0,1,1,0,0,1,1,0],[0,0,1,1,0,0,1,1],[0,0,0,0,1,1,1,1]
 xs,ys,zs = [0,1,1,0,0, 0,1,1,0,0],[0,0,1,1,0, 0,0,1,1,0],[0,0,0,0,0, 1,1,1,1,1]
- xs,ys,zs = [nx.array(v)*300 for v in (xs,ys,zs)]
+ xs,ys,zs = [npy.array(v)*300 for v in (xs,ys,zs)]
 #
 test_proj_draw_axes(M,s=400)
 txs,tys,tzs = proj_transform(xs,ys,zs,M)
@@ -268,19 +268,19 @@
 pylab.show()
 
 def rot_x(V,alpha):
- cosa,sina = nx.cos(alpha),nx.sin(alpha)
- M1 = nx.array([[1,0,0,0],
+ cosa,sina = npy.cos(alpha),npy.sin(alpha)
+ M1 = npy.array([[1,0,0,0],
 [0,cosa,-sina,0],
 [0,sina,cosa,0],
 [0,0,0,0]])
 #
- return nx.dot(M1,V)
+ return npy.dot(M1,V)
 
 def test_rot():
 V = [1,0,0,1]
- print rot_x(V, nx.pi/6)
+ print rot_x(V, npy.pi/6)
 V = [0,1,0,1]
- print rot_x(V, nx.pi/6)
+ print rot_x(V, npy.pi/6)
 
 
 if __name__ == "__main__":
Modified: trunk/matplotlib/lib/matplotlib/texmanager.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/texmanager.py	2007年07月19日 17:04:19 UTC (rev 3576)
+++ trunk/matplotlib/lib/matplotlib/texmanager.py	2007年07月19日 17:23:41 UTC (rev 3577)
@@ -18,7 +18,7 @@
 Only supported on *Agg and PS backends currently
 
 
-For raster output, you can get RGBA numerix arrays from TeX expressions
+For raster output, you can get RGBA numpy arrays from TeX expressions
 as follows
 
 texmanager = TexManager()
@@ -78,7 +78,7 @@
 
 dvipngVersion = get_dvipng_version()
 
- # mappable cache of 
+ # mappable cache of
 arrayd = {}
 postscriptd = {}
 pscnt = 0
@@ -90,7 +90,7 @@
 font_family = 'serif'
 font_families = ('serif', 'sans-serif', 'cursive', 'monospace')
 
- font_info = {'new century schoolbook': ('pnc', 
+ font_info = {'new century schoolbook': ('pnc',
 r'\renewcommand{\rmdefault}{pnc}'),
 'bookman': ('pbk', r'\renewcommand{\rmdefault}{pbk}'),
 'times': ('ptm', r'\usepackage{mathptmx}'),
@@ -107,7 +107,7 @@
 'computer modern roman': ('cmr', ''),
 'computer modern sans serif': ('cmss', ''),
 'computer modern typewriter': ('cmtt', '')}
- 
+
 _rc_cache = None
 _rc_cache_keys = ('text.latex.preamble', )\
 + tuple('font.'+n for n in ('family', ) + font_families)
@@ -122,15 +122,15 @@
 else:
 warnings.warn('The %s font family is not compatible with LaTeX. serif will be used by default.' % ff)
 self.font_family = 'serif'
- 
+
 fontconfig = [self.font_family]
 for font_family, font_family_attr in \
 ((ff, ff.replace('-', '_')) for ff in self.font_families):
 for font in rcParams['font.'+font_family]:
- if DEBUG: print 'family: %s, font: %s, info: %s'%(font_family, 
+ if DEBUG: print 'family: %s, font: %s, info: %s'%(font_family,
 font, self.font_info[font.lower()])
 if font.lower() in self.font_info:
- setattr(self, font_family_attr, 
+ setattr(self, font_family_attr,
 self.font_info[font.lower()])
 break
 else:
@@ -165,7 +165,7 @@
 if changed:
 if DEBUG: print 'DEBUG following keys changed:', changed
 for k in changed:
- if DEBUG: 
+ if DEBUG:
 print 'DEBUG %-20s: %-10s -> %-10s' % \
 (k, self._rc_cache[k], rcParams[k])
 # deepcopy may not be necessary, but feels more future-proof
Modified: trunk/matplotlib/lib/matplotlib/text.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/text.py	2007年07月19日 17:04:19 UTC (rev 3576)
+++ trunk/matplotlib/lib/matplotlib/text.py	2007年07月19日 17:23:41 UTC (rev 3577)
@@ -12,7 +12,7 @@
 from font_manager import FontProperties
 from matplotlib import rcParams
 from patches import bbox_artist, YAArrow
-from numerix import sin, cos, pi, cumsum, dot, asarray, array, \
+from numpy import sin, cos, pi, cumsum, dot, asarray, array, \
 where, nonzero, equal, sqrt
 from transforms import lbwh_to_bbox, bbox_all, identity_transform
 from lines import Line2D
Modified: trunk/matplotlib/lib/matplotlib/units.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/units.py	2007年07月19日 17:04:19 UTC (rev 3576)
+++ trunk/matplotlib/lib/matplotlib/units.py	2007年07月19日 17:23:41 UTC (rev 3577)
@@ -83,7 +83,7 @@
 """
 convert obj using unit. If obj is a sequence, return the
 converted sequence. The ouput must be a sequence of scalars
- that can be used by the numerix array layer
+ that can be used by the numpy array layer
 """
 return obj
 convert = staticmethod(convert)
Modified: trunk/matplotlib/lib/matplotlib/widgets.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/widgets.py	2007年07月19日 17:04:19 UTC (rev 3576)
+++ trunk/matplotlib/lib/matplotlib/widgets.py	2007年07月19日 17:23:41 UTC (rev 3577)
@@ -7,10 +7,11 @@
 to be to accommodate your widget.
 """
 
-from mlab import linspace, dist
+from numpy import array, linspace
+
+from mlab import dist
 from patches import Circle, Rectangle
 from lines import Line2D
-from numerix import array
 from transforms import blend_xy_sep_transform
 
 class LockDraw:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ds...@us...> - 2007年07月19日 21:39:58
Revision: 3579
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3579&view=rev
Author: dsdale
Date: 2007年07月19日 13:24:30 -0700 (2007年7月19日)
Log Message:
-----------
fix polar plots, recovered two lines accidentally deleted in _backend_agg.cpp
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/texmanager.py
 trunk/matplotlib/mpl1/mtraits.py
 trunk/matplotlib/src/_backend_agg.cpp
Modified: trunk/matplotlib/lib/matplotlib/texmanager.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/texmanager.py	2007年07月19日 18:40:08 UTC (rev 3578)
+++ trunk/matplotlib/lib/matplotlib/texmanager.py	2007年07月19日 20:24:30 UTC (rev 3579)
@@ -134,7 +134,8 @@
 self.font_info[font.lower()])
 break
 else:
- warnings.warn('No LaTeX-compatible font found for the %s font family in rcParams. Using default.' % ff)
+ mpl.verbose.report('No LaTeX-compatible font found for \
+the %s font family in rcParams. Using default.' % ff, 'helpful')
 setattr(self, font_family_attr, font_family)
 fontconfig.append(getattr(self, font_family_attr)[0])
 self._fontconfig = ''.join(fontconfig)
Modified: trunk/matplotlib/mpl1/mtraits.py
===================================================================
--- trunk/matplotlib/mpl1/mtraits.py	2007年07月19日 18:40:08 UTC (rev 3578)
+++ trunk/matplotlib/mpl1/mtraits.py	2007年07月19日 20:24:30 UTC (rev 3579)
@@ -8,7 +8,8 @@
 wget http://peak.telecommunity.com/dist/ez_setup.py
 sudo python ez_setup.py
 
- sudo easy_install -f http://code.enthought.com/enstaller/eggs/source/unstable/ "enthought.etsconfig <3.0a" "enthought.util <3.0a" "enthought.debug <3.0a"
+ sudo easy_install -f http://code.enthought.com/enstaller/eggs/source/unstable/ \
+"enthought.etsconfig <3.0a" "enthought.util <3.0a" "enthought.debug <3.0a"
 
 svn co https://svn.enthought.com/svn/enthought/branches/enthought.traits_2.0 enthought_traits
 
Modified: trunk/matplotlib/src/_backend_agg.cpp
===================================================================
--- trunk/matplotlib/src/_backend_agg.cpp	2007年07月19日 18:40:08 UTC (rev 3578)
+++ trunk/matplotlib/src/_backend_agg.cpp	2007年07月19日 20:24:30 UTC (rev 3579)
@@ -1528,6 +1528,8 @@
 GCAgg gc = GCAgg(args[0], dpi, snapto);
 
 set_clipbox_rasterizer(gc.cliprect);
+ //path_t transpath(path, xytrans);
+ _process_alpha_mask(gc);
 
 Transformation* mpltransform = static_cast<Transformation*>(args[3].ptr());
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jd...@us...> - 2007年07月20日 02:10:44
Revision: 3580
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3580&view=rev
Author: jdh2358
Date: 2007年07月19日 19:10:43 -0700 (2007年7月19日)
Log Message:
-----------
reverted numerix breakage, with apologies
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/art3d.py
 trunk/matplotlib/lib/matplotlib/axes3d.py
 trunk/matplotlib/lib/matplotlib/axis.py
 trunk/matplotlib/lib/matplotlib/axis3d.py
 trunk/matplotlib/lib/matplotlib/backend_bases.py
 trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
 trunk/matplotlib/lib/matplotlib/backends/backend_agg2.py
 trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py
 trunk/matplotlib/lib/matplotlib/backends/backend_fltkagg.py
 trunk/matplotlib/lib/matplotlib/backends/backend_gd.py
 trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py
 trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py
 trunk/matplotlib/lib/matplotlib/backends/backend_paint.py
 trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
 trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
 trunk/matplotlib/lib/matplotlib/backends/backend_qt.py
 trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py
 trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py
 trunk/matplotlib/lib/matplotlib/collections.py
 trunk/matplotlib/lib/matplotlib/colors.py
 trunk/matplotlib/lib/matplotlib/figure.py
 trunk/matplotlib/lib/matplotlib/finance.py
 trunk/matplotlib/lib/matplotlib/image.py
 trunk/matplotlib/lib/matplotlib/legend.py
 trunk/matplotlib/lib/matplotlib/lines.py
 trunk/matplotlib/lib/matplotlib/mathtext.py
 trunk/matplotlib/lib/matplotlib/mlab.py
 trunk/matplotlib/lib/matplotlib/numerix/__init__.py
 trunk/matplotlib/lib/matplotlib/patches.py
 trunk/matplotlib/lib/matplotlib/proj3d.py
 trunk/matplotlib/lib/matplotlib/table.py
 trunk/matplotlib/lib/matplotlib/texmanager.py
 trunk/matplotlib/lib/matplotlib/text.py
 trunk/matplotlib/lib/matplotlib/units.py
 trunk/matplotlib/lib/matplotlib/widgets.py
 trunk/matplotlib/mpl1/mpl1.py
 trunk/matplotlib/mpl1/mtraits.py
 trunk/matplotlib/setup.py
Modified: trunk/matplotlib/lib/matplotlib/art3d.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/art3d.py	2007年07月19日 20:24:30 UTC (rev 3579)
+++ trunk/matplotlib/lib/matplotlib/art3d.py	2007年07月20日 02:10:43 UTC (rev 3580)
@@ -12,7 +12,7 @@
 from colors import Normalize
 from cm import jet
 
-import numpy as npy
+import numerix as nx
 import proj3d
 
 class Wrap2D:
@@ -254,8 +254,8 @@
 segis.append((si,ei))
 si = ei
 xs,ys,zs = zip(*points)
- ones = npy.ones(len(xs))
- self.vec = npy.array([xs,ys,zs,ones])
+ ones = nx.ones(len(xs))
+ self.vec = nx.array([xs,ys,zs,ones])
 self.segis = segis
 
 def draw3d(self, renderer):
Modified: trunk/matplotlib/lib/matplotlib/axes3d.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes3d.py	2007年07月19日 20:24:30 UTC (rev 3579)
+++ trunk/matplotlib/lib/matplotlib/axes3d.py	2007年07月20日 02:10:43 UTC (rev 3580)
@@ -17,7 +17,7 @@
 from transforms import unit_bbox
 
 import figure
-import numpy as npy
+import numerix as nx
 from colors import Normalize
 
 import art3d
@@ -122,8 +122,8 @@
 self.zz_dataLim.intervalx, self)
 
 def unit_cube(self,vals=None):
- minpy,maxx,miny,maxy,minz,maxz = vals or self.get_w_lims()
- xs,ys,zs = ([minpy,maxx,maxx,minpy,minpy,maxx,maxx,minpy],
+ minx,maxx,miny,maxy,minz,maxz = vals or self.get_w_lims()
+ xs,ys,zs = ([minx,maxx,maxx,minx,minx,maxx,maxx,minx],
 [miny,miny,maxy,maxy,miny,miny,maxy,maxy],
 [minz,minz,minz,minz,maxz,maxz,maxz,maxz])
 return zip(xs,ys,zs)
@@ -186,7 +186,7 @@
 pass
 
 def auto_scale_xyz(self, X,Y,Z=None,had_data=None):
- x,y,z = map(npy.asarray, (X,Y,Z))
+ x,y,z = map(nx.asarray, (X,Y,Z))
 try:
 x,y = X.flat,Y.flat
 if Z is not None:
@@ -216,10 +216,10 @@
 self.set_w_zlim(locator.autoscale())
 
 def get_w_lims(self):
- minpy,maxx = self.get_w_xlim()
+ minx,maxx = self.get_w_xlim()
 miny,maxy = self.get_w_ylim()
 minz,maxz = self.get_w_zlim()
- return minpy,maxx,miny,maxy,minz,maxz
+ return minx,maxx,miny,maxy,minz,maxz
 
 def set_w_zlim(self, *args, **kwargs):
 gl,self.get_xlim = self.get_xlim,self.get_w_zlim
@@ -257,7 +257,7 @@
 def pany(self, numsteps):
 print 'numsteps', numsteps
 
- def panpy(self, numsteps):
+ def panx(self, numsteps):
 print 'numsteps', numsteps
 
 def view_init(self, elev, azim):
@@ -276,7 +276,7 @@
 point.
 
 """
- relev,razim = npy.pi * self.elev/180, npy.pi * self.azim/180
+ relev,razim = nx.pi * self.elev/180, nx.pi * self.azim/180
 
 xmin,xmax = self.get_w_xlim()
 ymin,ymax = self.get_w_ylim()
@@ -288,29 +288,29 @@
 zmin,zmax)
 
 # look into the middle of the new coordinates
- R = npy.array([0.5,0.5,0.5])
+ R = nx.array([0.5,0.5,0.5])
 #
- xp = R[0] + npy.cos(razim)*npy.cos(relev)*self.dist
- yp = R[1] + npy.sin(razim)*npy.cos(relev)*self.dist
- zp = R[2] + npy.sin(relev)*self.dist
+ xp = R[0] + nx.cos(razim)*nx.cos(relev)*self.dist
+ yp = R[1] + nx.sin(razim)*nx.cos(relev)*self.dist
+ zp = R[2] + nx.sin(relev)*self.dist
 
- E = npy.array((xp, yp, zp))
+ E = nx.array((xp, yp, zp))
 #
 self.eye = E
 self.vvec = R - E
 self.vvec = self.vvec / proj3d.mod(self.vvec)
 
- if abs(relev) > npy.pi/2:
+ if abs(relev) > nx.pi/2:
 # upside down
- V = npy.array((0,0,-1))
+ V = nx.array((0,0,-1))
 else:
- V = npy.array((0,0,1))
+ V = nx.array((0,0,1))
 zfront,zback = -self.dist,self.dist
 
 viewM = proj3d.view_transformation(E,R,V)
 perspM = proj3d.persp_transformation(zfront,zback)
- M0 = npy.dot(viewM,worldM)
- M = npy.dot(perspM,M0)
+ M0 = nx.matrixmultiply(viewM,worldM)
+ M = nx.matrixmultiply(perspM,M0)
 return M
 
 def mouse_init(self):
@@ -383,8 +383,8 @@
 # scale the z value to match
 x0,y0,z0 = p0
 x1,y1,z1 = p1
- d0 = npy.hypot(x0-xd,y0-yd)
- d1 = npy.hypot(x1-xd,y1-yd)
+ d0 = nx.hypot(x0-xd,y0-yd)
+ d1 = nx.hypot(x1-xd,y1-yd)
 dt = d0+d1
 z = d1/dt * z0 + d0/dt * z1
 #print 'mid', edgei, d0, d1, z0, z1, z
@@ -435,12 +435,12 @@
 elif self.button_pressed == 3:
 # zoom view
 # hmmm..this needs some help from clipping....
- minpy,maxx,miny,maxy,minz,maxz = self.get_w_lims()
+ minx,maxx,miny,maxy,minz,maxz = self.get_w_lims()
 df = 1-((h - dy)/h)
- dx = (maxx-minpy)*df
+ dx = (maxx-minx)*df
 dy = (maxy-miny)*df
 dz = (maxz-minz)*df
- self.set_w_xlim(minpy-dx,maxx+dx)
+ self.set_w_xlim(minx-dx,maxx+dx)
 self.set_w_ylim(miny-dy,maxy+dy)
 self.set_w_zlim(minz-dz,maxz+dz)
 self.get_proj()
@@ -504,14 +504,14 @@
 had_data = self.has_data()
 
 rows, cols = Z.shape
- tX,tY,tZ = npy.transpose(X), npy.transpose(Y), npy.transpose(Z)
+ tX,tY,tZ = nx.transpose(X), nx.transpose(Y), nx.transpose(Z)
 rstride = cbook.popd(kwargs, 'rstride', 10)
 cstride = cbook.popd(kwargs, 'cstride', 10)
 #
 polys = []
 boxes = []
- for rs in npy.arange(0,rows,rstride):
- for cs in npy.arange(0,cols,cstride):
+ for rs in nx.arange(0,rows,rstride):
+ for cs in nx.arange(0,cols,cstride):
 ps = []
 corners = []
 for a,ta in [(X,tX),(Y,tY),(Z,tZ)]:
@@ -522,9 +522,9 @@
 zright = ta[cs][rs:min(rows-1,rs+rstride):]
 zright = zright[::-1]
 corners.append([ztop[0],ztop[-1],zbase[0],zbase[-1]])
- z = npy.concatenate((ztop,zleft,zbase,zright))
+ z = nx.concatenate((ztop,zleft,zbase,zright))
 ps.append(z)
- boxes.append(map(npy.array,zip(*corners)))
+ boxes.append(map(nx.array,zip(*corners)))
 polys.append(zip(*ps))
 #
 lines = []
@@ -533,10 +533,10 @@
 n = proj3d.cross(box[0]-box[1],
 box[0]-box[2])
 n = n/proj3d.mod(n)*5
- shade.append(npy.dot(n,[-1,-1,0.5]))
+ shade.append(nx.dot(n,[-1,-1,0.5]))
 lines.append((box[0],n+box[0]))
 #
- color = npy.array([0,0,1,1])
+ color = nx.array([0,0,1,1])
 norm = Normalize(min(shade),max(shade))
 colors = [color * (0.5+norm(v)*0.5) for v in shade]
 for c in colors: c[3] = 1
@@ -554,7 +554,7 @@
 had_data = self.has_data()
 rows,cols = Z.shape
 
- tX,tY,tZ = npy.transpose(X), npy.transpose(Y), npy.transpose(Z)
+ tX,tY,tZ = nx.transpose(X), nx.transpose(Y), nx.transpose(Z)
 
 rii = [i for i in range(0,rows,rstride)]+[rows-1]
 cii = [i for i in range(0,cols,cstride)]+[cols-1]
@@ -718,7 +718,7 @@
 
 def get_test_data(delta=0.05):
 from mlab import meshgrid, bivariate_normal
- x = y = npy.arange(-3.0, 3.0, delta)
+ x = y = nx.arange(-3.0, 3.0, delta)
 X, Y = meshgrid(x,y)
 
 Z1 = bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
@@ -764,8 +764,8 @@
 
 def test_plot():
 ax = Axes3D()
- xs = npy.arange(0,4*npy.pi+0.1,0.1)
- ys = npy.sin(xs)
+ xs = nx.arange(0,4*nx.pi+0.1,0.1)
+ ys = nx.sin(xs)
 ax.plot(xs,ys, label='zl')
 ax.plot(xs,ys+max(xs),label='zh')
 ax.plot(xs,ys,dir='x', label='xl')
@@ -785,7 +785,7 @@
 cc = lambda arg: colorConverter.to_rgba(arg, alpha=0.6)
 
 ax = Axes3D()
- xs = npy.arange(0,10,0.4)
+ xs = nx.arange(0,10,0.4)
 verts = []
 zs = [0.0,1.0,2.0,3.0]
 for z in zs:
@@ -817,7 +817,7 @@
 ax = Axes3D()
 
 for c,z in zip(['r','g','b','y'],[30,20,10,0]):
- xs = npy.arange(20)
+ xs = nx.arange(20)
 ys = [random.random() for x in xs]
 ax.bar(xs,ys,z=z,dir='y',color=c)
 #ax.plot(xs,ys)
Modified: trunk/matplotlib/lib/matplotlib/axis.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axis.py	2007年07月19日 20:24:30 UTC (rev 3579)
+++ trunk/matplotlib/lib/matplotlib/axis.py	2007年07月20日 02:10:43 UTC (rev 3580)
@@ -7,13 +7,14 @@
 import re
 import sys
 
-from numpy import arange, array, asarray, ones, zeros, \
- nonzero, take, log10, logical_and, \
- dot, sin, cos, tan, pi, sqrt, linspace
+from numerix import arange, array, asarray, ones, zeros, \
+ nonzero, take, Float, log10, logical_and, \
+ dot, sin, cos, tan, pi, sqrt
 
 from artist import Artist, setp
 from cbook import enumerate, silent_list, popall, CallbackRegistry
 from lines import Line2D, TICKLEFT, TICKRIGHT, TICKUP, TICKDOWN
+from mlab import linspace
 from matplotlib import rcParams
 from patches import bbox_artist
 from ticker import NullFormatter, FixedFormatter, ScalarFormatter, LogFormatter
@@ -117,7 +118,7 @@
 
 def contains(self, mouseevent):
 """Test whether the mouse event occured in the Tick marks.
-
+ 
 This function always returns false. It is more useful to test if the
 axis as a whole contains the mouse rather than the set of tick marks.
 """
@@ -491,7 +492,7 @@
 LABELPAD = 5
 OFFSETTEXTPAD = 3
 
- def __str__(self):
+ def __str__(self): 
 return str(self.__class__).split('.')[-1] \
 + "(%d,%d)"%self.axes.transAxes.xy_tup((0,0))
 
@@ -656,7 +657,7 @@
 def get_offset_text(self):
 'Return the axis offsetText as a Text instance'
 return self.offsetText
-
+ 
 def get_pickradius(self):
 'Return the depth of the axis used by the picker'
 return self.pickradius
@@ -900,11 +901,11 @@
 self.minor.locator = locator
 self.minor.locator.set_view_interval( self.get_view_interval() )
 self.minor.locator.set_data_interval( self.get_data_interval() )
-
+ 
 def set_pickradius(self, pickradius):
 """
 Set the depth of the axis used by the picker
-
+ 
 ACCEPTS: a distance in points
 """
 self.pickradius = pickradius
@@ -966,12 +967,12 @@
 
 class XAxis(Axis):
 __name__ = 'xaxis'
-
+ 
 def contains(self,mouseevent):
 """Test whether the mouse event occured in the x axis.
 """
 if callable(self._contains): return self._contains(self,mouseevent)
-
+ 
 xpixel,ypixel = mouseevent.x,mouseevent.y
 try:
 xaxes,yaxes = self.axes.transAxes.inverse_xy_tup((xpixel,ypixel))
@@ -1154,11 +1155,11 @@
 
 def contains(self,mouseevent):
 """Test whether the mouse event occurred in the y axis.
-
+ 
 Returns T/F, {}
 """
 if callable(self._contains): return self._contains(self,mouseevent)
-
+ 
 xpixel,ypixel = mouseevent.x,mouseevent.y
 try:
 xaxes,yaxes = self.axes.transAxes.inverse_xy_tup((xpixel,ypixel))
Modified: trunk/matplotlib/lib/matplotlib/axis3d.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axis3d.py	2007年07月19日 20:24:30 UTC (rev 3579)
+++ trunk/matplotlib/lib/matplotlib/axis3d.py	2007年07月20日 02:10:43 UTC (rev 3580)
@@ -13,7 +13,7 @@
 import art3d
 import proj3d
 
-from numpy import sin, cos, pi, cumsum, dot, asarray, array, \
+from numerix import sin, cos, pi, cumsum, dot, asarray, array, \
 where, nonzero, equal, sqrt
 
 def norm_angle(a):
Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backend_bases.py	2007年07月19日 20:24:30 UTC (rev 3579)
+++ trunk/matplotlib/lib/matplotlib/backend_bases.py	2007年07月20日 02:10:43 UTC (rev 3580)
@@ -437,7 +437,7 @@
 def points_to_pixels(self, points):
 """
 Convert points to display units
- points - a float or a numpy array of float
+ points - a float or a numerix array of float
 return points converted to pixels
 
 You need to override this function (unless your backend doesn't have a
@@ -891,24 +891,24 @@
 #print "leaving:",[str(a) for a in leave]
 # On leave restore the captured colour
 for a in leave:
- if hasattr(a,'get_color'):
+ if hasattr(a,'get_color'): 
 a.set_color(self._active[a])
- elif hasattr(a,'get_edgecolor'):
+ elif hasattr(a,'get_edgecolor'): 
 a.set_edgecolor(self._active[a][0])
 a.set_facecolor(self._active[a][1])
 del self._active[a]
 # On enter, capture the color and repaint the artist
- # with the highlight colour. Capturing colour has to
- # be done first in case the parent recolouring affects
+ # with the highlight colour. Capturing colour has to 
+ # be done first in case the parent recolouring affects 
 # the child.
 for a in enter:
- if hasattr(a,'get_color'):
+ if hasattr(a,'get_color'): 
 self._active[a] = a.get_color()
 elif hasattr(a,'get_edgecolor'):
 self._active[a] = (a.get_edgecolor(),a.get_facecolor())
 else: self._active[a] = None
 for a in enter:
- if hasattr(a,'get_color'):
+ if hasattr(a,'get_color'): 
 a.set_color('red')
 elif hasattr(a,'get_edgecolor'):
 a.set_edgecolor('red')
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py	2007年07月19日 20:24:30 UTC (rev 3579)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py	2007年07月20日 02:10:43 UTC (rev 3580)
@@ -73,7 +73,7 @@
 import os, sys
 import matplotlib
 from matplotlib import verbose, rcParams
-from numpy import array, zeros, transpose, fliplr
+from matplotlib.numerix import array, Float, zeros, transpose
 from matplotlib._image import fromarray
 from matplotlib._pylab_helpers import Gcf
 from matplotlib.backend_bases import RendererBase,\
@@ -85,6 +85,7 @@
 from matplotlib.ft2font import FT2Font
 from matplotlib.mathtext import math_parse_s_ft2font
 from matplotlib.transforms import lbwh_to_bbox
+from matplotlib.numerix.mlab import fliplr
 
 from _backend_agg import RendererAgg as _RendererAgg
 
@@ -153,8 +154,8 @@
 point in x, y
 """
 if __debug__: verbose.report('RendererAgg.draw_line', 'debug-annoying')
- x = array([x1,x2], float)
- y = array([y1,y2], float)
+ x = array([x1,x2], typecode=Float)
+ y = array([y1,y2], typecode=Float)
 self._renderer.draw_lines(gc, x, y)
 
 
@@ -272,7 +273,7 @@
 def func(x):
 return transpose(fliplr(x))
 
- Z = zeros((n,m,4), float)
+ Z = zeros((n,m,4), typecode=Float)
 Z[:,:,0] = func(r)
 Z[:,:,1] = func(g)
 Z[:,:,2] = func(b)
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg2.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_agg2.py	2007年07月19日 20:24:30 UTC (rev 3579)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_agg2.py	2007年07月20日 02:10:43 UTC (rev 3580)
@@ -8,7 +8,7 @@
 import matplotlib.agg as agg
 
 from matplotlib import verbose
-from numpy import array
+from matplotlib.numerix import array, Float
 
 from matplotlib._pylab_helpers import Gcf
 from matplotlib.backend_bases import RendererBase,\
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py	2007年07月19日 20:24:30 UTC (rev 3579)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py	2007年07月20日 02:10:43 UTC (rev 3580)
@@ -38,7 +38,7 @@
 from matplotlib.cbook import enumerate, izip
 from matplotlib.figure import Figure
 from matplotlib.mathtext import math_parse_s_ft2font
-import numpy as npy
+import matplotlib.numerix as numx
 from matplotlib.transforms import Bbox
 from matplotlib import rcParams
 
@@ -137,8 +137,8 @@
 ctx.rotate(rotation)
 ctx.scale(width / 2.0, height / 2.0)
 ctx.new_sub_path()
- ctx.arc(0.0, 0.0, 1.0, npy.pi * angle1 / 180.,
- npy.pi * angle2 / 180.)
+ ctx.arc(0.0, 0.0, 1.0, numx.pi * angle1 / 180.,
+ numx.pi * angle2 / 180.)
 ctx.restore()
 
 self._fill_and_stroke (ctx, rgbFace)
@@ -243,7 +243,7 @@
 # render by drawing a 0.5 radius circle
 ctx = gc.ctx
 ctx.new_path()
- ctx.arc (x, self.height - y, 0.5, 0, 2*npy.pi)
+ ctx.arc (x, self.height - y, 0.5, 0, 2*numx.pi)
 self._fill_and_stroke (ctx, gc.get_rgb())
 
 
@@ -294,7 +294,7 @@
 
 ctx.save()
 if angle:
- ctx.rotate (-angle * npy.pi / 180)
+ ctx.rotate (-angle * numx.pi / 180)
 ctx.set_font_size (size)
 ctx.show_text (s)
 ctx.restore()
@@ -304,7 +304,7 @@
 if _debug: print '%s.%s()' % (self.__class__.__name__, _fn_name())
 # mathtext using the gtk/gdk method
 
- #if npy.which[0] == "numarray":
+ #if numx.which[0] == "numarray":
 # warnings.warn("_draw_mathtext() currently works for numpy, but "
 # "not numarray")
 # return
@@ -327,21 +327,21 @@
 N = imw*imh
 
 # a numpixels by num fonts array
- Xall = npy.zeros((N,len(fonts)), npy.uint8)
+ Xall = numx.zeros((N,len(fonts)), typecode=numx.UInt8)
 
 for i, font in enumerate(fonts):
 if angle == 90:
 font.horiz_image_to_vert_image() # <-- Rotate
 imw, imh, s = font.image_as_str()
- Xall[:,i] = npy.fromstring(s, npy.uint8)
+ Xall[:,i] = numx.fromstring(s, numx.UInt8)
 
 # get the max alpha at each pixel
- Xs = npy.mlab.max (Xall,1)
+ Xs = numx.mlab.max (Xall,1)
 
 # convert it to it's proper shape
 Xs.shape = imh, imw
 
- pa = npy.zeros((imh,imw,4), npy.uint8)
+ pa = numx.zeros(shape=(imh,imw,4), typecode=numx.UInt8)
 rgb = gc.get_rgb()
 pa[:,:,0] = int(rgb[0]*255)
 pa[:,:,1] = int(rgb[1]*255)
@@ -469,7 +469,7 @@
 self.ctx.set_dash([], 0) # switch dashes off
 else:
 self.ctx.set_dash (
- self.renderer.points_to_pixels (npy.asarray(dashes)), offset)
+ self.renderer.points_to_pixels (numx.asarray(dashes)), offset)
 
 
 def set_foreground(self, fg, isRGB=None):
@@ -593,7 +593,7 @@
 ctx = renderer.ctx
 
 if orientation == 'landscape':
- ctx.rotate (npy.pi/2)
+ ctx.rotate (numx.pi/2)
 ctx.translate (0, -height_in_points)
 # cairo/src/cairo_ps_surface.c
 # '%%Orientation: Portrait' is always written to the file header
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_fltkagg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_fltkagg.py	2007年07月19日 20:24:30 UTC (rev 3579)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_fltkagg.py	2007年07月20日 02:10:43 UTC (rev 3580)
@@ -17,8 +17,6 @@
 
 import os.path
 
-from numpy import asarray
-
 import matplotlib
 
 from matplotlib import rcParams, verbose
@@ -28,6 +26,7 @@
 NavigationToolbar2, cursors
 from matplotlib.figure import Figure
 from matplotlib._pylab_helpers import Gcf
+from matplotlib.numerix import asarray
 import matplotlib.windowing as windowing
 from matplotlib.widgets import SubplotTool
 
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gd.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_gd.py	2007年07月19日 20:24:30 UTC (rev 3579)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_gd.py	2007年07月20日 02:10:43 UTC (rev 3580)
@@ -12,7 +12,6 @@
 sys.exit()
 
 
-from numpy import ones, array, int16, asarray
 
 from matplotlib.backend_bases import RendererBase, \
 GraphicsContextBase, FigureManagerBase, FigureCanvasBase
@@ -23,6 +22,7 @@
 from matplotlib.figure import Figure
 from matplotlib.transforms import Bbox
 from matplotlib.font_manager import fontManager
+from matplotlib.numerix import ones, array, nx, asarray
 # support old font names
 if (os.environ.has_key('GDFONTPATH') and not
 os.environ.has_key('TTFPATH')):
@@ -115,8 +115,8 @@
 point in x, y
 """
 
- x = x.astype(int16)
- y = self.height*ones(y.shape, int16) - y.astype(int16)
+ x = x.astype(nx.Int16)
+ y = self.height*ones(y.shape, nx.Int16) - y.astype(nx.Int16)
 style = self._set_gd_style(gc)
 self.im.lines( zip(x,y), style)
 self.flush_clip()
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py	2007年07月19日 20:24:30 UTC (rev 3579)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py	2007年07月20日 02:10:43 UTC (rev 3580)
@@ -16,9 +16,6 @@
 % (gtk.pygtk_version + pygtk_version_required))
 del pygtk_version_required
 
-from numpy import amax, asarray, fromstring, int16, uint8, zeros, \
- where, transpose, nonzero, indices, ones
-
 import matplotlib
 from matplotlib._pylab_helpers import Gcf
 from matplotlib.backend_bases import RendererBase, GraphicsContextBase, \
@@ -26,7 +23,11 @@
 from matplotlib.cbook import is_string_like, enumerate
 from matplotlib.figure import Figure
 from matplotlib.mathtext import math_parse_s_ft2font
+import matplotlib.numerix as numerix
+from matplotlib.numerix import asarray, fromstring, UInt8, zeros, \
+ where, transpose, nonzero, indices, ones, nx
 
+
 from matplotlib.backends._backend_gdk import pixbuf_get_pixels_array
 
 
@@ -105,7 +106,7 @@
 im.flipud_out()
 rows, cols, image_str = im.as_rgba_str()
 
- image_array = fromstring(image_str, uint8)
+ image_array = fromstring(image_str, UInt8)
 image_array.shape = rows, cols, 4
 
 pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB,
@@ -143,8 +144,8 @@
 
 def draw_lines(self, gc, x, y, transform=None):
 if gc.gdkGC.line_width > 0:
- x = x.astype(int16)
- y = self.height - y.astype(int16)
+ x = x.astype(nx.Int16)
+ y = self.height - y.astype(nx.Int16)
 self.gdkDrawable.draw_lines(gc.gdkGC, zip(x,y))
 
 
@@ -212,16 +213,16 @@
 N = imw*imh
 
 # a numpixels by num fonts array
- Xall = zeros((N,len(fonts)), uint8)
+ Xall = zeros((N,len(fonts)), typecode=UInt8)
 
 for i, font in enumerate(fonts):
 if angle == 90:
 font.horiz_image_to_vert_image() # <-- Rotate
 imw, imh, image_str = font.image_as_str()
- Xall[:,i] = fromstring(image_str, uint8)
+ Xall[:,i] = fromstring(image_str, UInt8)
 
 # get the max alpha at each pixel
- Xs = amax(Xall,axis=1)
+ Xs = numerix.mlab.max(Xall,1)
 
 # convert it to it's proper shape
 Xs.shape = imh, imw
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py	2007年07月19日 20:24:30 UTC (rev 3579)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py	2007年07月20日 02:10:43 UTC (rev 3580)
@@ -22,8 +22,9 @@
 from matplotlib.cbook import is_string_like, enumerate
 from matplotlib.colors import colorConverter
 from matplotlib.figure import Figure
-from numpy import asarray, fromstring, zeros, \
- where, transpose, nonzero, indices, ones
+import matplotlib.numerix as numerix
+from matplotlib.numerix import asarray, fromstring, UInt8, zeros, \
+ where, transpose, nonzero, indices, ones, nx
 from matplotlib.widgets import SubplotTool
 
 from matplotlib import lines
@@ -155,7 +156,7 @@
 gdk.LEAVE_NOTIFY_MASK |
 gdk.POINTER_MOTION_MASK |
 gdk.POINTER_MOTION_HINT_MASK)
-
+ 
 def __init__(self, figure):
 if _debug: print 'FigureCanvasGTK.%s' % fn_name()
 FigureCanvasBase.__init__(self, figure)
@@ -1086,7 +1087,7 @@
 
 hbox.show_all()
 self.set_extra_widget(hbox)
-
+ 
 def get_filename_from_user (self):
 while True:
 filename = None
@@ -1136,7 +1137,7 @@
 
 def __init__(self, lines):
 import gtk.glade
-
+ 
 datadir = matplotlib.get_data_path()
 gladefile = os.path.join(datadir, 'lineprops.glade')
 if not os.path.exists(gladefile):
@@ -1278,7 +1279,7 @@
 # Unfortunately, the SVG renderer (rsvg) leaks memory under earlier
 # versions of pygtk, so we have to use a PNG file instead.
 try:
-
+ 
 if gtk.pygtk_version < (2, 8, 0):
 icon_filename = 'matplotlib.png'
 else:
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_paint.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_paint.py	2007年07月19日 20:24:30 UTC (rev 3579)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_paint.py	2007年07月20日 02:10:43 UTC (rev 3580)
@@ -16,10 +16,8 @@
 import sys
 import os
 import paint
-
-from numpy import asarray
-
 from matplotlib import verbose
+from matplotlib.numerix import asarray
 
 from matplotlib._pylab_helpers import Gcf
 from matplotlib.backend_bases import RendererBase,\
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py	2007年07月19日 20:24:30 UTC (rev 3579)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py	2007年07月20日 02:10:43 UTC (rev 3580)
@@ -28,7 +28,7 @@
 from matplotlib.dviread import Dvi
 from matplotlib.ft2font import FT2Font, FIXED_WIDTH, ITALIC, LOAD_NO_SCALE
 from matplotlib.mathtext import math_parse_s_pdf
-from numpy import float32, uint8, fromstring, arange, infinity, isnan, asarray
+from matplotlib.numerix import Float32, UInt8, fromstring, arange, infinity, isnan, asarray
 from matplotlib.transforms import Bbox
 from matplotlib import ttconv
 
@@ -543,13 +543,13 @@
 fontdict['FontMatrix'] = [ .001, 0, 0, .001, 0, 0 ]
 fontdict['CharProcs'] = charprocsObject
 fontdict['Encoding'] = {
- 'Type': Name('Encoding'),
+ 'Type': Name('Encoding'), 
 'Differences': differencesArray}
 elif fonttype == 42:
 fontdict['Subtype'] = Name('TrueType')
 fontdict['Encoding'] = Name('WinAnsiEncoding')
 
-
+ 
 flags = 0
 symbolic = False #ps_name.name in ('Cmsy10', 'Cmmi10', 'Cmex10')
 if ff & FIXED_WIDTH: flags |= 1 << 0
@@ -632,7 +632,7 @@
 self.beginStream(charprocObject.id,
 None,
 {'Length': len(stream)})
- self.currentstream.write(stream)
+ self.currentstream.write(stream) 
 self.endStream()
 charprocs[charname] = charprocObject
 self.writeObject(charprocsObject, charprocs)
@@ -755,20 +755,20 @@
 def _rgb(self, im):
 h,w,s = im.as_rgba_str()
 
- rgba = fromstring(s, uint8)
+ rgba = fromstring(s, UInt8)
 rgba.shape = (h, w, 4)
 rgb = rgba[:,:,:3]
 return h, w, rgb.tostring()
 
 def _gray(self, im, rc=0.3, gc=0.59, bc=0.11):
 rgbat = im.as_rgba_str()
- rgba = fromstring(rgbat[2], uint8)
+ rgba = fromstring(rgbat[2], UInt8)
 rgba.shape = (rgbat[0], rgbat[1], 4)
- rgba_f = rgba.astype(float32)
+ rgba_f = rgba.astype(Float32)
 r = rgba_f[:,:,0]
 g = rgba_f[:,:,1]
 b = rgba_f[:,:,2]
- gray = (r*rc + g*gc + b*bc).astype(uint8)
+ gray = (r*rc + g*gc + b*bc).astype(UInt8)
 return rgbat[0], rgbat[1], gray.tostring()
 
 def writeImages(self):
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py	2007年07月19日 20:24:30 UTC (rev 3579)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py	2007年07月20日 02:10:43 UTC (rev 3580)
@@ -26,7 +26,7 @@
 
 from matplotlib.transforms import get_vec6_scales
 
-from numpy import uint8, float32, alltrue, array, ceil, equal, \
+from matplotlib.numerix import UInt8, Float32, alltrue, array, ceil, equal, \
 fromstring, nonzero, ones, put, take, where, isnan
 import binascii
 import re
@@ -336,20 +336,20 @@
 def _rgb(self, im):
 h,w,s = im.as_rgba_str()
 
- rgba = fromstring(s, uint8)
+ rgba = fromstring(s, UInt8)
 rgba.shape = (h, w, 4)
 rgb = rgba[:,:,:3]
 return h, w, rgb.tostring()
 
 def _gray(self, im, rc=0.3, gc=0.59, bc=0.11):
 rgbat = im.as_rgba_str()
- rgba = fromstring(rgbat[2], uint8)
+ rgba = fromstring(rgbat[2], UInt8)
 rgba.shape = (rgbat[0], rgbat[1], 4)
- rgba_f = rgba.astype(float32)
+ rgba_f = rgba.astype(Float32)
 r = rgba_f[:,:,0]
 g = rgba_f[:,:,1]
 b = rgba_f[:,:,2]
- gray = (r*rc + g*gc + b*bc).astype(uint8)
+ gray = (r*rc + g*gc + b*bc).astype(UInt8)
 return rgbat[0], rgbat[1], gray.tostring()
 
 def _hex_lines(self, s, chars_per_line=128):
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_qt.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_qt.py	2007年07月19日 20:24:30 UTC (rev 3579)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_qt.py	2007年07月20日 02:10:43 UTC (rev 3580)
@@ -5,8 +5,9 @@
 
 import matplotlib
 from matplotlib import verbose
-from numpy import asarray, fromstring, zeros, \
- where, transpose, nonzero, indices, ones
+from matplotlib.numerix import asarray, fromstring, UInt8, zeros, \
+ where, transpose, nonzero, indices, ones, nx
+import matplotlib.numerix as numerix
 from matplotlib.cbook import is_string_like, enumerate, onetrue
 from matplotlib.font_manager import fontManager
 from matplotlib.backend_bases import RendererBase, GraphicsContextBase, \
@@ -322,7 +323,7 @@
 for text, tooltip_text, image_file, callback in self.toolitems:
 if text is not None:
 qt.QObject.disconnect( self.buttons[ text ],
- qt.SIGNAL( 'clicked()' ),
+ qt.SIGNAL( 'clicked()' ), 
 getattr( self, callback ) )
 
 def pan( self, *args ):
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py	2007年07月19日 20:24:30 UTC (rev 3579)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py	2007年07月20日 02:10:43 UTC (rev 3580)
@@ -5,8 +5,9 @@
 
 import matplotlib
 from matplotlib import verbose
-from numpy import asarray, fromstring, zeros, \
- where, transpose, nonzero, indices, ones
+from matplotlib.numerix import asarray, fromstring, UInt8, zeros, \
+ where, transpose, nonzero, indices, ones, nx
+import matplotlib.numerix as numerix
 from matplotlib.cbook import is_string_like, enumerate, onetrue
 from matplotlib.font_manager import fontManager
 from matplotlib.backend_bases import RendererBase, GraphicsContextBase, \
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py	2007年07月19日 20:24:30 UTC (rev 3579)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py	2007年07月20日 02:10:43 UTC (rev 3580)
@@ -10,8 +10,6 @@
 
 import os.path
 
-from numpy import asarray
-
 import matplotlib
 from matplotlib.cbook import is_string_like, enumerate
 from matplotlib.backend_bases import RendererBase, GraphicsContextBase, \
@@ -19,6 +17,7 @@
 
 from matplotlib.figure import Figure
 from matplotlib._pylab_helpers import Gcf
+from matplotlib.numerix import asarray
 
 import matplotlib.windowing as windowing
 from matplotlib.widgets import SubplotTool
Modified: trunk/matplotlib/lib/matplotlib/collections.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/collections.py	2007年07月19日 20:24:30 UTC (rev 3579)
+++ trunk/matplotlib/lib/matplotlib/collections.py	2007年07月20日 02:10:43 UTC (rev 3580)
@@ -145,14 +145,14 @@
 def contains(self, mouseevent):
 """
 Test whether the mouse event occurred in the collection.
-
+ 
 Returns T/F, dict(ind=itemlist), where every item in itemlist contains the event.
 """
 if callable(self._contains): return self._contains(self,mouseevent)
 # TODO: Consider doing the test in data coordinates
 # Patch transforms the mouse into data coordinates and does the
 # test for membership there. This is more efficient though it
- # may not match the visual appearance of the polygon on the
+ # may not match the visual appearance of the polygon on the 
 # screen. Regardless, patch and patch collection should use
 # the same algorithm. Here's the code in patch:
 #
@@ -338,7 +338,7 @@
 """
 verts is a sequence of ( verts0, verts1, ...) where verts_i is
 a sequence of xy tuples of vertices, or an equivalent
- numpy array of shape (nv,2).
+ numerix array of shape (nv,2).
 
 %(PatchCollection)s
 """
@@ -461,7 +461,7 @@
 def get_transformed_patches(self):
 # Shouldn't need all these calls to asarray;
 # the variables should be converted when stored.
- # Similar speedups with numpy should be attainable
+ # Similar speedups with numerix should be attainable
 # in many other places.
 verts = npy.asarray(self._verts)
 offsets = npy.asarray(self._offsets)
@@ -588,7 +588,7 @@
 """
 segments is a sequence of ( line0, line1, line2), where
 linen = (x0, y0), (x1, y1), ... (xm, ym), or the
- equivalent numpy array with two columns.
+ equivalent numerix array with two columns.
 Each line can be a different length.
 
 colors must be a tuple of RGBA tuples (eg arbitrary color
@@ -616,7 +616,7 @@
 
 norm = None, # optional for ScalarMappable
 cmap = None, # ditto
-
+ 
 pickradius is the tolerance for mouse clicks picking a line. The
 default is 5 pt.
 
@@ -659,7 +659,7 @@
 def contains(self, mouseevent):
 """
 Test whether the mouse event occurred in the collection.
-
+ 
 Returns T/F, dict(ind=itemlist), where every item in itemlist contains the event.
 """
 import matplotlib.lines as ML
@@ -679,7 +679,7 @@
 this_ind = ML.segment_hits(mx,my,xy[:,0],xy[:,1],self.pickradius)
 ind.extend([(this,k) for k in this_ind])
 return len(ind)>0,dict(ind=ind)
-
+ 
 def set_pickradius(self,pickradius): self.pickradius = 5
 def get_pickradius(self): return self.pickradius
 
Modified: trunk/matplotlib/lib/matplotlib/colors.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/colors.py	2007年07月19日 20:24:30 UTC (rev 3579)
+++ trunk/matplotlib/lib/matplotlib/colors.py	2007年07月20日 02:10:43 UTC (rev 3580)
@@ -432,7 +432,7 @@
 mask_bad = ma.getmask(xma)
 if xa.dtype.char in npy.typecodes['Float']:
 npy.putmask(xa, xa==1.0, 0.9999999) #Treat 1.0 as slightly less than 1.
- xa = (xa * self.N).astype(int)
+ xa = (xa * self.N).astype(npy.int)
 # Set the over-range indices before the under-range;
 # otherwise the under-range values get converted to over-range.
 npy.putmask(xa, xa>self.N-1, self._i_over)
Modified: trunk/matplotlib/lib/matplotlib/figure.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/figure.py	2007年07月19日 20:24:30 UTC (rev 3579)
+++ trunk/matplotlib/lib/matplotlib/figure.py	2007年07月20日 02:10:43 UTC (rev 3580)
@@ -16,7 +16,8 @@
 
 from legend import Legend
 from transforms import Bbox, Value, Point, get_bbox_transform, unit_bbox
-from numpy import array, clip, transpose, minimum, maximum, linspace, meshgrid
+from numerix import array, clip, transpose, minimum, maximum
+from mlab import linspace, meshgrid
 from ticker import FormatStrFormatter
 from cm import ScalarMappable
 from contour import ContourSet
Modified: trunk/matplotlib/lib/matplotlib/finance.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/finance.py	2007年07月19日 20:24:30 UTC (rev 3579)
+++ trunk/matplotlib/lib/matplotlib/finance.py	2007年07月20日 02:10:43 UTC (rev 3580)
@@ -12,8 +12,6 @@
 except ImportError:
 raise SystemExit('The finance module requires datetime support (python2.3)')
 
-import numpy as npy
-
 from matplotlib import verbose, get_configdir
 from artist import Artist
 from dates import date2num, num2date
@@ -22,6 +20,7 @@
 from matplotlib.colors import colorConverter
 from lines import Line2D, TICKLEFT, TICKRIGHT
 from patches import Rectangle
+import matplotlib.numerix as nx
 from matplotlib.transforms import scale_transform, Value, zero, one, \
 scale_sep_transform, blend_xy_sep_transform
 
@@ -77,7 +76,7 @@
 if asobject:
 if len(results)==0: return None
 else:
- date, open, close, high, low, volume = map(npy.asarray, zip(*results))
+ date, open, close, high, low, volume = map(nx.asarray, zip(*results))
 return Bunch(date=date, open=open, close=close, high=high, low=low, volume=volume)
 else:
 
@@ -378,10 +377,10 @@
 )
 closeCollection.set_transform(tickTransform)
 
- minpy, maxx = (0, len(rangeSegments))
+ minx, maxx = (0, len(rangeSegments))
 miny = min([low for low in lows if low !=-1])
 maxy = max([high for high in highs if high != -1])
- corners = (minpy, miny), (maxx, maxy)
+ corners = (minx, miny), (maxx, maxy)
 ax.update_datalim(corners)
 ax.autoscale_view()
 
@@ -467,11 +466,11 @@
 
 
 
- minpy, maxx = (0, len(rangeSegments))
+ minx, maxx = (0, len(rangeSegments))
 miny = min([low for low in lows if low !=-1])
 maxy = max([high for high in highs if high != -1])
 
- corners = (minpy, miny), (maxx, maxy)
+ corners = (minx, miny), (maxx, maxy)
 ax.update_datalim(corners)
 ax.autoscale_view()
 
@@ -534,10 +533,10 @@
 
 
 
- minpy, maxx = (0, len(offsetsBars))
+ minx, maxx = (0, len(offsetsBars))
 miny = 0
 maxy = max([v for v in volumes if v!=-1])
- corners = (minpy, miny), (maxx, maxy)
+ corners = (minx, miny), (maxx, maxy)
 ax.update_datalim(corners)
 ax.autoscale_view()
 
@@ -627,10 +626,10 @@
 
 
 
- minpy, maxx = (min(dates), max(dates))
+ minx, maxx = (min(dates), max(dates))
 miny = 0
 maxy = max([volume for d, open, close, high, low, volume in quotes])
- corners = (minpy, miny), (maxx, maxy)
+ corners = (minx, miny), (maxx, maxy)
 ax.update_datalim(corners)
 #print 'datalim', ax.dataLim.get_bounds()
 #print 'viewlim', ax.viewLim.get_bounds()
@@ -684,10 +683,10 @@
 
 
 
- minpy, maxx = (0, len(offsetsBars))
+ minx, maxx = (0, len(offsetsBars))
 miny = 0
 maxy = max([v for v in vals if v!=-1])
- corners = (minpy, miny), (maxx, maxy)
+ corners = (minx, miny), (maxx, maxy)
 ax.update_datalim(corners)
 ax.autoscale_view()
 
Modified: trunk/matplotlib/lib/matplotlib/image.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/image.py	2007年07月19日 20:24:30 UTC (rev 3579)
+++ trunk/matplotlib/lib/matplotlib/image.py	2007年07月20日 02:10:43 UTC (rev 3580)
@@ -9,8 +9,9 @@
 from artist import Artist
 from colors import colorConverter
 import cm
+import numerix
 import numerix.ma as ma
-from numpy import arange, asarray, uint8, float32, repeat, newaxis, fromstring
+from numerix import arange, asarray, UInt8, Float32, repeat, NewAxis, typecode
 import _image
 
 
@@ -116,7 +117,7 @@
 raise RuntimeError('You must first set the image array or the image attribute')
 
 if self._imcache is None:
- if self._A.dtype == uint8 and len(self._A.shape) == 3:
+ if typecode(self._A) == UInt8 and len(self._A.shape) == 3:
 im = _image.frombyte(self._A, 0)
 im.is_grayscale = False
 else:
@@ -185,7 +186,7 @@
 """Test whether the mouse event occured within the image.
 """
 if callable(self._contains): return self._contains(self,mouseevent)
- # TODO: make sure this is consistent with patch and patch
+ # TODO: make sure this is consistent with patch and patch 
 # collection on nonlinear transformed coordinates.
 # TODO: consider returning image coordinates (shouldn't
 # be too difficult given that the image is rectilinear
@@ -196,7 +197,7 @@
 inside = xdata>=xmin and xdata<=xmax and ydata>=ymin and ydata<=ymax
 else:
 inside = False
-
+ 
 return inside,{}
 
 def write_png(self, fname, noscale=False):
@@ -332,8 +333,8 @@
 return im
 
 def set_data(self, x, y, A):
- x = asarray(x,float32)
- y = asarray(y,float32)
+ x = asarray(x).astype(Float32)
+ y = asarray(y).astype(Float32)
 A = asarray(A)
 if len(x.shape) != 1 or len(y.shape) != 1\
 or A.shape[0:2] != (y.shape[0], x.shape[0]):
@@ -345,16 +346,16 @@
 if len(A.shape) == 3 and A.shape[2] == 1:
 A.shape = A.shape[0:2]
 if len(A.shape) == 2:
- if A.dtype != uint8:
- A = (self.cmap(self.norm(A))*255).astype(uint8)
+ if typecode(A) != UInt8:
+ A = (self.cmap(self.norm(A))*255).astype(UInt8)
 else:
- A = repeat(A[:,:,newaxis], 4, 2)
+ A = repeat(A[:,:,NewAxis], 4, 2)
 A[:,:,3] = 255
 else:
- if A.dtype != uint8:
- A = (255*A).astype(uint8)
+ if typecode(A) != UInt8:
+ A = (255*A).astype(UInt8)
 if A.shape[2] == 3:
- B = zeros(tuple(list(A.shape[0:2]) + [4]), uint8)
+ B = zeros(tuple(list(A.shape[0:2]) + [4]), UInt8)
 B[:,:,0:3] = A
 B[:,:,3] = 255
 A = B
@@ -427,7 +428,7 @@
 inside = xdata>=xmin and xdata<=xmax and ydata>=ymin and ydata<=ymax
 else:
 inside = False
-
+ 
 return inside,{}
 
 def get_size(self):
@@ -440,7 +441,7 @@
 def get_extent(self):
 'get the image extent: left, right, bottom, top'
 numrows, numcols = self.get_size()
- return (-0.5+self.ox, numcols-0.5+self.ox,
+ return (-0.5+self.ox, numcols-0.5+self.ox, 
 -0.5+self.oy, numrows-0.5+self.oy)
 
 def make_image(self, magnification=1.0):
@@ -476,7 +477,7 @@
 
 def imread(fname):
 """
- return image file in fname as numpy array
+ return image file in fname as numerix array
 
 Return value is a MxNx4 array of 0-1 normalized floats
 
@@ -503,6 +504,6 @@
 raise RuntimeError('Unknown image mode')
 
 x_str = im.tostring('raw',im.mode,0,-1)
- x = fromstring(x_str,uint8)
+ x = numerix.fromstring(x_str,numerix.UInt8)
 x.shape = im.size[1], im.size[0], 4
 return x
Modified: trunk/matplotlib/lib/matplotlib/legend.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/legend.py	2007年07月19日 20:24:30 UTC (rev 3579)
+++ trunk/matplotlib/lib/matplotlib/legend.py	2007年07月20日 02:10:43 UTC (rev 3580)
@@ -22,7 +22,7 @@
 """
 from __future__ import division
 import sys, warnings
-from numpy import array, ones, linspace
+from numerix import array, ones, Float
 
 
 from matplotlib import verbose, rcParams
@@ -30,7 +30,7 @@
 from cbook import enumerate, is_string_like, iterable, silent_list
 from font_manager import FontProperties
 from lines import Line2D
-from mlab import segments_intersect
+from mlab import linspace, segments_intersect
 from patches import Patch, Rectangle, RegularPolygon, Shadow, bbox_artist, draw_bbox
 from collections import LineCollection, RegularPolyCollection, PatchCollection
 from text import Text
@@ -280,7 +280,7 @@
 x, y = label.get_position()
 x -= self.handlelen + self.handletextsep
 if isinstance(handle, Line2D):
- ydata = (y-HEIGHT/2)*ones(self._xdata.shape, float)
+ ydata = (y-HEIGHT/2)*ones(self._xdata.shape, Float)
 legline = Line2D(self._xdata, ydata)
 legline.update_from(handle)
 self._set_artist_props(legline) # after update
@@ -298,7 +298,7 @@
 p.set_clip_box(None)
 ret.append(p)
 elif isinstance(handle, LineCollection):
- ydata = (y-HEIGHT/2)*ones(self._xdata.shape, float)
+ ydata = (y-HEIGHT/2)*ones(self._xdata.shape, Float)
 legline = Line2D(self._xdata, ydata)
 self._set_artist_props(legline)
 legline.set_clip_box(None)
@@ -555,7 +555,7 @@
 for handle, tup in zip(self.legendHandles, hpos):
 y,h = tup
 if isinstance(handle, Line2D):
- ydata = y*ones(self._xdata.shape, float)
+ ydata = y*ones(self._xdata.shape, Float)
 handle.set_ydata(ydata+h/2)
 elif isinstance(handle, Rectangle):
 handle.set_y(y+1/4*h)
Modified: trunk/matplotlib/lib/matplotlib/lines.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/lines.py	2007年07月19日 20:24:30 UTC (rev 3579)
+++ trunk/matplotlib/lib/matplotlib/lines.py	2007年07月20日 02:10:43 UTC (rev 3580)
@@ -9,10 +9,10 @@
 import sys, math, warnings
 
 import agg
-from numpy import alltrue, arange, array, logical_and, \
+from numerix import Float, alltrue, arange, array, logical_and, \
 nonzero, searchsorted, take, asarray, ones, where, less, ravel, \
 greater, cos, sin, pi, sqrt, less_equal, \
- compress, zeros, concatenate, cumsum, newaxis
+ compress, zeros, concatenate, cumsum, typecode, NewAxis
 import numerix.ma as ma
 from matplotlib import verbose
 import artist
@@ -64,12 +64,12 @@
 if len(i1) == 0:
 return None
 if not compressed:
- return concatenate((i0[:, newaxis], i1[:, newaxis]), axis=1)
+ return concatenate((i0[:, NewAxis], i1[:, NewAxis]), axis=1)
 seglengths = i1 - i0
 breakpoints = cumsum(seglengths)
 ic0 = concatenate(((0,), breakpoints[:-1]))
 ic1 = breakpoints
- return concatenate((ic0[:, newaxis], ic1[:, newaxis]), axis=1)
+ return concatenate((ic0[:, NewAxis], ic1[:, NewAxis]), axis=1)
 
 def segment_hits(cx,cy,x,y,radius):
 """Determine if any line segments are within radius of a point. Returns
@@ -88,7 +88,7 @@
 u = ( (cx-xr)*dx + (cy-yr)*dy )/Lnorm_sq
 candidates = (u>=0) & (u<=1)
 #if any(candidates): print "candidates",xr[candidates]
-
+ 
 # Note that there is a little area near one side of each point
 # which will be near neither segment, and another which will
 # be near both, depending on the angle of the lines. The
@@ -96,7 +96,7 @@
 point_hits = (cx - x)**2 + (cy - y)**2 <= radius**2
 #if any(point_hits): print "points",xr[candidates]
 candidates = candidates & ~point_hits[:-1] & ~point_hits[1:]
-
+ 
 # For those candidates which remain, determine how far they lie away
 # from the line.
 px,py = xr+u*dx,yr+u*dy
@@ -164,7 +164,7 @@
 else:
 return "Line2D(%s)"\
 %(",".join(["(%g,%g)"%(x,y) for x,y in zip(self._x,self._y)]))
-
+ 
 def __init__(self, xdata, ydata,
 linewidth = None, # all Nones default to rc
 linestyle = None,
@@ -274,25 +274,25 @@
 
 self.set_data(xdata, ydata)
 self._logcache = None
-
+ 
 # TODO: do we really need 'newstyle'
 self._newstyle = False
 
 def contains(self, mouseevent):
 """Test whether the mouse event occurred on the line. The pick radius determines
 the precision of the location test (usually within five points of the value). Use
- get/set pickradius() to view or modify it.
-
- Returns True if any values are within the radius along with {'ind': pointlist},
+ get/set pickradius() to view or modify it. 
+ 
+ Returns True if any values are within the radius along with {'ind': pointlist}, 
 where pointlist is the set of points within the radius.
-
+ 
 TODO: sort returned indices by distance
 """
 if callable(self._contains): return self._contains(self,mouseevent)
-
+ 
 if not is_numlike(self.pickradius):
 raise ValueError,"pick radius should be a distance"
-
+ 
 if self._newstyle:
 # transform in backend
 x = self._x
@@ -308,7 +308,7 @@
 pixels = self.pickradius
 else:
 pixels = self.figure.dpi.get()/72. * self.pickradius
-
+ 
 if self._linestyle == 'None':
 # If no line, return the nearby point(s)
 d = sqrt((xt-mouseevent.x)**2 + (yt-mouseevent.y)**2)
@@ -322,21 +322,21 @@
 print 'd', (xt-mouseevent.x)**2., (yt-mouseevent.y)**2.
 print d, pixels, ind
 return len(ind)>0,dict(ind=ind)
-
+ 
 def get_pickradius(self):
 'return the pick radius used for containment tests'
 return self.pickradius
 
- def set_pickradius(self,d):
+ def set_pickradius(self,d): 
 """Sets the pick radius used for containment tests
-
+ 
 Accepts: float distance in points.
 """
 self.pickradius = d
-
+ 
 def set_picker(self,p):
 """Sets the event picker details for the line.
-
+ 
 Accepts: float distance in points or callable pick function fn(artist,event)
 """
 if callable(p):
@@ -344,7 +344,7 @@
 else:
 self.pickradius = p
 self._picker = p
-
+ 
 def get_window_extent(self, renderer):
 self._newstyle = hasattr(renderer, 'draw_markers')
 if self._newstyle:
@@ -398,15 +398,15 @@
 def recache(self):
 #if self.axes is None: print 'recache no axes'
 #else: print 'recache units', self.axes.xaxis.units, self.axes.yaxis.units
- x = ma.asarray(self.convert_xunits(self._xorig), float)
- y = ma.asarray(self.convert_yunits(self._yorig), float)
+ x = ma.asarray(self.convert_xunits(self._xorig), Float)
+ y = ma.asarray(self.convert_yunits(self._yorig), Float)
 
 x = ma.ravel(x)
 y = ma.ravel(y)
 if len(x)==1 and len(y)>1:
- x = x * ones(y.shape, float)
+ x = x * ones(y.shape, Float)
 if len(y)==1 and len(x)>1:
- y = y * ones(x.shape, float)
+ y = y * ones(x.shape, Float)
 
 if len(x) != len(y):
 raise RuntimeError('xdata and ydata must be the same length')
@@ -421,8 +421,8 @@
 else:
 self._segments = None
 
- self._x = asarray(x, float)
- self._y = asarray(y, float)
+ self._x = asarray(x, Float)
+ self._y = asarray(y, Float)
 
 self._logcache = None
 
@@ -557,7 +557,7 @@
 else:
 return self._markerfacecolor
 
-
+ 
 def get_markersize(self): return self._markersize
 
 def get_xdata(self, orig=True):
@@ -708,9 +708,9 @@
 def _draw_steps(self, renderer, gc, xt, yt):
 siz=len(xt)
 if siz<2: return
- xt2=ones((2*siz,), xt.dtype)
+ xt2=ones((2*siz,), typecode(xt))
 xt2[0:-1:2], xt2[1:-1:2], xt2[-1]=xt, xt[1:], xt[-1]
- yt2=ones((2*siz,), yt.dtype)
+ yt2=ones((2*siz,), typecode(yt))
 yt2[0:-1:2], yt2[1::2]=yt, yt
 gc.set_linestyle('solid')
 
Modified: trunk/matplotlib/lib/matplotlib/mathtext.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mathtext.py	2007年07月19日 20:24:30 UTC (rev 3579)
+++ trunk/matplotlib/lib/matplotlib/mathtext.py	2007年07月20日 02:10:43 UTC (rev 3580)
@@ -143,6 +143,7 @@
 from matplotlib.font_manager import fontManager, FontProperties
 from matplotlib._mathtext_data import latex_to_bakoma, cmkern, \
 latex_to_standard, tex2uni, type12uni, tex2type1, uni2type1
+from matplotlib.numerix import absolute
 from matplotlib import get_data_path, rcParams
 
 # symbols that have the sub and superscripts over/under
Modified: trunk/matplotlib/lib/matplotlib/mlab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mlab.py	2007年07月19日 20:24:30 UTC (rev 3579)
+++ trunk/matplotlib/lib/matplotlib/mlab.py	2007年07月20日 02:10:43 UTC (rev 3580)
@@ -71,8 +71,8 @@
 multiply, transpose, ravel, repeat, resize, reshape, floor, ceil,\
 absolute, matrixmultiply, power, take, where, Float, Int, asum,\
 dot, convolve, pi, Complex, ones, zeros, diagonal, Matrix, nonzero, \
- log, searchsorted, concatenate, sort, ArrayType, ndarray, clip, size, indices,\
- conjugate, typecode, iscontiguous, linspace, meshgrid
+ log, searchsorted, concatenate, sort, ArrayType, clip, size, indices,\
+ conjugate, typecode, iscontiguous
 
 
 from numerix.mlab import hanning, cov, diff, svd, rand, std
@@ -93,6 +93,11 @@
 else: return numerix.mlab.mean(x, dim)
 
 
+def linspace(xmin, xmax, N):
+ if N==1: return array([xmax])
+ dx = (xmax-xmin)/(N-1)
+ return xmin + dx*arange(N)
+
 def logspace(xmin,xmax,N):
 return exp(linspace(log(xmin), log(xmax),Nh))
 
@@ -179,7 +184,7 @@
 
 
 # for real x, ignore the negative frequencies
- if npy.iscomplexobj(x): numFreqs = NFFT
+ if typecode(x)==Complex: numFreqs = NFFT
 else: numFreqs = NFFT//2+1
 
 if iterable(window):
@@ -190,7 +195,7 @@
 step = NFFT-noverlap
 ind = range(0,len(x)-NFFT+1,step)
 n = len(ind)
- Pxx = zeros((numFreqs,n), float)
+ Pxx = zeros((numFreqs,n), Float)
 # do the ffts of the slices
 for i in range(n):
 thisX = x[ind[i]:ind[i]+NFFT]
@@ -238,7 +243,7 @@
 
 if NFFT % 2:
 raise ValueError, 'NFFT must be a power of 2'
-
+ 
 x = asarray(x) # make sure we're dealing with a numpy array
 y = asarray(y) # make sure we're dealing with a numpy array
 
@@ -253,7 +258,7 @@
 y[n:] = 0
 
 # for real x, ignore the negative frequencies
- if npy.iscomplexobj(x): numFreqs = NFFT
+ if typecode(x)==Complex: numFreqs = NFFT
 else: numFreqs = NFFT//2+1
 
 if iterable(window):
@@ -264,7 +269,7 @@
 step = NFFT-noverlap
 ind = range(0,len(x)-NFFT+1,step)
 n = len(ind)
- Pxy = zeros((numFreqs,n), complex)
+ Pxy = zeros((numFreqs,n), Complex)
 
 # do the ffts of the slices
 for i in range(n):
@@ -537,7 +542,7 @@
 del seen
 
 # for real X, ignore the negative frequencies
- if npy.iscomplexobj(X): numFreqs = NFFT
+ if typecode(X)==Complex: numFreqs = NFFT
 else: numFreqs = NFFT//2+1
 
 # cache the FFT of every windowed, detrended NFFT length segement
@@ -557,7 +562,7 @@
 normVal = norm(windowVals)**2
 for iCol in allColumns:
 progressCallback(i/Ncols, 'Cacheing FFTs')
- Slices = zeros( (numSlices,numFreqs), complex)
+ Slices = zeros( (numSlices,numFreqs), Complex)
 for iSlice in slices:
 thisSlice = X[ind[iSlice]:ind[iSlice]+NFFT, iCol]
 thisSlice = windowVals*detrend(thisSlice)
@@ -613,7 +618,7 @@
 
 
 n,bins = hist(y, bins)
- n = n.astype(float)
+ n = n.astype(Float)
 
 n = take(n, nonzero(n)) # get the positive
 
@@ -686,14 +691,14 @@
 dx = x[1]-x[0]
 
 
- f = 1/(N*dx)*arange(-N/2, N/2, float)
+ f = 1/(N*dx)*arange(-N/2, N/2, Float)
 
- ind = concatenate([arange(N/2, N, int),
- arange(0, N/2, int)])
+ ind = concatenate([arange(N/2, N, Int),
+ arange(N/2,Int)])
 df = f[1]-f[0]
 cfl = exp(-gamma*absolute(2*pi*f)**alpha)
 
- px = fft(take(cfl,ind)*df).astype(float)
+ px = fft(take(cfl,ind)*df).astype(Float)
 return take(px, ind)
 
 
@@ -753,7 +758,7 @@
 if len(ind)==0: return arange(len(x))
 if len(ind)==len(x): return array([])
 
- y = zeros( (len(x)+2,), int)
+ y = zeros( (len(x)+2,), Int)
 y[1:-1] = x
 d = diff(y)
 #print 'd', d
@@ -806,7 +811,7 @@
 return x[int(p*Nx/100.0)]
 
 p = multiply(array(p), Nx/100.0)
- ind = p.astype(int)
+ ind = p.astype(Int)
 ind = where(ind>=Nx, Nx-1, ind)
 return take(x, ind)
 
@@ -841,7 +846,7 @@...
 
[truncated message content]
From: <ef...@us...> - 2007年07月20日 08:23:07
Revision: 3582
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3582&view=rev
Author: efiring
Date: 2007年07月20日 01:23:01 -0700 (2007年7月20日)
Log Message:
-----------
More numerix reversion.
Added Paths:
-----------
 trunk/matplotlib/_na_imports.py
 trunk/matplotlib/_nc_imports.py
 trunk/matplotlib/_sp_imports.py
 trunk/matplotlib/fft/
 trunk/matplotlib/fft/__init__.py
 trunk/matplotlib/linear_algebra/
 trunk/matplotlib/linear_algebra/__init__.py
 trunk/matplotlib/ma/
 trunk/matplotlib/ma/__init__.py
 trunk/matplotlib/mlab/
 trunk/matplotlib/mlab/.cvsignore
 trunk/matplotlib/mlab/__init__.py
 trunk/matplotlib/npyma/
 trunk/matplotlib/npyma/__init__.py
 trunk/matplotlib/random_array/
 trunk/matplotlib/random_array/__init__.py
Removed Paths:
-------------
 trunk/matplotlib/fft/__init__.py
 trunk/matplotlib/linear_algebra/__init__.py
 trunk/matplotlib/ma/__init__.py
 trunk/matplotlib/mlab/.cvsignore
 trunk/matplotlib/mlab/__init__.py
 trunk/matplotlib/npyma/__init__.py
 trunk/matplotlib/random_array/__init__.py
Copied: trunk/matplotlib/_na_imports.py (from rev 3573, trunk/matplotlib/lib/matplotlib/numerix/_na_imports.py)
===================================================================
--- trunk/matplotlib/_na_imports.py	 (rev 0)
+++ trunk/matplotlib/_na_imports.py	2007年07月20日 08:23:01 UTC (rev 3582)
@@ -0,0 +1,76 @@
+"""Imports from numarray for numerix, the numarray/Numeric interchangeability
+module. These array functions are used when numarray is chosen.
+"""
+from numarray import Int8, UInt8, Int16, UInt16, Int32, UInt32, \
+ Float32, Float64, Complex32, Complex64, Float, Int, Complex,\
+ typecode
+import numarray.ieeespecial as _ieee
+inf = infinity = infty = Infinity = _ieee.inf
+isnan = _ieee.isnan
+
+class _TypeNamespace:
+ """Numeric compatible type aliases for use with extension functions."""
+ Int8 = typecode[Int8]
+ UInt8 = typecode[UInt8]
+ Int16 = typecode[Int16]
+ UInt16 = typecode[UInt16]
+ Int32 = typecode[Int32]
+ #UInt32 = typecode[UInt32] # Todd: this appears broken
+ Float32 = typecode[Float32]
+ Float64 = typecode[Float64]
+ Complex32 = typecode[Complex32]
+ Complex64 = typecode[Complex64]
+
+nx = _TypeNamespace()
+
+from numarray import asarray, dot, fromlist, NumArray, shape, alltrue
+from numarray import all as _all
+
+def all(a, axis=None):
+ '''Numpy-compatible version of all()'''
+ if axis is None:
+ return _all(a)
+ return alltrue(a, axis)
+
+class _Matrix(NumArray):
+ """_Matrix is a ported, stripped down version of the Numeric Matrix
+ class which supplies only matrix multiplication.
+ """
+ def _rc(self, a):
+ if len(shape(a)) == 0:
+ return a
+ else:
+ return Matrix(a)
+
+ def __mul__(self, other):
+ aother = asarray(other)
+ #if len(aother.shape) == 0:
+ # return self._rc(self*aother)
+ #else:
+ # return self._rc(dot(self, aother))
+ #return self._rc(dot(self, aother))
+ return dot(self, aother)
+
+ def __rmul__(self, other):
+ aother = asarray(other)
+ if len(aother.shape) == 0:
+ return self._rc(aother*self)
+ else:
+ return self._rc(dot(aother, self))
+
+ def __imul__(self,other):
+ aother = asarray(other)
+ self[:] = dot(self, aother)
+ return self
+
+def Matrix(data, typecode=None, copy=1, savespace=0):
+ """Matrix constructs new matrices from 2D nested lists of numbers"""
+ if isinstance(data, type("")):
+ raise TypeError("numerix Matrix does not support Numeric matrix string notation. Use nested lists.")
+ a = fromlist(data, type=typecode)
+ if a.rank == 0:
+ a.shape = (1,1)
+ elif a.rank == 1:
+ a.shape = (1,) + a.shape
+ a.__class__ = _Matrix
+ return a
Copied: trunk/matplotlib/_nc_imports.py (from rev 3573, trunk/matplotlib/lib/matplotlib/numerix/_nc_imports.py)
===================================================================
--- trunk/matplotlib/_nc_imports.py	 (rev 0)
+++ trunk/matplotlib/_nc_imports.py	2007年07月20日 08:23:01 UTC (rev 3582)
@@ -0,0 +1,42 @@
+from Numeric import array, ravel, reshape, shape, alltrue, sometrue
+from Numeric import Int8, UInt8, Int16, UInt16, Int32, UInt32, \
+ Float32, Float64, Complex32, Complex64, Float, Int, Complex
+from numpy import isnan as _isnan
+
+class _TypeNamespace:
+ """Numeric compatible type aliases for use with extension functions."""
+ Int8 = Int8
+ UInt8 = UInt8
+ Int16 = Int16
+ UInt16 = UInt16
+ Int32 = Int32
+ UInt32 = UInt32
+ Float32 = Float32
+ Float64 = Float64
+ Complex32 = Complex32
+ Complex64 = Complex64
+
+nx = _TypeNamespace()
+
+def isnan(a):
+ """y = isnan(x) returns True where x is Not-A-Number"""
+ return reshape(array([_isnan(i) for i in ravel(a)],'b'), shape(a))
+
+def all(a, axis=None):
+ '''Numpy-compatible version of all()'''
+ if axis is None:
+ return alltrue(ravel(a))
+ else:
+ return alltrue(a, axis)
+
+def any(a, axis=None):
+ if axis is None:
+ return sometrue(ravel(a))
+ else:
+ return sometrue(a, axis)
+
+
+# inf is useful for testing infinities in results of array divisions
+# (which don't raise exceptions)
+
+inf = infty = infinity = Infinity = (array([1])/0.0)[0]
Copied: trunk/matplotlib/_sp_imports.py (from rev 3573, trunk/matplotlib/lib/matplotlib/numerix/_sp_imports.py)
===================================================================
--- trunk/matplotlib/_sp_imports.py	 (rev 0)
+++ trunk/matplotlib/_sp_imports.py	2007年07月20日 08:23:01 UTC (rev 3582)
@@ -0,0 +1,34 @@
+try:
+ from numpy.oldnumeric import Int8, UInt8, \
+ Int16, UInt16, \
+ Int32, UInt32, \
+ Float32, Float64, \
+ Complex32, Complex64, \
+ Float, Int, Complex
+except ImportError:
+ from numpy import Int8, UInt8, \
+ Int16, UInt16, \
+ Int32, UInt32, \
+ Float32, Float64, \
+ Complex32, Complex64, \
+ Float, Int, Complex
+
+class _TypeNamespace:
+ """Numeric compatible type aliases for use with extension functions."""
+ Int8 = Int8
+ UInt8 = UInt8
+ Int16 = Int16
+ UInt16 = UInt16
+ Int32 = Int32
+ UInt32 = UInt32
+ Float32 = Float32
+ Float64 = Float64
+ Complex32 = Complex32
+ Complex64 = Complex64
+
+nx = _TypeNamespace()
+
+from numpy import inf, infty, Infinity
+from numpy.random import rand, randn
+infinity = Infinity
+from numpy import all, isnan, any
Copied: trunk/matplotlib/fft (from rev 3573, trunk/matplotlib/lib/matplotlib/numerix/fft)
Deleted: trunk/matplotlib/fft/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/fft/__init__.py	2007年07月19日 03:53:37 UTC (rev 3573)
+++ trunk/matplotlib/fft/__init__.py	2007年07月20日 08:23:01 UTC (rev 3582)
@@ -1,13 +0,0 @@
-from matplotlib.numerix import which
-
-if which[0] == "numarray":
- from numarray.fft import *
-elif which[0] == "numeric":
- from FFT import *
-elif which[0] == "numpy":
- try:
- from numpy.oldnumeric.fft import *
- except ImportError:
- from numpy.dft.old import *
-else:
- raise RuntimeError("invalid numerix selector")
Copied: trunk/matplotlib/fft/__init__.py (from rev 3573, trunk/matplotlib/lib/matplotlib/numerix/fft/__init__.py)
===================================================================
--- trunk/matplotlib/fft/__init__.py	 (rev 0)
+++ trunk/matplotlib/fft/__init__.py	2007年07月20日 08:23:01 UTC (rev 3582)
@@ -0,0 +1,13 @@
+from matplotlib.numerix import which
+
+if which[0] == "numarray":
+ from numarray.fft import *
+elif which[0] == "numeric":
+ from FFT import *
+elif which[0] == "numpy":
+ try:
+ from numpy.oldnumeric.fft import *
+ except ImportError:
+ from numpy.dft.old import *
+else:
+ raise RuntimeError("invalid numerix selector")
Copied: trunk/matplotlib/linear_algebra (from rev 3573, trunk/matplotlib/lib/matplotlib/numerix/linear_algebra)
Deleted: trunk/matplotlib/linear_algebra/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/linear_algebra/__init__.py	2007年07月19日 03:53:37 UTC (rev 3573)
+++ trunk/matplotlib/linear_algebra/__init__.py	2007年07月20日 08:23:01 UTC (rev 3582)
@@ -1,13 +0,0 @@
-from matplotlib.numerix import which
-
-if which[0] == "numarray":
- from numarray.linear_algebra import *
-elif which[0] == "numeric":
- from LinearAlgebra import *
-elif which[0] == "numpy":
- try:
- from numpy.oldnumeric.linear_algebra import *
- except ImportError:
- from numpy.linalg.old import *
-else:
- raise RuntimeError("invalid numerix selector")
Copied: trunk/matplotlib/linear_algebra/__init__.py (from rev 3573, trunk/matplotlib/lib/matplotlib/numerix/linear_algebra/__init__.py)
===================================================================
--- trunk/matplotlib/linear_algebra/__init__.py	 (rev 0)
+++ trunk/matplotlib/linear_algebra/__init__.py	2007年07月20日 08:23:01 UTC (rev 3582)
@@ -0,0 +1,13 @@
+from matplotlib.numerix import which
+
+if which[0] == "numarray":
+ from numarray.linear_algebra import *
+elif which[0] == "numeric":
+ from LinearAlgebra import *
+elif which[0] == "numpy":
+ try:
+ from numpy.oldnumeric.linear_algebra import *
+ except ImportError:
+ from numpy.linalg.old import *
+else:
+ raise RuntimeError("invalid numerix selector")
Copied: trunk/matplotlib/ma (from rev 3573, trunk/matplotlib/lib/matplotlib/numerix/ma)
Deleted: trunk/matplotlib/ma/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/ma/__init__.py	2007年07月19日 03:53:37 UTC (rev 3573)
+++ trunk/matplotlib/ma/__init__.py	2007年07月20日 08:23:01 UTC (rev 3582)
@@ -1,24 +0,0 @@
-from matplotlib.numerix import which, use_maskedarray
-
-if which[0] == "numarray":
- from numarray.ma import *
- nomask = None
- getmaskorNone = getmask
-elif which[0] == "numeric":
- from MA import *
- nomask = None
- getmaskorNone = getmask
-elif which[0] == "numpy":
- if use_maskedarray:
- from maskedarray import *
- print "using maskedarray"
- else:
- from numpy.core.ma import *
- #print "using ma"
- def getmaskorNone(obj):
- _msk = getmask(obj)
- if _msk is nomask:
- return None
- return _msk
-else:
- raise RuntimeError("invalid numerix selector")
Copied: trunk/matplotlib/ma/__init__.py (from rev 3573, trunk/matplotlib/lib/matplotlib/numerix/ma/__init__.py)
===================================================================
--- trunk/matplotlib/ma/__init__.py	 (rev 0)
+++ trunk/matplotlib/ma/__init__.py	2007年07月20日 08:23:01 UTC (rev 3582)
@@ -0,0 +1,24 @@
+from matplotlib.numerix import which, use_maskedarray
+
+if which[0] == "numarray":
+ from numarray.ma import *
+ nomask = None
+ getmaskorNone = getmask
+elif which[0] == "numeric":
+ from MA import *
+ nomask = None
+ getmaskorNone = getmask
+elif which[0] == "numpy":
+ if use_maskedarray:
+ from maskedarray import *
+ print "using maskedarray"
+ else:
+ from numpy.core.ma import *
+ #print "using ma"
+ def getmaskorNone(obj):
+ _msk = getmask(obj)
+ if _msk is nomask:
+ return None
+ return _msk
+else:
+ raise RuntimeError("invalid numerix selector")
Copied: trunk/matplotlib/mlab (from rev 3573, trunk/matplotlib/lib/matplotlib/numerix/mlab)
Property changes on: trunk/matplotlib/mlab
___________________________________________________________________
Name: svn:ignore
 + *.pyc
Deleted: trunk/matplotlib/mlab/.cvsignore
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/mlab/.cvsignore	2007年07月19日 03:53:37 UTC (rev 3573)
+++ trunk/matplotlib/mlab/.cvsignore	2007年07月20日 08:23:01 UTC (rev 3582)
@@ -1 +0,0 @@
-*.pyc
Copied: trunk/matplotlib/mlab/.cvsignore (from rev 3573, trunk/matplotlib/lib/matplotlib/numerix/mlab/.cvsignore)
===================================================================
--- trunk/matplotlib/mlab/.cvsignore	 (rev 0)
+++ trunk/matplotlib/mlab/.cvsignore	2007年07月20日 08:23:01 UTC (rev 3582)
@@ -0,0 +1 @@
+*.pyc
Deleted: trunk/matplotlib/mlab/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/mlab/__init__.py	2007年07月19日 03:53:37 UTC (rev 3573)
+++ trunk/matplotlib/mlab/__init__.py	2007年07月20日 08:23:01 UTC (rev 3582)
@@ -1,16 +0,0 @@
-from matplotlib.numerix import which
-
-if which[0] == "numarray":
- from numarray.linear_algebra.mlab import *
-elif which[0] == "numeric":
- from MLab import *
-elif which[0] == "numpy":
- try:
- from numpy.oldnumeric.mlab import *
- except ImportError:
- from numpy.lib.mlab import *
-else:
- raise RuntimeError("invalid numerix selector")
-
-amin = min
-amax = max
Copied: trunk/matplotlib/mlab/__init__.py (from rev 3573, trunk/matplotlib/lib/matplotlib/numerix/mlab/__init__.py)
===================================================================
--- trunk/matplotlib/mlab/__init__.py	 (rev 0)
+++ trunk/matplotlib/mlab/__init__.py	2007年07月20日 08:23:01 UTC (rev 3582)
@@ -0,0 +1,16 @@
+from matplotlib.numerix import which
+
+if which[0] == "numarray":
+ from numarray.linear_algebra.mlab import *
+elif which[0] == "numeric":
+ from MLab import *
+elif which[0] == "numpy":
+ try:
+ from numpy.oldnumeric.mlab import *
+ except ImportError:
+ from numpy.lib.mlab import *
+else:
+ raise RuntimeError("invalid numerix selector")
+
+amin = min
+amax = max
Copied: trunk/matplotlib/npyma (from rev 3573, trunk/matplotlib/lib/matplotlib/numerix/npyma)
Deleted: trunk/matplotlib/npyma/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/npyma/__init__.py	2007年07月19日 03:53:37 UTC (rev 3573)
+++ trunk/matplotlib/npyma/__init__.py	2007年07月20日 08:23:01 UTC (rev 3582)
@@ -1,8 +0,0 @@
-from matplotlib.numerix import use_maskedarray
-
-if use_maskedarray:
- from maskedarray import *
- print "using maskedarray"
-else:
- from numpy.core.ma import *
- #print "using ma"
Copied: trunk/matplotlib/npyma/__init__.py (from rev 3573, trunk/matplotlib/lib/matplotlib/numerix/npyma/__init__.py)
===================================================================
--- trunk/matplotlib/npyma/__init__.py	 (rev 0)
+++ trunk/matplotlib/npyma/__init__.py	2007年07月20日 08:23:01 UTC (rev 3582)
@@ -0,0 +1,8 @@
+from matplotlib.numerix import use_maskedarray
+
+if use_maskedarray:
+ from maskedarray import *
+ print "using maskedarray"
+else:
+ from numpy.core.ma import *
+ #print "using ma"
Copied: trunk/matplotlib/random_array (from rev 3573, trunk/matplotlib/lib/matplotlib/numerix/random_array)
Deleted: trunk/matplotlib/random_array/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/numerix/random_array/__init__.py	2007年07月19日 03:53:37 UTC (rev 3573)
+++ trunk/matplotlib/random_array/__init__.py	2007年07月20日 08:23:01 UTC (rev 3582)
@@ -1,13 +0,0 @@
-from matplotlib.numerix import which
-
-if which[0] == "numarray":
- from numarray.random_array import *
-elif which[0] == "numeric":
- from RandomArray import *
-elif which[0] == "numpy":
- try:
- from numpy.oldnumeric.random_array import *
- except ImportError:
- from numpy.random import *
-else:
- raise RuntimeError("invalid numerix selector")
Copied: trunk/matplotlib/random_array/__init__.py (from rev 3573, trunk/matplotlib/lib/matplotlib/numerix/random_array/__init__.py)
===================================================================
--- trunk/matplotlib/random_array/__init__.py	 (rev 0)
+++ trunk/matplotlib/random_array/__init__.py	2007年07月20日 08:23:01 UTC (rev 3582)
@@ -0,0 +1,13 @@
+from matplotlib.numerix import which
+
+if which[0] == "numarray":
+ from numarray.random_array import *
+elif which[0] == "numeric":
+ from RandomArray import *
+elif which[0] == "numpy":
+ try:
+ from numpy.oldnumeric.random_array import *
+ except ImportError:
+ from numpy.random import *
+else:
+ raise RuntimeError("invalid numerix selector")
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2007年07月20日 08:49:03
Revision: 3583
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3583&view=rev
Author: efiring
Date: 2007年07月20日 01:49:00 -0700 (2007年7月20日)
Log Message:
-----------
Reversed last commit
Removed Paths:
-------------
 trunk/matplotlib/_na_imports.py
 trunk/matplotlib/_nc_imports.py
 trunk/matplotlib/_sp_imports.py
 trunk/matplotlib/fft/
 trunk/matplotlib/linear_algebra/
 trunk/matplotlib/ma/
 trunk/matplotlib/mlab/
 trunk/matplotlib/npyma/
 trunk/matplotlib/random_array/
Deleted: trunk/matplotlib/_na_imports.py
===================================================================
--- trunk/matplotlib/_na_imports.py	2007年07月20日 08:23:01 UTC (rev 3582)
+++ trunk/matplotlib/_na_imports.py	2007年07月20日 08:49:00 UTC (rev 3583)
@@ -1,76 +0,0 @@
-"""Imports from numarray for numerix, the numarray/Numeric interchangeability
-module. These array functions are used when numarray is chosen.
-"""
-from numarray import Int8, UInt8, Int16, UInt16, Int32, UInt32, \
- Float32, Float64, Complex32, Complex64, Float, Int, Complex,\
- typecode
-import numarray.ieeespecial as _ieee
-inf = infinity = infty = Infinity = _ieee.inf
-isnan = _ieee.isnan
-
-class _TypeNamespace:
- """Numeric compatible type aliases for use with extension functions."""
- Int8 = typecode[Int8]
- UInt8 = typecode[UInt8]
- Int16 = typecode[Int16]
- UInt16 = typecode[UInt16]
- Int32 = typecode[Int32]
- #UInt32 = typecode[UInt32] # Todd: this appears broken
- Float32 = typecode[Float32]
- Float64 = typecode[Float64]
- Complex32 = typecode[Complex32]
- Complex64 = typecode[Complex64]
-
-nx = _TypeNamespace()
-
-from numarray import asarray, dot, fromlist, NumArray, shape, alltrue
-from numarray import all as _all
-
-def all(a, axis=None):
- '''Numpy-compatible version of all()'''
- if axis is None:
- return _all(a)
- return alltrue(a, axis)
-
-class _Matrix(NumArray):
- """_Matrix is a ported, stripped down version of the Numeric Matrix
- class which supplies only matrix multiplication.
- """
- def _rc(self, a):
- if len(shape(a)) == 0:
- return a
- else:
- return Matrix(a)
-
- def __mul__(self, other):
- aother = asarray(other)
- #if len(aother.shape) == 0:
- # return self._rc(self*aother)
- #else:
- # return self._rc(dot(self, aother))
- #return self._rc(dot(self, aother))
- return dot(self, aother)
-
- def __rmul__(self, other):
- aother = asarray(other)
- if len(aother.shape) == 0:
- return self._rc(aother*self)
- else:
- return self._rc(dot(aother, self))
-
- def __imul__(self,other):
- aother = asarray(other)
- self[:] = dot(self, aother)
- return self
-
-def Matrix(data, typecode=None, copy=1, savespace=0):
- """Matrix constructs new matrices from 2D nested lists of numbers"""
- if isinstance(data, type("")):
- raise TypeError("numerix Matrix does not support Numeric matrix string notation. Use nested lists.")
- a = fromlist(data, type=typecode)
- if a.rank == 0:
- a.shape = (1,1)
- elif a.rank == 1:
- a.shape = (1,) + a.shape
- a.__class__ = _Matrix
- return a
Deleted: trunk/matplotlib/_nc_imports.py
===================================================================
--- trunk/matplotlib/_nc_imports.py	2007年07月20日 08:23:01 UTC (rev 3582)
+++ trunk/matplotlib/_nc_imports.py	2007年07月20日 08:49:00 UTC (rev 3583)
@@ -1,42 +0,0 @@
-from Numeric import array, ravel, reshape, shape, alltrue, sometrue
-from Numeric import Int8, UInt8, Int16, UInt16, Int32, UInt32, \
- Float32, Float64, Complex32, Complex64, Float, Int, Complex
-from numpy import isnan as _isnan
-
-class _TypeNamespace:
- """Numeric compatible type aliases for use with extension functions."""
- Int8 = Int8
- UInt8 = UInt8
- Int16 = Int16
- UInt16 = UInt16
- Int32 = Int32
- UInt32 = UInt32
- Float32 = Float32
- Float64 = Float64
- Complex32 = Complex32
- Complex64 = Complex64
-
-nx = _TypeNamespace()
-
-def isnan(a):
- """y = isnan(x) returns True where x is Not-A-Number"""
- return reshape(array([_isnan(i) for i in ravel(a)],'b'), shape(a))
-
-def all(a, axis=None):
- '''Numpy-compatible version of all()'''
- if axis is None:
- return alltrue(ravel(a))
- else:
- return alltrue(a, axis)
-
-def any(a, axis=None):
- if axis is None:
- return sometrue(ravel(a))
- else:
- return sometrue(a, axis)
-
-
-# inf is useful for testing infinities in results of array divisions
-# (which don't raise exceptions)
-
-inf = infty = infinity = Infinity = (array([1])/0.0)[0]
Deleted: trunk/matplotlib/_sp_imports.py
===================================================================
--- trunk/matplotlib/_sp_imports.py	2007年07月20日 08:23:01 UTC (rev 3582)
+++ trunk/matplotlib/_sp_imports.py	2007年07月20日 08:49:00 UTC (rev 3583)
@@ -1,34 +0,0 @@
-try:
- from numpy.oldnumeric import Int8, UInt8, \
- Int16, UInt16, \
- Int32, UInt32, \
- Float32, Float64, \
- Complex32, Complex64, \
- Float, Int, Complex
-except ImportError:
- from numpy import Int8, UInt8, \
- Int16, UInt16, \
- Int32, UInt32, \
- Float32, Float64, \
- Complex32, Complex64, \
- Float, Int, Complex
-
-class _TypeNamespace:
- """Numeric compatible type aliases for use with extension functions."""
- Int8 = Int8
- UInt8 = UInt8
- Int16 = Int16
- UInt16 = UInt16
- Int32 = Int32
- UInt32 = UInt32
- Float32 = Float32
- Float64 = Float64
- Complex32 = Complex32
- Complex64 = Complex64
-
-nx = _TypeNamespace()
-
-from numpy import inf, infty, Infinity
-from numpy.random import rand, randn
-infinity = Infinity
-from numpy import all, isnan, any
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2007年07月20日 18:35:40
Revision: 3596
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3596&view=rev
Author: efiring
Date: 2007年07月20日 11:35:35 -0700 (2007年7月20日)
Log Message:
-----------
examples/* updates from Stefan van der Walt
Modified Paths:
--------------
 trunk/matplotlib/examples/animation_blit_wx.py
 trunk/matplotlib/examples/arrow_demo.py
 trunk/matplotlib/examples/dynamic_demo_wx.py
 trunk/matplotlib/examples/dynamic_image_wxagg2.py
 trunk/matplotlib/examples/embedding_in_wx.py
 trunk/matplotlib/examples/embedding_in_wx2.py
 trunk/matplotlib/examples/embedding_in_wx3.py
 trunk/matplotlib/examples/embedding_in_wx4.py
 trunk/matplotlib/examples/interactive.py
 trunk/matplotlib/examples/interactive2.py
 trunk/matplotlib/examples/mpl_with_glade.py
 trunk/matplotlib/examples/simple3d_oo.py
 trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/examples/animation_blit_wx.py
===================================================================
--- trunk/matplotlib/examples/animation_blit_wx.py	2007年07月20日 16:00:40 UTC (rev 3595)
+++ trunk/matplotlib/examples/animation_blit_wx.py	2007年07月20日 18:35:35 UTC (rev 3596)
@@ -7,7 +7,7 @@
 
 import matplotlib
 matplotlib.use('WXAgg')
-matplotlib.rcParams['toolbar'] = None
+matplotlib.rcParams['toolbar'] = 'None'
 
 import wx
 import sys
Modified: trunk/matplotlib/examples/arrow_demo.py
===================================================================
--- trunk/matplotlib/examples/arrow_demo.py	2007年07月20日 16:00:40 UTC (rev 3595)
+++ trunk/matplotlib/examples/arrow_demo.py	2007年07月20日 18:35:35 UTC (rev 3596)
@@ -205,7 +205,7 @@
 
 
 M = array([[cx, sx],[-sx,cx]])
- coords = matrixmultiply(orig_position, M) + [[x_pos, y_pos]]
+ coords = dot(orig_position, M) + [[x_pos, y_pos]]
 x, y = ravel(coords)
 orig_label = rate_labels[pair]
 label = '$%s_{_{\mathrm{%s}}}$' % (orig_label[0], orig_label[1:])
Modified: trunk/matplotlib/examples/dynamic_demo_wx.py
===================================================================
--- trunk/matplotlib/examples/dynamic_demo_wx.py	2007年07月20日 16:00:40 UTC (rev 3595)
+++ trunk/matplotlib/examples/dynamic_demo_wx.py	2007年07月20日 18:35:35 UTC (rev 3596)
@@ -64,15 +64,15 @@
 from matplotlib.figure import Figure
 from matplotlib.axes import Subplot
 import matplotlib.numerix as numpy
-from wxPython.wx import *
+from wx import *
 
 
-TIMER_ID = wxNewId()
+TIMER_ID = NewId()
 
-class PlotFigure(wxFrame):
+class PlotFigure(Frame):
 
 def __init__(self):
- wxFrame.__init__(self, None, -1, "Test embedded wxFigure")
+ Frame.__init__(self, None, -1, "Test embedded wxFigure")
 
 self.fig = Figure((5,4), 75)
 self.canvas = FigureCanvasWx(self, -1, self.fig)
@@ -83,16 +83,16 @@
 # you don't need this under Linux
 tw, th = self.toolbar.GetSizeTuple()
 fw, fh = self.canvas.GetSizeTuple()
- self.toolbar.SetSize(wxSize(fw, th))
+ self.toolbar.SetSize(Size(fw, th))
 
 # Create a figure manager to manage things
 self.figmgr = FigureManager(self.canvas, 1, self)
 # Now put all into a sizer
- sizer = wxBoxSizer(wxVERTICAL)
+ sizer = BoxSizer(VERTICAL)
 # This way of adding to sizer allows resizing
- sizer.Add(self.canvas, 1, wxLEFT|wxTOP|wxGROW)
+ sizer.Add(self.canvas, 1, LEFT|TOP|GROW)
 # Best to allow the toolbar to resize!
- sizer.Add(self.toolbar, 0, wxGROW)
+ sizer.Add(self.toolbar, 0, GROW)
 self.SetSizer(sizer)
 self.Fit()
 EVT_TIMER(self, TIMER_ID, self.onTimer)
@@ -120,13 +120,13 @@
 self.canvas.gui_repaint()
 
 if __name__ == '__main__':
- app = wxPySimpleApp()
+ app = PySimpleApp()
 frame = PlotFigure()
 frame.init_plot_data()
 
 # Initialise the timer - wxPython requires this to be connected to the
 # receivicng event handler
- t = wxTimer(frame, TIMER_ID)
+ t = Timer(frame, TIMER_ID)
 t.Start(100)
 
 frame.Show()
Modified: trunk/matplotlib/examples/dynamic_image_wxagg2.py
===================================================================
--- trunk/matplotlib/examples/dynamic_image_wxagg2.py	2007年07月20日 16:00:40 UTC (rev 3595)
+++ trunk/matplotlib/examples/dynamic_image_wxagg2.py	2007年07月20日 18:35:35 UTC (rev 3596)
@@ -18,9 +18,8 @@
 # numerix=numarray, it is important to compile matplotlib for numarray
 # by setting NUMERIX = 'numarray' in setup.py before building
 from matplotlib import rcParams
-rcParams['numerix'] = 'numarray'
+import numpy as npy
 
-
 # jdh: you can import cm directly, you don't need to go via
 # pylab
 import matplotlib.cm as cm
@@ -32,16 +31,15 @@
 # designed for the pylab interface
 
 from matplotlib.figure import Figure
-import matplotlib.numerix as numerix
-from wxPython.wx import *
+from wx import *
 
 
-TIMER_ID = wxNewId()
+TIMER_ID = NewId()
 
-class PlotFigure(wxFrame):
+class PlotFigure(Frame):
 
 def __init__(self):
- wxFrame.__init__(self, None, -1, "Test embedded wxFigure")
+ Frame.__init__(self, None, -1, "Test embedded wxFigure")
 
 self.fig = Figure((5,4), 75)
 self.canvas = FigureCanvasWxAgg(self, -1, self.fig)
@@ -52,16 +50,16 @@
 # you don't need this under Linux
 tw, th = self.toolbar.GetSizeTuple()
 fw, fh = self.canvas.GetSizeTuple()
- self.toolbar.SetSize(wxSize(fw, th))
+ self.toolbar.SetSize(Size(fw, th))
 
 # Create a figure manager to manage things
 
 # Now put all into a sizer
- sizer = wxBoxSizer(wxVERTICAL)
+ sizer = BoxSizer(VERTICAL)
 # This way of adding to sizer allows resizing
- sizer.Add(self.canvas, 1, wxLEFT|wxTOP|wxGROW)
+ sizer.Add(self.canvas, 1, LEFT|TOP|GROW)
 # Best to allow the toolbar to resize!
- sizer.Add(self.toolbar, 0, wxGROW)
+ sizer.Add(self.toolbar, 0, GROW)
 self.SetSizer(sizer)
 self.Fit()
 EVT_TIMER(self, TIMER_ID, self.onTimer)
@@ -71,12 +69,12 @@
 # the fig manager
 a = self.fig.add_axes([0.075,0.1,0.75,0.85])
 cax = self.fig.add_axes([0.85,0.1,0.075,0.85])
- self.x = numerix.arange(120.0)*2*numerix.pi/120.0
- self.x.resize((100,120))
- self.y = numerix.arange(100.0)*2*numerix.pi/100.0
- self.y.resize((120,100))
- self.y = numerix.transpose(self.y)
- z = numerix.sin(self.x) + numerix.cos(self.y)
+ self.x = npy.empty((120,120))
+ self.x.flat = npy.arange(120.0)*2*npy.pi/120.0
+ self.y = npy.empty((120,120))
+ self.y.flat = npy.arange(120.0)*2*npy.pi/100.0
+ self.y = npy.transpose(self.y)
+ z = npy.sin(self.x) + npy.cos(self.y)
 self.im = a.imshow( z, cmap=cm.jet)#, interpolation='nearest')
 self.fig.colorbar(self.im,cax=cax,orientation='vertical')
 
@@ -86,9 +84,9 @@
 return self.toolbar
 
 def onTimer(self, evt):
- self.x += numerix.pi/15
- self.y += numerix.pi/20
- z = numerix.sin(self.x) + numerix.cos(self.y)
+ self.x += npy.pi/15
+ self.y += npy.pi/20
+ z = npy.sin(self.x) + npy.cos(self.y)
 self.im.set_array(z)
 self.canvas.draw()
 #self.canvas.gui_repaint() # jdh wxagg_draw calls this already
@@ -98,13 +96,13 @@
 pass
 
 if __name__ == '__main__':
- app = wxPySimpleApp()
+ app = PySimpleApp()
 frame = PlotFigure()
 frame.init_plot_data()
 
 # Initialise the timer - wxPython requires this to be connected to
 # the receiving event handler
- t = wxTimer(frame, TIMER_ID)
+ t = Timer(frame, TIMER_ID)
 t.Start(200)
 
 frame.Show()
Modified: trunk/matplotlib/examples/embedding_in_wx.py
===================================================================
--- trunk/matplotlib/examples/embedding_in_wx.py	2007年07月20日 16:00:40 UTC (rev 3595)
+++ trunk/matplotlib/examples/embedding_in_wx.py	2007年07月20日 18:35:35 UTC (rev 3596)
@@ -45,13 +45,13 @@
 from matplotlib.figure import Figure
 from matplotlib.axes import Subplot
 import matplotlib.numerix as numpy
-from wxPython.wx import *
+from wx import *
 
 
 
-class PlotFigure(wxFrame):
+class PlotFigure(Frame):
 def __init__(self):
- wxFrame.__init__(self, None, -1, "Test embedded wxFigure")
+ Frame.__init__(self, None, -1, "Test embedded wxFigure")
 
 self.fig = Figure((9,8), 75)
 self.canvas = FigureCanvasWx(self, -1, self.fig)
@@ -62,16 +62,16 @@
 # you don't need this under Linux
 tw, th = self.toolbar.GetSizeTuple()
 fw, fh = self.canvas.GetSizeTuple()
- self.toolbar.SetSize(wxSize(fw, th))
+ self.toolbar.SetSize(Size(fw, th))
 
 # Create a figure manager to manage things
 self.figmgr = FigureManager(self.canvas, 1, self)
 # Now put all into a sizer
- sizer = wxBoxSizer(wxVERTICAL)
+ sizer = BoxSizer(VERTICAL)
 # This way of adding to sizer allows resizing
- sizer.Add(self.canvas, 1, wxLEFT|wxTOP|wxGROW)
+ sizer.Add(self.canvas, 1, LEFT|TOP|GROW)
 # Best to allow the toolbar to resize!
- sizer.Add(self.toolbar, 0, wxGROW)
+ sizer.Add(self.toolbar, 0, GROW)
 self.SetSizer(sizer)
 self.Fit()
 
@@ -95,7 +95,7 @@
 return self.toolbar
 
 if __name__ == '__main__':
- app = wxPySimpleApp(0)
+ app = PySimpleApp(0)
 frame = PlotFigure()
 frame.plot_data()
 frame.Show()
Modified: trunk/matplotlib/examples/embedding_in_wx2.py
===================================================================
--- trunk/matplotlib/examples/embedding_in_wx2.py	2007年07月20日 16:00:40 UTC (rev 3595)
+++ trunk/matplotlib/examples/embedding_in_wx2.py	2007年07月20日 18:35:35 UTC (rev 3596)
@@ -19,15 +19,15 @@
 
 from matplotlib.figure import Figure
 
-from wxPython.wx import *
+from wx import *
 
-class CanvasFrame(wxFrame):
+class CanvasFrame(Frame):
 
 def __init__(self):
- wxFrame.__init__(self,None,-1,
+ Frame.__init__(self,None,-1,
 'CanvasFrame',size=(550,350))
 
- self.SetBackgroundColour(wxNamedColor("WHITE"))
+ self.SetBackgroundColour(NamedColor("WHITE"))
 
 self.figure = Figure()
 self.axes = self.figure.add_subplot(111)
@@ -37,8 +37,8 @@
 self.axes.plot(t,s)
 self.canvas = FigureCanvas(self, -1, self.figure)
 
- self.sizer = wxBoxSizer(wxVERTICAL)
- self.sizer.Add(self.canvas, 1, wxLEFT | wxTOP | wxGROW)
+ self.sizer = BoxSizer(VERTICAL)
+ self.sizer.Add(self.canvas, 1, LEFT | TOP | GROW)
 self.SetSizer(self.sizer)
 self.Fit()
 
@@ -48,7 +48,7 @@
 def add_toolbar(self):
 self.toolbar = NavigationToolbar2Wx(self.canvas)
 self.toolbar.Realize()
- if wxPlatform == '__WXMAC__':
+ if Platform == '__WXMAC__':
 # Mac platform (OSX 10.3, MacPython) does not seem to cope with
 # having a toolbar in a sizer. This work-around gets the buttons
 # back, but at the expense of having the toolbar at the top
@@ -61,8 +61,8 @@
 # By adding toolbar in sizer, we are able to put it at the bottom
 # of the frame - so appearance is closer to GTK version.
 # As noted above, doesn't work for Mac.
- self.toolbar.SetSize(wxSize(fw, th))
- self.sizer.Add(self.toolbar, 0, wxLEFT | wxEXPAND)
+ self.toolbar.SetSize(Size(fw, th))
+ self.sizer.Add(self.toolbar, 0, LEFT | EXPAND)
 # update the axes menu on the toolbar
 self.toolbar.update()
 
@@ -70,14 +70,14 @@
 def OnPaint(self, event):
 self.canvas.draw()
 
-class App(wxApp):
+class App(App):
 
 def OnInit(self):
 'Create the main window and insert the custom frame'
 frame = CanvasFrame()
- frame.Show(true)
+ frame.Show(True)
 
- return true
+ return True
 
 app = App(0)
 app.MainLoop()
Modified: trunk/matplotlib/examples/embedding_in_wx3.py
===================================================================
--- trunk/matplotlib/examples/embedding_in_wx3.py	2007年07月20日 16:00:40 UTC (rev 3595)
+++ trunk/matplotlib/examples/embedding_in_wx3.py	2007年07月20日 18:35:35 UTC (rev 3596)
@@ -21,27 +21,25 @@
 import sys, time, os, gc
 import matplotlib
 matplotlib.use('WXAgg')
-# some of this code is numarray dependent
-matplotlib.rcParams['numerix'] = 'numarray'
 import matplotlib.cm as cm
 from matplotlib.backends.backend_wxagg import Toolbar, FigureCanvasWxAgg
 from matplotlib.figure import Figure
-import matplotlib.numerix as numerix
+import numpy as npy
 import matplotlib.numerix.mlab as mlab
 from matplotlib.mlab import meshgrid
 
-from wxPython.wx import *
-from wxPython.xrc import *
+from wx import *
+from wx.xrc import *
 
 ERR_TOL = 1e-5 # floating point slop for peak-detection
 
 
 matplotlib.rc('image', origin='lower')
 
-class PlotPanel(wxPanel):
+class PlotPanel(Panel):
 
 def __init__(self, parent):
- wxPanel.__init__(self, parent, -1)
+ Panel.__init__(self, parent, -1)
 
 self.fig = Figure((5,4), 75)
 self.canvas = FigureCanvasWxAgg(self, -1, self.fig)
@@ -50,27 +48,25 @@
 #self.toolbar.set_active([0,1])
 
 # Now put all into a sizer
- sizer = wxBoxSizer(wxVERTICAL)
+ sizer = BoxSizer(VERTICAL)
 # This way of adding to sizer allows resizing
- sizer.Add(self.canvas, 1, wxLEFT|wxTOP|wxGROW)
+ sizer.Add(self.canvas, 1, LEFT|TOP|GROW)
 # Best to allow the toolbar to resize!
- sizer.Add(self.toolbar, 0, wxGROW)
+ sizer.Add(self.toolbar, 0, GROW)
 self.SetSizer(sizer)
 self.Fit()
 
 def init_plot_data(self):
 a = self.fig.add_subplot(111)
 
- x = numerix.arange(120.0)*2*numerix.pi/60.0
- y = numerix.arange(100.0)*2*numerix.pi/50.0
+ x = npy.arange(120.0)*2*npy.pi/60.0
+ y = npy.arange(100.0)*2*npy.pi/50.0
 self.x, self.y = meshgrid(x, y)
- z = numerix.sin(self.x) + numerix.cos(self.y)
+ z = npy.sin(self.x) + npy.cos(self.y)
 self.im = a.imshow( z, cmap=cm.jet)#, interpolation='nearest')
 
 zmax = mlab.max(mlab.max(z))-ERR_TOL
-
- ymax_i, xmax_i = numerix.nonzero(
- numerix.greater_equal(z, zmax))
+ ymax_i, xmax_i = npy.nonzero(z >= zmax)
 if self.im.origin == 'upper':
 ymax_i = z.shape[0]-ymax_i
 self.lines = a.plot(xmax_i,ymax_i,'ko')
@@ -83,14 +79,13 @@
 return self.toolbar
 
 def OnWhiz(self,evt):
- self.x += numerix.pi/15
- self.y += numerix.pi/20
- z = numerix.sin(self.x) + numerix.cos(self.y)
+ self.x += npy.pi/15
+ self.y += npy.pi/20
+ z = npy.sin(self.x) + npy.cos(self.y)
 self.im.set_array(z)
 
 zmax = mlab.max(mlab.max(z))-ERR_TOL
- ymax_i, xmax_i = numerix.nonzero(
- numerix.greater_equal(z, zmax))
+ ymax_i, xmax_i = npy.nonzero(z >= zmax)
 if self.im.origin == 'upper':
 ymax_i = z.shape[0]-ymax_i
 self.lines[0].set_data(xmax_i,ymax_i)
@@ -101,9 +96,9 @@
 # this is supposed to prevent redraw flicker on some X servers...
 pass
 
-class MyApp(wxApp):
+class MyApp(App):
 def OnInit(self):
- self.res = wxXmlResource("data/embedding_in_wx3.xrc")
+ self.res = XmlResource("data/embedding_in_wx3.xrc")
 
 # main frame and panel ---------
 
@@ -115,14 +110,14 @@
 # container for matplotlib panel (I like to make a container
 # panel for our panel so I know where it'll go when in XRCed.)
 plot_container = XRCCTRL(self.frame,"plot_container_panel")
- sizer = wxBoxSizer(wxVERTICAL)
+ sizer = BoxSizer(VERTICAL)
 
 # matplotlib panel itself
 self.plotpanel = PlotPanel(plot_container)
 self.plotpanel.init_plot_data()
 
 # wx boilerplate
- sizer.Add(self.plotpanel, 1, wxEXPAND)
+ sizer.Add(self.plotpanel, 1, EXPAND)
 plot_container.SetSizer(sizer)
 
 # whiz button ------------------
Modified: trunk/matplotlib/examples/embedding_in_wx4.py
===================================================================
--- trunk/matplotlib/examples/embedding_in_wx4.py	2007年07月20日 16:00:40 UTC (rev 3595)
+++ trunk/matplotlib/examples/embedding_in_wx4.py	2007年07月20日 18:35:35 UTC (rev 3596)
@@ -21,13 +21,13 @@
 from matplotlib.figure import Figure
 from matplotlib.numerix.mlab import rand
 
-from wxPython.wx import *
+from wx import *
 
 class MyNavigationToolbar(NavigationToolbar2WxAgg):
 """
 Extend the default wx toolbar with your own event handlers
 """
- ON_CUSTOM = wxNewId()
+ ON_CUSTOM = NewId()
 def __init__(self, canvas, cankill):
 NavigationToolbar2WxAgg.__init__(self, canvas)
 
@@ -56,13 +56,13 @@
 evt.Skip()
 
 
-class CanvasFrame(wxFrame):
+class CanvasFrame(Frame):
 
 def __init__(self):
- wxFrame.__init__(self,None,-1,
+ Frame.__init__(self,None,-1,
 'CanvasFrame',size=(550,350))
 
- self.SetBackgroundColour(wxNamedColor("WHITE"))
+ self.SetBackgroundColour(NamedColor("WHITE"))
 
 self.figure = Figure(figsize=(5,4), dpi=100)
 self.axes = self.figure.add_subplot(111)
@@ -73,14 +73,14 @@
 
 self.canvas = FigureCanvas(self, -1, self.figure)
 
- self.sizer = wxBoxSizer(wxVERTICAL)
- self.sizer.Add(self.canvas, 1, wxTOP | wxLEFT | wxEXPAND)
+ self.sizer = BoxSizer(VERTICAL)
+ self.sizer.Add(self.canvas, 1, TOP | LEFT | EXPAND)
 # Capture the paint message
 EVT_PAINT(self, self.OnPaint)
 
 self.toolbar = MyNavigationToolbar(self.canvas, True)
 self.toolbar.Realize()
- if wxPlatform == '__WXMAC__':
+ if Platform == '__WXMAC__':
 # Mac platform (OSX 10.3, MacPython) does not seem to cope with
 # having a toolbar in a sizer. This work-around gets the buttons
 # back, but at the expense of having the toolbar at the top
@@ -93,8 +93,8 @@
 # By adding toolbar in sizer, we are able to put it at the bottom
 # of the frame - so appearance is closer to GTK version.
 # As noted above, doesn't work for Mac.
- self.toolbar.SetSize(wxSize(fw, th))
- self.sizer.Add(self.toolbar, 0, wxLEFT | wxEXPAND)
+ self.toolbar.SetSize(Size(fw, th))
+ self.sizer.Add(self.toolbar, 0, LEFT | EXPAND)
 
 # update the axes menu on the toolbar
 self.toolbar.update()
@@ -106,14 +106,14 @@
 self.canvas.draw()
 event.Skip()
 
-class App(wxApp):
+class App(App):
 
 def OnInit(self):
 'Create the main window and insert the custom frame'
 frame = CanvasFrame()
- frame.Show(true)
+ frame.Show(True)
 
- return true
+ return True
 
 app = App(0)
 app.MainLoop()
Modified: trunk/matplotlib/examples/interactive.py
===================================================================
--- trunk/matplotlib/examples/interactive.py	2007年07月20日 16:00:40 UTC (rev 3595)
+++ trunk/matplotlib/examples/interactive.py	2007年07月20日 18:35:35 UTC (rev 3596)
@@ -162,7 +162,7 @@
 gobject.timeout_add(self.TIMEOUT, self.shell.runcode)
 try:
 if gtk.gtk_version[0] >= 2:
- gtk.threads_init()
+ gtk.gdk.threads_init()
 except AttributeError:
 pass
 gtk.main()
Modified: trunk/matplotlib/examples/interactive2.py
===================================================================
--- trunk/matplotlib/examples/interactive2.py	2007年07月20日 16:00:40 UTC (rev 3595)
+++ trunk/matplotlib/examples/interactive2.py	2007年07月20日 18:35:35 UTC (rev 3596)
@@ -116,7 +116,7 @@
 def __init__(self,view,old_out,style):
 self.view = view
 self.buffer = view.get_buffer()
- self.mark = self.buffer.create_mark("End",self.buffer.get_end_iter(), gtk.FALSE )
+ self.mark = self.buffer.create_mark("End",self.buffer.get_end_iter(), False )
 self.out = old_out
 self.style = style
 self.tee = 1
@@ -128,7 +128,7 @@
 end = self.buffer.get_end_iter()
 
 if not self.view == None:
- self.view.scroll_to_mark(self.mark, 0, gtk.TRUE, 1, 1)
+ self.view.scroll_to_mark(self.mark, 0, True, 1, 1)
 
 self.buffer.insert_with_tags(end,text,self.style)
 
@@ -142,7 +142,7 @@
 self.set_policy (gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
 
 self.text = gtk.TextView()
- self.text.set_wrap_mode(gtk.TRUE)
+ self.text.set_wrap_mode(True)
 
 self.interpreter = code.InteractiveInterpreter()
 
@@ -158,7 +158,7 @@
 
 self.current_history = -1
 
- self.mark = self.text.get_buffer().create_mark("End",self.text.get_buffer().get_end_iter(), gtk.FALSE )
+ self.mark = self.text.get_buffer().create_mark("End",self.text.get_buffer().get_end_iter(), False )
 
 #setup colors
 self.style_banner = gtk.TextTag("banner")
@@ -166,12 +166,12 @@
 
 self.style_ps1 = gtk.TextTag("ps1")
 self.style_ps1.set_property( "foreground", "DarkOrchid4" )
- self.style_ps1.set_property( "editable", gtk.FALSE )
+ self.style_ps1.set_property( "editable", False )
 self.style_ps1.set_property("font", "courier" )
 
 self.style_ps2 = gtk.TextTag("ps2")
 self.style_ps2.set_property( "foreground", "DarkOliveGreen" )
- self.style_ps2.set_property( "editable", gtk.FALSE )
+ self.style_ps2.set_property( "editable", False )
 self.style_ps2.set_property("font", "courier" )
 
 self.style_out = gtk.TextTag("stdout")
@@ -222,7 +222,7 @@
 else:
 self.text.get_buffer().insert_with_tags(end,text,style)
 
- self.text.scroll_to_mark(self.mark, 0, gtk.TRUE, 1, 1)
+ self.text.scroll_to_mark(self.mark, 0, True, 1, 1)
 
 def push(self, line):
 
@@ -257,21 +257,21 @@
 l = self.text.get_buffer().get_line_count() - 1
 start = self.text.get_buffer().get_iter_at_line_offset(l,4)
 self.text.get_buffer().place_cursor(start)
- return gtk.TRUE
+ return True
 elif event.keyval == gtk.gdk.keyval_from_name( 'space') and event.state & gtk.gdk.CONTROL_MASK:
 return self.complete_line()
- return gtk.FALSE
+ return False
 
 def show_history(self):
 if self.current_history == 0:
- return gtk.TRUE
+ return True
 else:
 self.replace_line( self.history[self.current_history] )
- return gtk.TRUE
+ return True
 
 def current_line(self):
 start,end = self.current_line_bounds()
- return self.text.get_buffer().get_text(start,end, gtk.TRUE)
+ return self.text.get_buffer().get_text(start,end, True)
 
 def current_line_bounds(self):
 txt_buffer = self.text.get_buffer()
@@ -310,7 +310,7 @@
 
 self.window.raise_()
 
- return gtk.TRUE
+ return True
 
 def complete_line(self):
 line = self.current_line()
@@ -334,7 +334,7 @@
 line = line[0:i] + completions[0]
 self.replace_line(line)
 
- return gtk.TRUE
+ return True
 
 
 def main():
@@ -350,7 +350,7 @@
 if gtk.gdk.keyval_name( event.keyval) == 'd' and \
 event.state & gtk.gdk.CONTROL_MASK:
 destroy()
- return gtk.FALSE
+ return False
 
 w.connect("destroy", destroy)
 
Modified: trunk/matplotlib/examples/mpl_with_glade.py
===================================================================
--- trunk/matplotlib/examples/mpl_with_glade.py	2007年07月20日 16:00:40 UTC (rev 3595)
+++ trunk/matplotlib/examples/mpl_with_glade.py	2007年07月20日 18:35:35 UTC (rev 3596)
@@ -6,7 +6,7 @@
 from matplotlib.axes import Subplot
 from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas
 from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar
-from matplotlib.widgets import HorizontalSpanSelector
+from matplotlib.widgets import SpanSelector
 
 from matplotlib.numerix import arange, sin, pi
 import gtk
@@ -74,8 +74,8 @@
 def onselect(xmin, xmax):
 print xmin, xmax
 
- span = HorizontalSpanSelector(self.axis, onselect, useblit=False,
- rectprops=dict(alpha=0.5, facecolor='red') )
+ span = SpanSelector(self.axis, onselect, 'horizontal', useblit=False,
+ rectprops=dict(alpha=0.5, facecolor='red') )
 
 
 self['vboxMain'].pack_start(self.canvas, True, True)
Modified: trunk/matplotlib/examples/simple3d_oo.py
===================================================================
--- trunk/matplotlib/examples/simple3d_oo.py	2007年07月20日 16:00:40 UTC (rev 3595)
+++ trunk/matplotlib/examples/simple3d_oo.py	2007年07月20日 18:35:35 UTC (rev 3596)
@@ -4,16 +4,16 @@
 matplotlib.use('WXAgg')
 matplotlib.rcParams['numerix'] = 'numpy'
 
-from wxPython.wx import *
+from wx import *
 import matplotlib.axes3d
 import matplotlib.mlab
 from matplotlib import numerix as nx
 from matplotlib.figure import Figure
 from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg, FigureManager, NavigationToolbar2WxAgg
 
-class PlotFigure(wxFrame):
+class PlotFigure(Frame):
 def __init__(self):
- wxFrame.__init__(self, None, -1, "Test embedded wxFigure")
+ Frame.__init__(self, None, -1, "Test embedded wxFigure")
 
 self.fig = Figure((9,8), 75)
 self.canvas = FigureCanvasWxAgg(self, -1, self.fig)
@@ -23,12 +23,12 @@
 self.figmgr = FigureManager(self.canvas, 1, self)
 tw, th = self.toolbar.GetSizeTuple()
 fw, fh = self.canvas.GetSizeTuple()
- self.toolbar.SetSize(wxSize(fw, th))
- sizer = wxBoxSizer(wxVERTICAL)
+ self.toolbar.SetSize(Size(fw, th))
+ sizer = BoxSizer(VERTICAL)
 
 # This way of adding to sizer allows resizing
- sizer.Add(self.canvas, 1, wxLEFT|wxTOP|wxGROW)
- sizer.Add(self.toolbar, 0, wxGROW)
+ sizer.Add(self.canvas, 1, LEFT|TOP|GROW)
+ sizer.Add(self.toolbar, 0, GROW)
 self.SetSizer(sizer)
 self.Fit()
 
@@ -58,7 +58,7 @@
 self.fig.savefig('globe')
 
 if __name__ == '__main__':
- app = wxPySimpleApp(0)
+ app = PySimpleApp(0)
 frame = PlotFigure()
 frame.Show()
 app.MainLoop()
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py	2007年07月20日 16:00:40 UTC (rev 3595)
+++ trunk/matplotlib/lib/matplotlib/axes.py	2007年07月20日 18:35:35 UTC (rev 3596)
@@ -2364,7 +2364,7 @@
 
 if len(xmin)==1:
 xmin = xmin*ones(y.shape, y.dtype)
- if len(ymax)==1:
+ if len(xmax)==1:
 xmax = xmax*ones(y.shape, y.dtype)
 
 xmin = npy.asarray(xmin)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2007年07月21日 01:51:47
Revision: 3600
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3600&view=rev
Author: efiring
Date: 2007年07月20日 18:51:44 -0700 (2007年7月20日)
Log Message:
-----------
More minor problems with examples solved
Modified Paths:
--------------
 trunk/matplotlib/examples/arrow_demo.py
 trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/examples/arrow_demo.py
===================================================================
--- trunk/matplotlib/examples/arrow_demo.py	2007年07月20日 23:45:24 UTC (rev 3599)
+++ trunk/matplotlib/examples/arrow_demo.py	2007年07月21日 01:51:44 UTC (rev 3600)
@@ -308,6 +308,6 @@
 normalize_data=scaled, head_starts_at_zero=True, size=size)
 
 draw()
- savefig('arrows.png')
- print 'Example saved to file "arrows.png"'
+ #savefig('arrows.png')
+ #print 'Example saved to file "arrows.png"'
 show()
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py	2007年07月20日 23:45:24 UTC (rev 3599)
+++ trunk/matplotlib/lib/matplotlib/axes.py	2007年07月21日 01:51:44 UTC (rev 3600)
@@ -1094,7 +1094,7 @@
 self.artists.append(a)
 self._set_artist_props(a)
 a._remove_method = lambda h: self.artists.remove(h)
- 
+
 def add_collection(self, collection, autolim=False):
 'add a Collection instance to Axes'
 label = collection.get_label()
@@ -1106,7 +1106,7 @@
 if autolim:
 self.update_datalim(collection.get_verts(self.transData))
 collection._remove_method = lambda h: self.collections.remove(h)
- 
+
 def add_line(self, line):
 'Add a line to the list of plot lines'
 self._set_artist_props(line)
@@ -1117,7 +1117,7 @@
 line.set_label('_line%d'%len(self.lines))
 self.lines.append(line)
 line._remove_method = lambda h: self.lines.remove(h)
- 
+
 def _update_line_limits(self, line):
 xdata = line.get_xdata(orig=False)
 ydata = line.get_ydata(orig=False)
@@ -1143,7 +1143,7 @@
 self._update_patch_limits(p)
 self.patches.append(p)
 p._remove_method = lambda h: self.patches.remove(h)
- 
+
 def _update_patch_limits(self, p):
 'update the datalimits for patch p'
 xys = self._get_verts_in_data_coords(
@@ -1156,7 +1156,7 @@
 self._set_artist_props(tab)
 self.tables.append(tab)
 tab._remove_method = lambda h: self.tables.remove(h)
- 
+
 def relim(self):
 'recompute the datalimits based on current artists'
 self.dataLim.ignore(True)
@@ -1165,7 +1165,7 @@
 
 for p in self.patches:
 self._update_patch_limits(p)
- 
+
 def update_datalim(self, xys):
 'Update the data lim bbox with seq of xy tups or equiv. 2-D array'
 # if no data is set currently, the bbox will ignore its
@@ -2153,8 +2153,8 @@
 t.update(kwargs)
 self.texts.append(t)
 t._remove_method = lambda h: self.texts.remove(h)
- 
 
+
 #if t.get_clip_on(): t.set_clip_box(self.bbox)
 if kwargs.has_key('clip_on'): t.set_clip_box(self.bbox)
 return t
@@ -3139,17 +3139,19 @@
 patches = []
 
 # lets do some conversions now
- xconv = self.xaxis.converter
- if ( xconv ):
- units = self.xaxis.get_units()
- left = xconv.convert( left, units )
- width = xconv.convert( width, units )
+ if self.xaxis is not None:
+ xconv = self.xaxis.converter
+ if ( xconv ):
+ units = self.xaxis.get_units()
+ left = xconv.convert( left, units )
+ width = xconv.convert( width, units )
 
- yconv = self.yaxis.converter
- if ( yconv ):
- units = self.yaxis.get_units()
- bottom = yconv.convert( bottom, units )
- height = yconv.convert( height, units )
+ if self.yaxis is not None:
+ yconv = self.yaxis.converter
+ if ( yconv ):
+ units = self.yaxis.get_units()
+ bottom = yconv.convert( bottom, units )
+ height = yconv.convert( height, units )
 
 
 if align == 'edge':
@@ -4077,7 +4079,7 @@
 Draws arrow on specified axis from (x,y) to (x+dx,y+dy).
 
 Optional kwargs control the arrow properties:
- %(Arrow)s
+ %(FancyArrow)s
 """
 a = mpatches.FancyArrow(x, y, dx, dy, **kwargs)
 self.add_artist(a)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jd...@us...> - 2007年07月21日 19:28:42
Revision: 3602
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3602&view=rev
Author: jdh2358
Date: 2007年07月21日 12:28:34 -0700 (2007年7月21日)
Log Message:
-----------
added poly editor
Modified Paths:
--------------
 trunk/matplotlib/examples/poly_editor.py
 trunk/matplotlib/lib/matplotlib/patches.py
 trunk/matplotlib/mpl1/mpl1.py
Modified: trunk/matplotlib/examples/poly_editor.py
===================================================================
--- trunk/matplotlib/examples/poly_editor.py	2007年07月21日 02:40:51 UTC (rev 3601)
+++ trunk/matplotlib/examples/poly_editor.py	2007年07月21日 19:28:34 UTC (rev 3602)
@@ -37,8 +37,8 @@
 self.ax = ax
 canvas = poly.figure.canvas
 self.poly = poly
- self.poly.verts = list(self.poly.verts)
- x, y = zip(*self.poly.verts)
+
+ x, y = zip(*self.poly.xy)
 self.line = Line2D(x,y,marker='o', markerfacecolor='r', animated=True)
 #self._update_line(poly)
 
@@ -69,7 +69,7 @@
 
 def get_ind_under_point(self, event):
 'get the index of the vertex under point if within epsilon tolerance'
- x, y = zip(*self.poly.verts)
+ x, y = zip(*self.poly.xy)
 
 # display coords
 xt, yt = self.poly.get_transform().numerix_x_y(x, y)
@@ -105,18 +105,18 @@
 elif event.key=='d':
 ind = self.get_ind_under_point(event)
 if ind is not None:
- self.poly.verts = [tup for i,tup in enumerate(self.poly.verts) if i!=ind]
- self.line.set_data(zip(*self.poly.verts))
+ self.poly.xy = [tup for i,tup in enumerate(self.poly.xy) if i!=ind]
+ self.line.set_data(zip(*self.poly.xy))
 elif event.key=='i':
- xys = self.poly.get_transform().seq_xy_tups(self.poly.verts)
+ xys = self.poly.get_transform().seq_xy_tups(self.poly.xy)
 p = event.x, event.y # display coords
 for i in range(len(xys)-1):
 s0 = xys[i]
 s1 = xys[i+1]
 d = dist_point_to_segment(p, s0, s1)
 if d<=self.epsilon:
- self.poly.verts.insert(i+1, (event.xdata, event.ydata))
- self.line.set_data(zip(*self.poly.verts))
+ self.poly.xy.insert(i+1, (event.xdata, event.ydata))
+ self.line.set_data(zip(*self.poly.xy))
 break
 
 
@@ -129,8 +129,8 @@
 if event.inaxes is None: return
 if event.button != 1: return
 x,y = event.xdata, event.ydata
- self.poly.verts[self._ind] = x,y
- self.line.set_data(zip(*self.poly.verts))
+ self.poly.xy[self._ind] = x,y
+ self.line.set_data(zip(*self.poly.xy))
 
 self.canvas.restore_region(self.background)
 self.ax.draw_artist(self.poly)
@@ -146,17 +146,23 @@
 
 
 fig = figure()
-circ = CirclePolygon((.5,.5),.5, animated=True)
+theta = arange(0, 2*pi, 0.1)
+r = 1.5
 
+xs = r*npy.cos(theta)
+ys = r*npy.sin(theta)
 
+poly = Polygon(zip(xs, ys,), animated=True)
 
 
+
+
 ax = subplot(111)
-ax.add_patch(circ)
-p = PolygonInteractor( ax, circ)
+ax.add_patch(poly)
+p = PolygonInteractor( ax, poly)
 
 ax.add_line(p.line)
 ax.set_title('Click and drag a point to move it')
-ax.set_xlim((0,1))
-ax.set_ylim((0,1))
+ax.set_xlim((-2,2))
+ax.set_ylim((-2,2))
 show()
Modified: trunk/matplotlib/lib/matplotlib/patches.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/patches.py	2007年07月21日 02:40:51 UTC (rev 3601)
+++ trunk/matplotlib/lib/matplotlib/patches.py	2007年07月21日 19:28:34 UTC (rev 3602)
@@ -438,7 +438,7 @@
 """
 Patch.__init__(self, **kwargs)
 
- self.xy = xy
+ self.xy = list(xy)
 self.numVertices = numVertices
 self.radius = radius
 self.orientation = orientation
Modified: trunk/matplotlib/mpl1/mpl1.py
===================================================================
--- trunk/matplotlib/mpl1/mpl1.py	2007年07月21日 02:40:51 UTC (rev 3601)
+++ trunk/matplotlib/mpl1/mpl1.py	2007年07月21日 19:28:34 UTC (rev 3602)
@@ -242,6 +242,60 @@
 #return 'AFFINE:\n%s'%self.data
 
 
+class Box(traits.HasTraits):
+ # left, bottom, width, height
+ bounds = traits.List
+ left = traits.Property(traits.Float)
+ bottom = traits.Property(traits.Float)
+ width = traits.Property(traits.Float) 
+ height = traits.Property(traits.Float) 
+
+ right = traits.Property(traits.Float) # read only
+ top = traits.Property(traits.Float) # read only
+
+ def ___bounds_default(self):
+ return [0.0, 0.0, 1.0, 1.0]
+
+ def _get_left(self):
+ return self.bounds[0]
+
+ def _set_left(self, left):
+ oldbounds = self.bounds[:] 
+ self.bounds[0] = left
+ self.trait_property_changed('bounds', oldbounds, self.bounds)
+
+ def _get_bottom(self):
+ return self.bounds[1]
+
+ def _set_bottom(self, bottom):
+ oldbounds = self.bounds[:] 
+ self.bounds[1] = bottom
+ self.trait_property_changed('bounds', oldbounds, self.bounds)
+
+ def _get_width(self):
+ return self.bounds[2]
+
+ def _set_width(self, width):
+ oldbounds = self.bounds[:] 
+ self.bounds[2] = width
+ self.trait_property_changed('bounds', oldbounds, self.bounds)
+
+ def _get_height(self):
+ return self.bounds[2]
+
+ def _set_height(self, height):
+ oldbounds = self.bounds[:] 
+ self.bounds[2] = height
+ self.trait_property_changed('bounds', oldbounds, self.bounds)
+
+ def _get_right(self):
+ return self.left + self.width
+
+ def _get_top(self):
+ return self.bottom + self.height
+
+ def _bounds_changed(self, old, new):
+ print 'base bounds changed'
 
 class ColorHandler(traits.TraitHandler):
 """
@@ -373,7 +427,7 @@
 
 self.pf = pf = agg.pixel_format_rgba(rbuf)
 self.rbase = rbase = agg.renderer_base_rgba(pf)
- rbase.clear_rgba8(self.gray)
+ rbase.clear_rgba8(self.white)
 
 # the antialiased renderers
 self.renderer = agg.renderer_scanline_aa_solid_rgba(rbase); 
@@ -412,7 +466,7 @@
 transpath = agg.conv_transform_path(path.agg_path, aggaffine)
 
 if path.fillcolor is not None:
- print 'render path', path.fillcolor, path.agg_fillcolor
+ #print 'render path', path.fillcolor, path.agg_fillcolor
 self.rasterizer.add_path(transpath)
 renderer.color_rgba8( path.agg_fillcolor )
 render_scanlines(self.rasterizer, scanline, renderer);
@@ -628,7 +682,7 @@
 self.agg_fillcolor = self.color_to_rgba8(newcolor)
 
 def _strokecolor__changed(self, oldcolor, newcolor): 
- print 'stroke color changed', newcolor
+ #print 'stroke color changed', newcolor
 c = self.color_to_rgba8(newcolor)
 self.agg_strokecolor = c
 
@@ -702,10 +756,14 @@
 
 renderer = traits.Trait(None, Renderer)
 
- 
+ # every artist defines a string which is the name of the attr that
+ # containers should put it into when added. Eg, an Axes is an
+ # Aritst container, and when you place a Line in to an Axes, the
+ # Axes will store a reference to it in the sequence ax.lines where
+ # Line.sequence = 'lines'
+ sequence = 'artists'
 def __init__(self):
 self.artistid = artistID()
- self.artistd = dict()
 
 # track affine as the product of the view and the data affines
 # -- this should be a property, but I had trouble making a
@@ -721,13 +779,28 @@
 def _get_affine(self):
 return self.aview * self.adata
 
+
+ def draw(self):
+ pass
+
+class ArtistContainer(Artist):
+ 
+ artistd = traits.Dict(traits.Int, Artist)
+ sequence = 'containers'
+ def __init__(self):
+ Artist.__init__(self)
+ self.artistd = dict()
+
+
+ 
 def add_artist(self, artist, followdata=True, followview=True): 
 # this is a very interesting change from matplotlib -- every
 # artist acts as a container that can hold other artists, and
 # respects zorder drawing internally. This makes zordering
 # much more flexibel
 self.artistd[artist.artistid] = artist
-
+ self.__dict__.setdefault(artist.sequence, []).append(artist)
+ 
 artist.renderer = self.renderer
 self.sync_trait('renderer', artist, mutual=False)
 
@@ -757,18 +830,18 @@
 del artist.followdata
 
 self.sync_trait('renderer', artist, remove=True)
- del self.artistd[artist.artistid] 
+ del self.artistd[artist.artistid]
+ self.__dict__[artist.sequence].remove(artist)
 
 def draw(self):
 if self.renderer is None or not self.visible: return
-
+ 
 dsu = [(artist.zorder, artist.artistid, artist) for artist in self.artistd.values()]
 dsu.sort()
 for zorder, artistid, artist in dsu:
 #print 'artist draw', self, artist, zorder
 artist.draw()
 
- 
 class Line(Artist):
 
 linestyle = mtraits.LineStyle('-')
@@ -785,7 +858,8 @@
 X = mtraits.Verts
 model = mtraits.Model
 zorder = traits.Float(2.0)
- 
+ sequence = 'lines'
+
 def __init__(self):
 """
 The model is a function taking Nx2->Nx2. This is where the
@@ -889,18 +963,17 @@
 
 mtraits.Line = traits.Instance(Line, ())
 
-class Rectangle(Artist):
+class Rectangle(Artist, Box):
 facecolor = mtraits.Color('yellow')
 edgecolor = mtraits.Color('black')
 edgewidth = mtraits.LineWidth(1.0)
- lbwh = traits.Array('d', (4,), [0,0,1,1])
 path = mtraits.Path
 zorder = traits.Float(1.0)
+ sequence = 'rectangles'
 
 def __init__(self):
 Artist.__init__(self)
-
- 
+ 
 self.sync_trait('facecolor', self.path, 'fillcolor', mutual=False)
 self.sync_trait('edgecolor', self.path, 'strokecolor', mutual=False)
 self.sync_trait('edgewidth', self.path, 'linewidth', mutual=False)
@@ -909,11 +982,14 @@
 # sync up the path affine
 self.path.affine.follow(self.affine.vec6)
 self.affine.on_trait_change(self.path.affine.follow, 'vec6')
+ 
+ def _hidebounds_changed(self, old, new):
+ Box._bounds_changed(self, old, new)
+ print 'rectangle bounds changed'
 
-
-
-
- def _lbwh_changed(self, old, new):
+ def _bounds_changed(self, old, new):
+ Box._bounds_changed(self, old, new)
+ print 'rectangle bounds changed'
 l,b,w,h = new
 t = b+h
 r = l+w
@@ -939,33 +1015,41 @@
 
 mtraits.Rectangle = traits.Instance(Rectangle, ()) 
 
-class Figure(Artist):
- pass
+class Figure(ArtistContainer):
 
+ rectangle = traits.Instance(Rectangle, ())
+ sequence = None # figure is top level container
+ def __init__(self):
+ ArtistContainer.__init__(self)
+ self.rectangle.zorder = 0
+ self.rectangle.facecolor = '0.75'
+ self.rectangle.bounds = [0,0,1,1]
+ self.add_artist(self.rectangle)
 
-class Axis(Artist):
+class Axis(ArtistContainer):
 zorder = traits.Float(1.5)
 tickmarkers = mtraits.Markers
 linepath = mtraits.Path
 linecolor = mtraits.Color('black')
 linewidth = mtraits.LineWidth(1.0)
 ticklocs = traits.Array('d')
- ticksize = traits.Float(7.0)
+ ticksize = traits.Float(5.0)
 ticklinewidth = mtraits.LineWidth(1.0)
 tickcolor = mtraits.Color('black')
 
 loc = traits.Float(0.) # the y location of the x-axis
- tickoffset = traits.Float(-0.5) # -1 for outer, -0.5 for centered, 0 for inner
- 
+ tickoffset = traits.Float(0) # -1 for outer, -0.5 for centered, 0 for inner
+ sequence = 'axes'
+
 def __init__(self):
- Artist.__init__(self)
+ ArtistContainer.__init__(self)
 self.tickmarkersid = primitiveID()
 self.linepathid = primitiveID()
 
 self.affine.on_trait_change(self._update_blended_affine, 'vec6')
 self.tickmarkers.path.antialiased = False
- self.linepath.antialiased = False 
-
+ self.linepath.antialiased = False
+ 
 self.sync_trait('linewidth', self.linepath, mutual=False)
 self.sync_trait('linecolor', self.linepath, 'strokecolor', mutual=False)
 self.sync_trait('ticklinewidth', self.tickmarkers.path, 'linewidth', mutual=False)
@@ -988,7 +1072,7 @@
 self._update_tick_path()
 
 def _tickoffset_changed(self, old, new):
- self._update_tick_path(self)
+ self._update_tick_path()
 
 def _update_blended_affine(self):
 'blend of xdata and y axis affine'
@@ -1019,7 +1103,7 @@
 self.renderer.render_path(self.linepathid) 
 
 class XAxis(Axis):
-
+ sequence = 'xaxes'
 def _update_blended_affine(self):
 'blend of xdata and y axis affine'
 sx, b, tx = self.adata.data[0]
@@ -1039,7 +1123,7 @@
 
 def _update_tick_path(self):
 codes = Path.MOVETO, Path.LINETO
- verts = npy.array([[0., self.tickoffset], [0, self.tickoffset+1]])*self.ticksize
+ verts = npy.array([[0., self.tickoffset], [0, self.tickoffset-1]])*self.ticksize
 self.tickmarkers.path.pathdata = codes, verts 
 
 def _update_linepath(self):
@@ -1048,8 +1132,8 @@
 self.linepath.pathdata = codes, X
 
 class YAxis(Axis):
+ sequence = 'yaxes'
 
-
 def _update_blended_affine(self):
 'blend of xdata and y axis affine'
 c, sy, ty = self.adata.data[1]
@@ -1077,21 +1161,76 @@
 X = npy.array([[0, 0], [0, 1]], npy.float_).T
 self.linepath.pathdata = codes, X
 
-
-class Axes(Artist):
- zorder = traits.Float(0.5)
+class FigurePane(ArtistContainer, Box):
+ """
+ The figure pane conceptually like the matplotlib Axes, but now
+ almost all of it's functionality is modular into the Axis and
+ Affine instances. It is a shell of it's former self: it has a
+ rectangle and a default x and y axis instance
+ """
+ rectangle = traits.Instance(Rectangle, ())
+ #gridabove = traits.false # TODO handle me
+ xaxis = traits.Instance(XAxis, ())
+ yaxis = traits.Instance(YAxis, ())
+ sequence = 'panes'
 
+ def __init__(self):
+ ArtistContainer.__init__(self)
+ self.rectangle.zorder = 0
+ self.rectangle.facecolor = 'white'
+ self.rectangle.edgecolor = 'white' 
+ self.rectangle.linewidth = 0
+ 
+ print 'setting rect bounds'
+ self.rectangle.bounds = [0,0,1,1]
+ print 'set rect bounds'
+ self.add_artist(self.rectangle, followdata=False)
+ self.add_artist(self.xaxis)
+ self.add_artist(self.yaxis) 
 
+ def _bounds_changed(self, old, new):
+ Box._bounds_changed(self, old, new)
+ print 'pane bounds changed'
+ l,b,w,h = self.bounds
+ self.aview.scale = w, h
+ self.aview.translate = l, b
 
- ytickmarkers = mtraits.Markers
- yaxisline = mtraits.Line
- yticklocs = traits.Array('d')
- yticksize = traits.Float(5.0)
- yaxislocx = traits.Float(0.) # the x location of the y-axis
 
- 
 
+def classic(fig):
+ x = npy.arange(0, 10., 0.01)
+ y = npy.sin(2*npy.pi*x)
 
+ pane = FigurePane().set(bounds=[0.1, 0.1, 0.8, 0.8])
+ fig.add_artist(pane, followdata=False, followview=False)
+
+
+ line1 = Line().set(X=npy.array([x,y]).T,
+ color='blue', linewidth=2.0, marker=None,
+ )
+
+
+ pane.add_artist(line1)
+
+ # update the view limits, all the affines should be automagically updated
+ pane.adata.xlim = 0, 10
+ pane.adata.ylim = -1.1, 1.1
+
+ pane.xaxis.ticklocs = npy.arange(0., 11., 1.)
+ pane.yaxis.ticklocs = npy.arange(-1.0, 1.1, 0.2)
+
+
+ # add a right and top axis
+ xaxis2 = XAxis().set(loc=1, tickoffset=-1)
+ yaxis2 = YAxis().set(loc=1, tickoffset=-1) 
+ xaxis2.ticklocs = npy.arange(0., 11., 0.5)
+ yaxis2.ticklocs = npy.arange(-1.0, 1.1, 0.1)
+
+ pane.add_artist(xaxis2)
+ pane.add_artist(yaxis2)
+ # uncomment to change Axes wwidth
+ #pane.width = 0.8
+
 def make_subplot_ll(fig):
 x1 = npy.arange(0, 10., 0.05)
 x2 = npy.arange(0, 10., 0.1)
@@ -1099,40 +1238,36 @@
 y2 = 10*npy.exp(-x1)
 
 
- axes = Axes()
- fig.add_artist(axes, followdata=False, followview=False)
+ pane = FigurePane().set(bounds=[0.1, 0.1, 0.4, 0.4])
+ fig.add_artist(pane, followdata=False, followview=False)
 
- axes.aview.scale = 0.4, 0.4
- axes.aview.translate = 0.1, 0.1
 
- xaxis = XAxis()
- axes.add_artist(xaxis)
-
- yaxis = YAxis()
- axes.add_artist(yaxis)
-
 line1 = Line().set(X=npy.array([x1,y1]).T,
- color='blue', linewidth=2.0, marker='s', markersize=5.0,
- markerfacecolor='green', markeredgewidth=0.5)
+ color='blue', linewidth=2.0, marker='s',
+ markersize=5.0, markerfacecolor='green',
+ markeredgewidth=0.5)
 
 
- axes.add_artist(line1)
+ pane.add_artist(line1)
 
+ # update the view limits, all the affines should be automagically updated
+ pane.adata.xlim = 0, 10
+ pane.adata.ylim = -1.1, 1.1
 
- rect1 = Rectangle().set(lbwh=[0,0,1,1], facecolor='white')
- axes.add_artist(rect1, followdata=False)
+ pane.xaxis.ticklocs = npy.arange(0., 11., 1.)
+ pane.xaxis.loc = -0.1
+ pane.xaxis.tickoffset = -0.5
+ pane.xaxis.linecolor = 'red'
 
- # update the view limits, all the affines should be automagically updated
- axes.adata.xlim = 0, 10
- axes.adata.ylim = -1.1, 1.1
- xaxis.ticklocs = npy.arange(0., 11., 1.)
- xaxis.loc = -0.1
- xaxis.linecolor = 'red'
+ pane.yaxis.ticklocs = npy.arange(-1.0, 1.1, 0.2)
+ pane.yaxis.loc = -0.1
+ pane.xaxis.tickoffset = -0.5 
+ 
+ pane.yaxis.linecolor = 'blue'
+ pane.yaxis.tickcolor = 'blue'
 
- yaxis.ticklocs = npy.arange(-1.0, 1.1, 0.2)
- yaxis.loc = -0.1
- yaxis.linecolor = 'blue'
- yaxis.tickcolor = 'blue'
+ # uncomment to change Axes wwidth
+ #pane.width = 0.8
 
 def make_subplot_ur(fig):
 axes2 = Axes()
@@ -1148,18 +1283,35 @@
 line2 = Line().set(X=npy.array([r, theta]).T, model=Polar(), color='#ee8d18', linewidth=2.0)
 axes2.add_artist(line2)
 
- rect2 = Rectangle().set(lbwh=[0,0,1,1], facecolor='#d5de9c')
+ rect2 = Rectangle().set(bounds=[0,0,1,1], facecolor='#d5de9c')
 axes2.add_artist(rect2, followdata=False)
 
 axes2.adata.xlim = -1.1, 1.1
 axes2.adata.ylim = -1.1, 1.1 
 
 
+
+class TestContainer(ArtistContainer, Box):
+ rectangle = traits.Instance(Rectangle, ())
+ sequence = 'panes'
+ 
+ def __init__(self):
+ ArtistContainer.__init__(self)
+ self.rectangle.zorder = 0
+ self.rectangle.facecolor = 'white'
+
+ print 'setting rect bounds'
+ self.rectangle.bounds = [0,0,1,1]
+ print 'set rect bounds'
+
 if __name__=='__main__':
+
 renderer = RendererAgg()
 fig = Figure()
 fig.renderer = renderer
- make_subplot_ll(fig)
- make_subplot_ur(fig)
+ classic(fig)
+ #make_subplot_ll(fig)
+ #make_subplot_ur(fig)
 fig.draw()
 renderer.show()
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年07月26日 14:45:59
Revision: 3617
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3617&view=rev
Author: mdboom
Date: 2007年07月26日 07:45:57 -0700 (2007年7月26日)
Log Message:
-----------
Merging mathtext changes into trunk.
Modified Paths:
--------------
 trunk/matplotlib/examples/mathtext_demo.py
 trunk/matplotlib/lib/matplotlib/_mathtext_data.py
 trunk/matplotlib/lib/matplotlib/afm.py
 trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
 trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py
 trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py
 trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
 trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
 trunk/matplotlib/lib/matplotlib/backends/backend_svg.py
 trunk/matplotlib/lib/matplotlib/mathtext.py
 trunk/matplotlib/lib/matplotlib/pyparsing.py
 trunk/matplotlib/lib/matplotlib/text.py
 trunk/matplotlib/src/ft2font.cpp
 trunk/matplotlib/src/mplutils.h
Added Paths:
-----------
 trunk/matplotlib/examples/mathtext_examples.py
 trunk/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/cmb10.ttf
 trunk/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/cmss10.ttf
Modified: trunk/matplotlib/examples/mathtext_demo.py
===================================================================
--- trunk/matplotlib/examples/mathtext_demo.py	2007年07月26日 13:46:56 UTC (rev 3616)
+++ trunk/matplotlib/examples/mathtext_demo.py	2007年07月26日 14:45:57 UTC (rev 3617)
@@ -1,28 +1,25 @@
 #!/usr/bin/env python
 """
+Use matplotlib's internal LaTex parser and layout engine. For true
+latex rendering, see the text.usetex option
+"""
+import numpy as npy
+from pylab import figure, show
+fig = figure()
+fig.subplots_adjust(bottom=0.2)
 
-In order to use mathtext, you must build matplotlib.ft2font. This is
-built by default in the windows installer.
+ax = fig.add_subplot(111, axisbg='y')
+ax.plot([1,2,3], 'r')
+x = npy.arange(0.0, 3.0, 0.1)
 
-For other platforms, edit setup.py and set
+ax.grid(True)
+ax.set_xlabel(r'$\Delta_i^j$', fontsize=20)
+ax.set_ylabel(r'$\Delta_{i+1}^j$', fontsize=20)
+tex = r'$\mathcal{R}\prod_{i=\alpha_{i+1}}^\infty a_i\sin(2 \pi f x_i)$'
 
-BUILD_FT2FONT = True
+ax.text(1, 1.6, tex, fontsize=20, va='bottom')
 
-"""
-from pylab import *
-subplot(111, axisbg='y')
-plot([1,2,3], 'r')
-x = arange(0.0, 3.0, 0.1)
-
-grid(True)
-xlabel(r'$\Delta_i^j$', fontsize=20)
-ylabel(r'$\Delta_{i+1}^j$', fontsize=20)
-tex = r'$\cal{R}\prod_{i=\alpha_{i+1}}^\infty a_i\rm{sin}(2 \pi f x_i)$'
-text(1, 1.6, tex, fontsize=20)
-
 #title(r'$\Delta_i^j \hspace{0.4} \rm{versus} \hspace{0.4} \Delta_{i+1}^j$', fontsize=20)
-savefig('mathtext_demo')
+fig.savefig('mathtext_demo')
 
-
-
 show()
Copied: trunk/matplotlib/examples/mathtext_examples.py (from rev 3616, branches/mathtext_mgd/examples/mathtext_examples.py)
===================================================================
--- trunk/matplotlib/examples/mathtext_examples.py	 (rev 0)
+++ trunk/matplotlib/examples/mathtext_examples.py	2007年07月26日 14:45:57 UTC (rev 3617)
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+
+import os, sys
+
+stests = [
+ r'Kerning: AVA $AVA$',
+ r'$x y$',
+ r'$x+y\ x=y\ x<y\ x:y\ x,y\ x@y$',
+ r'100ドル\%y\ x*y\ x/y x\$y$',
+ r'$x\leftarrow y\ x\forall y$',
+ r'$x \sf x \bf x {\cal X} \rm x$',
+ r'$\{ \rm braces \}$',
+ r'$\left[\left\lfloor\frac{5}{\frac{\left(3\right)}{4}} y\right)\right]$',
+ r'$\left(x\right)$',
+ r'$\sin(x)$',
+ r'$x_2$',
+ r'$x^2$',
+ r'$x^2_y$',
+ r'$x_y^2$',
+ r'$\prod_{i=\alpha_{i+1}}^\infty$',
+ r'$x = \frac{x+\frac{5}{2}}{\frac{y+3}{8}}$',
+ r'$dz/dt \/ = \/ \gamma x^2 \/ + \/ {\rm sin}(2\pi y+\phi)$',
+ r'Foo: $\alpha_{i+1}^j \/ = \/ {\rm sin}(2\pi f_j t_i) e^{-5 t_i/\tau}$',
+ r'$\mathcal{R}\prod_{i=\alpha_{i+1}}^\infty a_i \sin(2 \pi f x_i)$',
+# r'$\bigodot \bigoplus {\sf R} a_i{\rm sin}(2 \pi f x_i)$',
+ r'Variable $i$ is good',
+ r'$\Delta_i^j$',
+ r'$\Delta^j_{i+1}$',
+ r'$\ddot{o}\acute{e}\grave{e}\hat{O}\breve{\imath}\tilde{n}\vec{q}$',
+ r'$_i$',
+ r"$\arccos((x^i))$",
+ r"$\gamma = \frac{x=\frac{6}{8}}{y} \delta$",
+ r'$\"o\ddot o \'e\`e\~n\.x\^y$',
+ 
+ ]
+
+from pylab import *
+
+if '--latex' in sys.argv:
+ fd = open("mathtext_examples.ltx", "w")
+ fd.write("\\documentclass{article}\n")
+ fd.write("\\begin{document}\n")
+ fd.write("\\begin{enumerate}\n")
+
+ for i, s in enumerate(stests):
+ fd.write("\\item %s\n" % s)
+
+ fd.write("\\end{enumerate}\n")
+ fd.write("\\end{document}\n")
+ fd.close()
+
+ os.system("pdflatex mathtext_examples.ltx")
+else:
+ for i, s in enumerate(stests):
+ print "%02d: %s" % (i, s)
+ plot([1,2,3], 'r')
+ x = arange(0.0, 3.0, 0.1)
+
+ grid(True)
+ text(1, 1.6, s, fontsize=20)
+
+ savefig('mathtext_example%02d' % i)
+ figure()
+
Property changes on: trunk/matplotlib/examples/mathtext_examples.py
___________________________________________________________________
Name: svn:executable
 + *
Modified: trunk/matplotlib/lib/matplotlib/_mathtext_data.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/_mathtext_data.py	2007年07月26日 13:46:56 UTC (rev 3616)
+++ trunk/matplotlib/lib/matplotlib/_mathtext_data.py	2007年07月26日 14:45:57 UTC (rev 3617)
@@ -38,8 +38,10 @@
 r'\SQRT' : ('cmex10', 53),
 r'\leftbrace' : ('cmex10', 92),
 r'{' : ('cmex10', 92),
+ r'\{' : ('cmex10', 92),
 r'\rightbrace' : ('cmex10', 130),
 r'}' : ('cmex10', 130),
+ r'\}' : ('cmex10', 130),
 r'\leftangle' : ('cmex10', 97),
 r'\rightangle' : ('cmex10', 64),
 r'\Leftparen' : ('cmex10', 112),
@@ -112,7 +114,7 @@
 r'\phi' : ('cmmi10', 42),
 r'\chi' : ('cmmi10', 17),
 r'\psi' : ('cmmi10', 31),
-
+ 
 r'(' : ('cmr10', 119),
 r'\leftparen' : ('cmr10', 119),
 r'\rightparen' : ('cmr10', 68),
@@ -135,7 +137,11 @@
 r'[' : ('cmr10', 62),
 r'\rightbracket' : ('cmr10', 72),
 r']' : ('cmr10', 72),
-
+ r'\%' : ('cmr10', 48),
+ r'%' : ('cmr10', 48),
+ r'\$' : ('cmr10', 99),
+ r'@' : ('cmr10', 111),
+ 
 # these are mathml names, I think. I'm just using them for the
 # tex methods noted
 r'\circumflexaccent' : ('cmr10', 124), # for \hat
@@ -749,7 +755,17 @@
 r'\langle' : ('psyr', 225),
 r'\Sigma' : ('psyr', 229),
 r'\sum' : ('psyr', 229),
-
+ # these are mathml names, I think. I'm just using them for the
+ # tex methods noted
+ r'\circumflexaccent' : ('pncri8a', 124), # for \hat
+ r'\combiningbreve' : ('pncri8a', 81), # for \breve
+ r'\combininggraveaccent' : ('pncri8a', 114), # for \grave
+ r'\combiningacuteaccent' : ('pncri8a', 63), # for \accute
+ r'\combiningdiaeresis' : ('pncri8a', 91), # for \ddot
+ r'\combiningtilde' : ('pncri8a', 75), # for \tilde
+ r'\combiningrightarrowabove' : ('pncri8a', 110), # for \vec
+ r'\combiningdotabove' : ('pncri8a', 26), # for \dot
+ r'\imath' : ('pncri8a', 105)
 }
 
 # Automatically generated.
Modified: trunk/matplotlib/lib/matplotlib/afm.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/afm.py	2007年07月26日 13:46:56 UTC (rev 3616)
+++ trunk/matplotlib/lib/matplotlib/afm.py	2007年07月26日 14:45:57 UTC (rev 3617)
@@ -394,7 +394,14 @@
 "Return the fontangle as float"
 return self._header['ItalicAngle']
 
+ def get_xheight(self):
+ "Return the xheight as float"
+ return self._header['XHeight']
 
+ def get_underline_thickness(self):
+ "Return the underline thickness as float"
+ return self._header['UnderlineThickness']
+ 
 
 if __name__=='__main__':
 #pathname = '/usr/local/lib/R/afm/'
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py	2007年07月26日 13:46:56 UTC (rev 3616)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py	2007年07月26日 14:45:57 UTC (rev 3617)
@@ -173,10 +173,9 @@
 """
 if __debug__: verbose.report('RendererAgg.draw_mathtext',
 'debug-annoying')
- size = prop.get_size_in_points()
- width, height, fonts = math_parse_s_ft2font(
- s, self.dpi.get(), size, angle)
-
+ width, height, fonts, used_characters = math_parse_s_ft2font(
+ s, self.dpi.get(), prop, angle)
+ 
 if angle == 90:
 width, height = height, width
 for font in fonts:
@@ -225,7 +224,6 @@
 # texmanager more efficient. It is not meant to be used
 # outside the backend
 """
-
 if ismath=='TeX':
 # todo: handle props
 size = prop.get_size_in_points()
@@ -235,8 +233,8 @@
 return n,m
 
 if ismath:
- width, height, fonts = math_parse_s_ft2font(
- s, self.dpi.get(), prop.get_size_in_points())
+ width, height, fonts, used_characters = math_parse_s_ft2font(
+ s, self.dpi.get(), prop)
 return width, height
 font = self._get_agg_font(prop)
 font.set_text(s, 0.0) # the width and height of unrotated string
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py	2007年07月26日 13:46:56 UTC (rev 3616)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py	2007年07月26日 14:45:57 UTC (rev 3617)
@@ -314,9 +314,8 @@
 # "_draw_mathtext()")
 # return
 
- size = prop.get_size_in_points()
- width, height, fonts = math_parse_s_ft2font(
- s, self.dpi.get(), size)
+ width, height, fonts, used_characters = math_parse_s_ft2font(
+ s, self.dpi.get(), prop)
 
 if angle==90:
 width, height = height, width
@@ -372,8 +371,8 @@
 def get_text_width_height(self, s, prop, ismath):
 if _debug: print '%s.%s()' % (self.__class__.__name__, _fn_name())
 if ismath:
- width, height, fonts = math_parse_s_ft2font(
- s, self.dpi.get(), prop.get_size_in_points())
+ width, height, fonts, used_characters = math_parse_s_ft2font(
+ s, self.dpi.get(), prop)
 return width, height
 
 ctx = self.text_ctx
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py	2007年07月26日 13:46:56 UTC (rev 3616)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py	2007年07月26日 14:45:57 UTC (rev 3617)
@@ -198,9 +198,8 @@
 
 
 def _draw_mathtext(self, gc, x, y, s, prop, angle):
- size = prop.get_size_in_points()
- width, height, fonts = math_parse_s_ft2font(
- s, self.dpi.get(), size)
+ width, height, fonts, used_characters = math_parse_s_ft2font(
+ s, self.dpi.get(), prop)
 
 if angle==90:
 width, height = height, width
@@ -342,8 +341,8 @@
 
 def get_text_width_height(self, s, prop, ismath):
 if ismath:
- width, height, fonts = math_parse_s_ft2font(
- s, self.dpi.get(), prop.get_size_in_points())
+ width, height, fonts, used_characters = math_parse_s_ft2font(
+ s, self.dpi.get(), prop)
 return width, height
 
 layout, inkRect, logicalRect = self._get_pango_layout(s, prop)
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py	2007年07月26日 13:46:56 UTC (rev 3616)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py	2007年07月26日 14:45:57 UTC (rev 3617)
@@ -457,8 +457,9 @@
 fontdictObject = self._write_afm_font(filename)
 else:
 realpath, stat_key = get_realpath_and_stat(filename)
- fontdictObject = self.embedTTF(
- *self.used_characters[stat_key])
+ chars = self.used_characters.get(stat_key)
+ if chars is not None and len(chars[1]):
+ fontdictObject = self.embedTTF(realpath, chars[1])
 fonts[Fx] = fontdictObject
 #print >>sys.stderr, filename
 self.writeObject(self.fontObject, fonts)
@@ -1092,37 +1093,36 @@
 
 def draw_mathtext(self, gc, x, y, s, prop, angle):
 # TODO: fix positioning and encoding
- fontsize = prop.get_size_in_points()
 width, height, pswriter, used_characters = \
- math_parse_s_pdf(s, 72, fontsize, 0)
+ math_parse_s_pdf(s, 72, prop, 0)
 self.merge_used_characters(used_characters)
- 
+
 self.check_gc(gc, gc._rgb)
 self.file.output(Op.begin_text)
 prev_font = None, None
 oldx, oldy = 0, 0
- for ox, oy, fontname, fontsize, glyph in pswriter:
- #print ox, oy, glyph
- fontname = fontname.lower()
- a = angle / 180.0 * pi
- newx = x + cos(a)*ox - sin(a)*oy
- newy = y + sin(a)*ox + cos(a)*oy
- self._setup_textpos(newx, newy, angle, oldx, oldy)
- oldx, oldy = newx, newy
- if (fontname, fontsize) != prev_font:
- self.file.output(self.file.fontName(fontname), fontsize,
- Op.selectfont)
- prev_font = fontname, fontsize
+ for record in pswriter:
+ if record[0] == 'glyph':
+ rec_type, ox, oy, fontname, fontsize, glyph = record
+ a = angle / 180.0 * pi
+ newx = x + cos(a)*ox - sin(a)*oy
+ newy = y + sin(a)*ox + cos(a)*oy
+ self._setup_textpos(newx, newy, angle, oldx, oldy)
+ oldx, oldy = newx, newy
+ if (fontname, fontsize) != prev_font:
+ self.file.output(self.file.fontName(fontname), fontsize,
+ Op.selectfont)
+ prev_font = fontname, fontsize
 
- #if fontname.endswith('cmsy10.ttf') or \
- #fontname.endswith('cmmi10.ttf') or \
- #fontname.endswith('cmex10.ttf'):
- # string = '0円' + chr(glyph)
-
- string = chr(glyph)
- self.file.output(string, Op.show)
+ string = chr(glyph)
+ self.file.output(string, Op.show)
 self.file.output(Op.end_text)
 
+ for record in pswriter:
+ if record[0] == 'rect':
+ rec_type, ox, oy, width, height = record
+ self.file.output(Op.gsave, x + ox, y + oy, width, height, Op.rectangle, Op.fill, Op.grestore)
+
 def _draw_tex(self, gc, x, y, s, prop, angle):
 # Rename to draw_tex to enable, but note the following:
 # TODO:
@@ -1208,9 +1208,7 @@
 s = s.encode('cp1252', 'replace')
 
 if ismath:
- fontsize = prop.get_size_in_points()
- w, h, pswriter, used_characters = math_parse_s_pdf(
- s, 72, fontsize, 0)
+ w, h, pswriter, used_characters = math_parse_s_pdf(s, 72, prop, 0)
 
 elif rcParams['pdf.use14corefonts']:
 font = self._get_font_afm(prop)
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py	2007年07月26日 13:46:56 UTC (rev 3616)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py	2007年07月26日 14:45:57 UTC (rev 3617)
@@ -278,7 +278,7 @@
 
 if ismath:
 width, height, pswriter, used_characters = math_parse_s_ps(
- s, 72, prop.get_size_in_points(), 0)
+ s, 72, prop, 0)
 return width, height
 
 if rcParams['ps.useafm']:
@@ -813,11 +813,9 @@
 if debugPS:
 self._pswriter.write("% mathtext\n")
 
- fontsize = prop.get_size_in_points()
 width, height, pswriter, used_characters = \
- math_parse_s_ps(s, 72, fontsize, angle)
+ math_parse_s_ps(s, 72, prop, angle)
 self.merge_used_characters(used_characters)
-
 self.set_color(*gc.get_rgb())
 thetext = pswriter.getvalue()
 ps = """gsave
@@ -1038,13 +1036,14 @@
 print >>fh, l.strip()
 if not rcParams['ps.useafm']:
 for font_filename, chars in renderer.used_characters.values():
- font = FT2Font(font_filename)
- cmap = font.get_charmap()
- glyph_ids = []
- for c in chars:
- gind = cmap.get(ord(c)) or 0
- glyph_ids.append(gind)
- convert_ttf_to_ps(font_filename, fh, rcParams['ps.fonttype'], glyph_ids)
+ if len(chars):
+ font = FT2Font(font_filename)
+ cmap = font.get_charmap()
+ glyph_ids = []
+ for c in chars:
+ gind = cmap.get(ord(c)) or 0
+ glyph_ids.append(gind)
+ convert_ttf_to_ps(font_filename, fh, rcParams['ps.fonttype'], glyph_ids)
 print >>fh, "end"
 print >>fh, "%%EndProlog"
 
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_svg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_svg.py	2007年07月26日 13:46:56 UTC (rev 3616)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_svg.py	2007年07月26日 14:45:57 UTC (rev 3617)
@@ -291,9 +291,12 @@
 self._svgwriter.write (svg)
 
 def _add_char_def(self, prop, char):
- newprop = prop.copy()
- newprop.set_size(self.FONT_SCALE)
- font = self._get_font(newprop)
+ if isinstance(prop, FontProperties):
+ newprop = prop.copy()
+ font = self._get_font(newprop)
+ else:
+ font = prop
+ font.set_size(self.FONT_SCALE, 72)
 ps_name = font.get_sfnt()[(1,0,0,6)]
 char_id = urllib.quote('%s-%d' % (ps_name, ord(char)))
 if char_id in self._char_defs:
@@ -332,10 +335,10 @@
 """
 Draw math text using matplotlib.mathtext
 """
- fontsize = prop.get_size_in_points()
- width, height, svg_elements = math_parse_s_ft2font_svg(s, 72, fontsize)
+ width, height, svg_elements, used_characters = \
+ math_parse_s_ft2font_svg(s, 72, prop)
 svg_glyphs = svg_elements.svg_glyphs
- svg_lines = svg_elements.svg_lines
+ svg_rects = svg_elements.svg_rects
 color = rgb2hex(gc.get_rgb())
 
 self.open_group("mathtext")
@@ -349,10 +352,9 @@
 svg.append('translate(%f,%f)' % (x, y))
 svg.append('">\n')
 
- for fontname, fontsize, thetext, new_x, new_y_mtc, metrics in svg_glyphs:
- prop = FontProperties(family=fontname, size=fontsize)
- charid = self._add_char_def(prop, thetext)
-
+ for font, fontsize, thetext, new_x, new_y_mtc, metrics in svg_glyphs:
+ charid = self._add_char_def(font, thetext)
+ 
 svg.append('<use xlink:href="#%s" transform="translate(%s, %s) scale(%s)"/>\n' % 
 (charid, new_x, -new_y_mtc, fontsize / self.FONT_SCALE))
 svg.append('</g>\n')
@@ -366,7 +368,7 @@
 
 curr_x,curr_y = 0.0,0.0
 
- for fontname, fontsize, thetext, new_x, new_y_mtc, metrics in svg_glyphs:
+ for font, fontsize, thetext, new_x, new_y_mtc, metrics in svg_glyphs:
 if rcParams["mathtext.mathtext2"]:
 new_y = new_y_mtc - height
 else:
@@ -392,13 +394,20 @@
 
 svg.append('</text>\n')
 
+ if len(svg_rects):
+ svg.append('<g style="fill: black; stroke: none" transform="')
+ if angle != 0:
+ svg.append('translate(%f,%f) rotate(%1.1f)'
+ % (x,y,-angle) )
+ else:
+ svg.append('translate(%f,%f)' % (x, y))
+ svg.append('">\n')
+
+ for x, y, width, height in svg_rects:
+ svg.append('<rect x="%s" y="%s" width="%s" height="%s" fill="black" stroke="none" />' % (x, -y + height, width, height))
+ svg.append("</g>")
+ 
 self._svgwriter.write (''.join(svg))
- rgbFace = gc.get_rgb()
- for xmin, ymin, xmax, ymax in svg_lines:
- newx, newy = x + xmin, y + height - ymax#-(ymax-ymin)/2#-height
- self.draw_rectangle(gc, rgbFace, newx, newy, xmax-xmin, ymax-ymin)
- #~ self.draw_line(gc, x + xmin, y + ymin,# - height,
- #~ x + xmax, y + ymax)# - height)
 self.close_group("mathtext")
 
 def finish(self):
@@ -417,8 +426,8 @@
 
 def get_text_width_height(self, s, prop, ismath):
 if ismath:
- width, height, trash = math_parse_s_ft2font_svg(
- s, 72, prop.get_size_in_points())
+ width, height, trash, used_characters = \
+ math_parse_s_ft2font_svg(s, 72, prop)
 return width, height
 font = self._get_font(prop)
 font.set_text(s, 0.0)
Modified: trunk/matplotlib/lib/matplotlib/mathtext.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mathtext.py	2007年07月26日 13:46:56 UTC (rev 3616)
+++ trunk/matplotlib/lib/matplotlib/mathtext.py	2007年07月26日 14:45:57 UTC (rev 3617)
@@ -14,7 +14,7 @@
 handle fairly complex TeX expressions Eg, the following renders
 correctly
 
- s = r'$\cal{R}\prod_{i=\alpha\cal{B}}^\infty a_i\rm{sin}(2 \pi f x_i)$'
+ s = r'$\mathcal{R}\prod_{i=\alpha\mathcal{B}}^\infty a_i\sin(2 \pi f x_i)$'
 
 The fonts \cal, \rm, \it, and \tt are allowed.
 
@@ -59,17 +59,10 @@
 ^
 use raw strings
 
- The $ symbols must be the first and last symbols in the string. Eg,
- you cannot do
+ Math and non-math can be interpresed in the same string. E.g.,
 
 r'My label $x_i$'.
 
- but you can change fonts, as in
-
- r'$\rm{My label} x_i$'
-
- to achieve the same effect.
-
 A large set of the TeX symbols are provided. Subscripting and
 superscripting are supported, as well as the over/under style of
 subscripting with \sum, \int, etc.
@@ -77,6 +70,8 @@
 
 Allowed TeX symbols:
 
+ [MGDTODO: This list is no longer exhaustive and needs to be updated]
+ 
 \/ \Delta \Downarrow \Gamma \Im \LEFTangle \LEFTbrace \LEFTbracket
 \LEFTparen \Lambda \Leftarrow \Leftbrace \Leftbracket \Leftparen
 \Leftrightarrow \Omega \P \Phi \Pi \Psi \RIGHTangle \RIGHTbrace
@@ -119,11 +114,16 @@
 
 KNOWN ISSUES:
 
- - nested subscripts, eg, x_i_j not working; but you can do x_{i_j}
- - nesting fonts changes in sub/superscript groups not parsing
- - I would also like to add a few more layout commands, like \frac.
+ - Certainly there are some...
 
+STATUS:
+ The *Unicode* classes were incomplete when I found them, and have
+ not been refactored to support intermingling of regular text and
+ math text yet. They are most likely broken. -- Michael Droettboom, July 2007
+ 
 Author : John Hunter <jdh...@ac...>
+ Michael Droettboom <md...@st...>
+ (rewrite based on TeX box layout algorithms)
 Copyright : John Hunter (2004,2005)
 License : matplotlib license (PSF compatible)
 
@@ -132,26 +132,32 @@
 import os, sys
 from cStringIO import StringIO
 from sets import Set
+from warnings import warn
 
 from matplotlib import verbose
 from matplotlib.pyparsing import Literal, Word, OneOrMore, ZeroOrMore, \
 Combine, Group, Optional, Forward, NotAny, alphas, nums, alphanums, \
- StringStart, StringEnd, ParseException, FollowedBy, Regex
+ StringStart, StringEnd, ParseFatalException, FollowedBy, Regex, \
+ operatorPrecedence, opAssoc, ParseResults, Or, Suppress, oneOf
 
 from matplotlib.afm import AFM
-from matplotlib.cbook import enumerate, iterable, Bunch, get_realpath_and_stat
-from matplotlib.ft2font import FT2Font
+from matplotlib.cbook import enumerate, iterable, Bunch, get_realpath_and_stat, \
+ is_string_like
+from matplotlib.ft2font import FT2Font, KERNING_UNFITTED
 from matplotlib.font_manager import fontManager, FontProperties
 from matplotlib._mathtext_data import latex_to_bakoma, cmkern, \
 latex_to_standard, tex2uni, type12uni, tex2type1, uni2type1
 from matplotlib import get_data_path, rcParams
 
+####################
+
 # symbols that have the sub and superscripts over/under
-overunder = { r'\sum' : 1,
- r'\int' : 1,
- r'\prod' : 1,
- r'\coprod' : 1,
- }
+overunder_symbols = {
+ r'\sum' : 1,
+ r'\int' : 1,
+ r'\prod' : 1,
+ r'\coprod' : 1,
+ }
 # a character over another character
 charOverChars = {
 # The first 2 entires in the tuple are (font, char, sizescale) for
@@ -160,6 +166,8 @@
 r'\angstrom' : ( ('rm', 'A', 1.0), (None, '\circ', 0.5), 0.0 ),
 }
 
+##############################################################################
+# FONTS
 
 def font_open(filename):
 ext = filename.rsplit('.',1)[1]
@@ -224,7 +232,7 @@
 The class must be able to take symbol keys and font file names and
 return the character metrics as well as do the drawing
 """
-
+ 
 def get_kern(self, facename, symleft, symright, fontsize, dpi):
 """
 Get the kerning distance for font between symleft and symright.
@@ -264,7 +272,13 @@
 def render(self, ox, oy, facename, sym, fontsize, dpi):
 pass
 
-
+ def render_rect_filled(self, x1, y1, x2, y2):
+ pass
+ 
+ def get_used_characters(self):
+ return {}
+ 
+ 
 class DummyFonts(Fonts):
 'dummy class for debugging parser'
 def get_metrics(self, font, sym, fontsize, dpi):
@@ -475,6 +489,8 @@
 'rm' : 'cmr10.ttf',
 'tt' : 'cmtt10.ttf',
 'it' : 'cmmi10.ttf',
+ 'bf' : 'cmb10.ttf',
+ 'sf' : 'cmss10.ttf',
 None : 'cmmi10.ttf',
 }
 
@@ -542,78 +558,108 @@
 
 # Old classes
 
-class BakomaTrueTypeFonts(Fonts):
+class BakomaFonts(Fonts):
 """
 Use the Bakoma true type fonts for rendering
 """
- fnames = ('cmmi10', 'cmsy10', 'cmex10',
- 'cmtt10', 'cmr10')
 # allocate a new set of fonts
 basepath = os.path.join( get_data_path(), 'fonts', 'ttf' )
 
- fontmap = { 'cal' : 'cmsy10',
- 'rm' : 'cmr10',
- 'tt' : 'cmtt10',
- 'it' : 'cmmi10',
- None : 'cmmi10',
+ fontmap = { 'cal' : 'Cmsy10',
+ 'rm' : 'Cmr10',
+ 'tt' : 'Cmtt10',
+ 'it' : 'Cmmi10',
+ 'bf' : 'Cmb10',
+ 'sf' : 'Cmss10',
+ None : 'Cmmi10',
+ 'ex' : 'Cmex10'
 }
 
- def __init__(self, useSVG=False):
- self.glyphd = {}
- self.fonts = dict(
- [ (name, FT2Font(os.path.join(self.basepath, name) + '.ttf'))
- for name in self.fnames])
+ class CachedFont:
+ def __init__(self, font):
+ self.font = font
+ self.charmap = font.get_charmap()
+ self.glyphmap = dict(
+ [(glyphind, ccode) for ccode, glyphind in self.charmap.items()])
+ 
+ def __init__(self):
+ self.glyphd = {}
+ self.fonts = {}
+ self.used_characters = {}
 
- self.charmaps = dict(
- [ (name, self.fonts[name].get_charmap()) for name in self.fnames])
- # glyphmaps is a dict names to a dict of glyphindex -> charcode
- self.glyphmaps = {}
- for name in self.fnames:
- cmap = self.charmaps[name]
- self.glyphmaps[name] = dict([(glyphind, ccode) for ccode, glyphind in cmap.items()])
+ def _get_font(self, font):
+ """Looks up a CachedFont with its charmap and inverse charmap.
+ font may be a TeX font name (cal, rm, it etc.), a Computer Modern
+ font name (cmtt10, cmr10, etc.) or an FT2Font object."""
+ if isinstance(font, str):
+ if font not in self.fontmap.values():
+ basename = self.fontmap[font]
+ else:
+ basename = font
+ else:
+ basename = font.postscript_name
 
- for font in self.fonts.values():
- font.clear()
- if useSVG:
- self.svg_glyphs=[] # a list of "glyphs" we need to render this thing in SVG
- else: pass
- self.usingSVG = useSVG
+ cached_font = self.fonts.get(basename)
+ if cached_font is None:
+ if isinstance(font, str):
+ font = FT2Font(os.path.join(self.basepath, basename.lower() + ".ttf"))
+ basename = font.postscript_name
+ cached_font = self.CachedFont(font)
+ self.fonts[basename] = cached_font
+ return basename, cached_font
 
+ def get_font(self, font):
+ return self._get_font(font)[1].font
+ 
+ def get_fonts(self):
+ return [x.font for x in self.fonts.values()]
+ 
 def get_metrics(self, font, sym, fontsize, dpi):
- cmfont, metrics, glyph, offset = \
+ basename, font, metrics, symbol_name, num, glyph, offset = \
 self._get_info(font, sym, fontsize, dpi)
 return metrics
 
+ def _get_offset(self, basename, cached_font, glyph, fontsize, dpi):
+ if basename.lower() == 'cmex10':
+ return glyph.height/64.0/2 + 256.0/64.0*dpi/72.0
+ return 0.
+ 
 def _get_info (self, font, sym, fontsize, dpi):
 'load the cmfont, metrics and glyph with caching'
- key = font, sym, fontsize, dpi
+ if hasattr(font, 'postscript_name'):
+ fontname = font.postscript_name
+ else:
+ fontname = font
+ 
+ key = fontname, sym, fontsize, dpi
 tup = self.glyphd.get(key)
 
 if tup is not None: return tup
-
- basename = self.fontmap[font]
-
- if latex_to_bakoma.has_key(sym):
+ 
+ if font in self.fontmap and latex_to_bakoma.has_key(sym):
 basename, num = latex_to_bakoma[sym]
- num = self.glyphmaps[basename][num]
+ basename, cached_font = self._get_font(basename.capitalize())
+ symbol_name = cached_font.font.get_glyph_name(num)
+ num = cached_font.glyphmap[num]
 elif len(sym) == 1:
+ basename, cached_font = self._get_font(font)
 num = ord(sym)
+ symbol_name = cached_font.font.get_glyph_name(cached_font.charmap[num])
 else:
 num = 0
 raise ValueError('unrecognized symbol "%s"' % sym)
 
- #print sym, basename, num
- cmfont = self.fonts[basename]
- cmfont.set_size(fontsize, dpi)
- head = cmfont.get_sfnt_table('head')
- glyph = cmfont.load_char(num)
+ font = cached_font.font
+ font.set_size(fontsize, dpi)
+ glyph = font.load_char(num)
 
+ realpath, stat_key = get_realpath_and_stat(font.fname)
+ used_characters = self.used_characters.setdefault(
+ stat_key, (realpath, Set()))
+ used_characters[1].update(unichr(num))
+ 
 xmin, ymin, xmax, ymax = [val/64.0 for val in glyph.bbox]
- if basename == 'cmex10':
- offset = glyph.height/64.0/2 + 256.0/64.0*dpi/72.0
- #offset = -(head['yMin']+512)/head['unitsPerEm']*10.
- else:
- offset = 0.
+ offset = self._get_offset(basename, cached_font, glyph, fontsize, dpi)
 metrics = Bunch(
 advance = glyph.linearHoriAdvance/65536.0,
 height = glyph.height/64.0,
@@ -622,211 +668,120 @@
 xmax = xmax,
 ymin = ymin+offset,
 ymax = ymax+offset,
+ # iceberg is the equivalent of TeX's "height"
+ iceberg = glyph.horiBearingY/64.0 + offset
 )
 
- self.glyphd[key] = cmfont, metrics, glyph, offset
+ self.glyphd[key] = basename, font, metrics, symbol_name, num, glyph, offset
 return self.glyphd[key]
 
 def set_canvas_size(self, w, h):
 'Dimension the drawing canvas; may be a noop'
 self.width = int(w)
 self.height = int(h)
- for font in self.fonts.values():
- font.set_bitmap_size(int(w), int(h))
+ for cached_font in self.fonts.values():
+ cached_font.font.set_bitmap_size(int(w), int(h))
 
 def render(self, ox, oy, font, sym, fontsize, dpi):
- cmfont, metrics, glyph, offset = \
- self._get_info(font, sym, fontsize, dpi)
+ basename, font, metrics, symbol_name, num, glyph, offset = \
+ self._get_info(font, sym, fontsize, dpi)
 
- if not self.usingSVG:
- cmfont.draw_glyph_to_bitmap(
- int(ox), int(self.height - oy - metrics.ymax), glyph)
- else:
- oy += offset - 512/2048.*10.
- basename = self.fontmap[font]
- if latex_to_bakoma.has_key(sym):
- basename, num = latex_to_bakoma[sym]
- num = self.glyphmaps[basename][num]
- elif len(sym) == 1:
- num = ord(sym)
- else:
- num = 0
- print >>sys.stderr, 'unrecognized symbol "%s"' % sym
- thetext = unichr(num)
- thetext.encode('utf-8')
- self.svg_glyphs.append((basename, fontsize, thetext, ox, oy, metrics))
+ font.draw_glyph_to_bitmap(
+ int(ox), int(oy - metrics.ymax), glyph)
 
+ def render_rect_filled(self, x1, y1, x2, y2):
+ assert len(self.fonts)
+ font = self.fonts.values()[0]
+ font.font.draw_rect_filled(x1, y1, max(x2 - 1, x1), max(y2 - 1, y1))
+ 
+ def get_used_characters(self):
+ return self.used_characters
 
- def _old_get_kern(self, font, symleft, symright, fontsize, dpi):
- """
- Get the kerning distance for font between symleft and symright.
+ def get_xheight(self, font, fontsize, dpi):
+ basename, cached_font = self._get_font(font)
+ cached_font.font.set_size(fontsize, dpi)
+ pclt = cached_font.font.get_sfnt_table('pclt')
+ xHeight = pclt['xHeight'] / 64.0
+ return xHeight
 
- font is one of tt, it, rm, cal or None
+ def get_underline_thickness(self, font, fontsize, dpi):
+ basename, cached_font = self._get_font(font)
+ cached_font.font.set_size(fontsize, dpi)
+ return max(1.0, cached_font.font.underline_thickness / 64.0)
 
- sym is a single symbol(alphanum, punct) or a special symbol
- like \sigma.
-
- """
- basename = self.fontmap[font]
- cmfont = self.fonts[basename]
- cmfont.set_size(fontsize, dpi)
- kernd = cmkern[basename]
- key = symleft, symright
- kern = kernd.get(key,0)
- #print basename, symleft, symright, key, kern
- return kern
-
- def _get_num(self, font, sym):
- 'get charcode for sym'
- basename = self.fontmap[font]
- if latex_to_bakoma.has_key(sym):
- basename, num = latex_to_bakoma[sym]
- num = self.glyphmaps[basename][num]
- elif len(sym) == 1:
- num = ord(sym)
- else:
- num = 0
- return num
-
-
-class BakomaPSFonts(Fonts):
+ def get_kern(self, fontleft, symleft, fontsizeleft,
+ fontright, symright, fontsizeright, dpi):
+ if fontsizeleft == fontsizeright:
+ basename, font1, metrics, symbol_name, num1, glyph1, offset = \
+ self._get_info(fontleft, symleft, fontsizeleft, dpi)
+ basename, font2, metrics, symbol_name, num2, glyph2, offset = \
+ self._get_info(fontright, symright, fontsizeright, dpi)
+ if font1 == font2:
+ basename, font = self._get_font(font1)
+ return font.font.get_kerning(num1, num2, KERNING_UNFITTED) / 64.0
+ return 0.0
+ 
+class BakomaPSFonts(BakomaFonts):
 """
 Use the Bakoma postscript fonts for rendering to backend_ps
 """
- facenames = ('cmmi10', 'cmsy10', 'cmex10',
- 'cmtt10', 'cmr10')
- # allocate a new set of fonts
- basepath = os.path.join( get_data_path(), 'fonts', 'ttf' )
 
- fontmap = { 'cal' : 'cmsy10',
- 'rm' : 'cmr10',
- 'tt' : 'cmtt10',
- 'it' : 'cmmi10',
- None : 'cmmi10',
- }
-
- def __init__(self):
- self.glyphd = {}
- self.fonts = dict(
- [ (name, FT2Font(os.path.join(self.basepath, name) + '.ttf'))
- for name in self.facenames])
-
- self.glyphmaps = {}
- for facename in self.facenames:
- charmap = self.fonts[facename].get_charmap()
- self.glyphmaps[facename] = dict([(glyphind, charcode)
- for charcode, glyphind in charmap.items()])
- for font in self.fonts.values():
- font.clear()
-
- self.used_characters = {}
- 
- def _get_info (self, font, sym, fontsize, dpi):
- 'load the cmfont, metrics and glyph with caching'
- key = font, sym, fontsize, dpi
- tup = self.glyphd.get(key)
-
- if tup is not None:
- return tup
-
- basename = self.fontmap[font]
-
- if latex_to_bakoma.has_key(sym):
- basename, num = latex_to_bakoma[sym]
- sym = self.fonts[basename].get_glyph_name(num)
- num = self.glyphmaps[basename][num]
- elif len(sym) == 1:
- num = ord(sym)
- else:
- num = 0
- #sym = '.notdef'
- raise ValueError('unrecognized symbol "%s, %d"' % (sym, num))
-
- cmfont = self.fonts[basename]
- cmfont.set_size(fontsize, dpi)
- head = cmfont.get_sfnt_table('head')
- glyph = cmfont.load_char(num)
-
- realpath, stat_key = get_realpath_and_stat(cmfont.fname)
- used_characters = self.used_characters.setdefault(
- stat_key, (realpath, Set()))
- used_characters[1].update(unichr(num))
-
- xmin, ymin, xmax, ymax = [val/64.0 for val in glyph.bbox]
- if basename == 'cmex10':
- offset = -(head['yMin']+512)/head['unitsPerEm']*10.
- else:
- offset = 0.
- metrics = Bunch(
- advance = glyph.linearHoriAdvance/65536.0,
- height = glyph.height/64.0,
- width = glyph.width/64.0,
- xmin = xmin,
- xmax = xmax,
- ymin = ymin+offset,
- ymax = ymax+offset
- )
-
- self.glyphd[key] = basename, metrics, sym, offset
- return basename, metrics, '/'+sym, offset
-
 def set_canvas_size(self, w, h, pswriter):
 'Dimension the drawing canvas; may be a noop'
 self.width = w
 self.height = h
 self.pswriter = pswriter
 
-
 def render(self, ox, oy, font, sym, fontsize, dpi):
- fontname, metrics, glyphname, offset = \
+ basename, font, metrics, symbol_name, num, glyph, offset = \
 self._get_info(font, sym, fontsize, dpi)
- fontname = fontname.capitalize()
- if fontname == 'Cmex10':
- oy += offset - 512/2048.*10.
-
- ps = """/%(fontname)s findfont
+ oy = self.height - oy + offset
+ 
+ ps = """/%(basename)s findfont
 %(fontsize)s scalefont
 setfont
 %(ox)f %(oy)f moveto
-/%(glyphname)s glyphshow
+/%(symbol_name)s glyphshow
 """ % locals()
 self.pswriter.write(ps)
 
-
- def get_metrics(self, font, sym, fontsize, dpi):
- basename, metrics, sym, offset = \
- self._get_info(font, sym, fontsize, dpi)
- return metrics
-
+ def render_rect_filled(self, x1, y1, x2, y2):
+ ps = "%f %f %f %f rectfill" % (x1, self.height - y2, x2 - x1, y2 - y1)
+ self.pswriter.write(ps)
+ 
 class BakomaPDFFonts(BakomaPSFonts):
 """Hack of BakomaPSFonts for PDF support."""
 
- def _get_filename_and_num (self, font, sym, fontsize, dpi):
- 'should be part of _get_info'
- basename = self.fontmap[font]
+ def render(self, ox, oy, font, sym, fontsize, dpi):
+ basename, font, metrics, symbol_name, num, glyph, offset = \
+ self._get_info(font, sym, fontsize, dpi)
+ filename = font.fname
+ oy = self.height - oy + offset
 
- if latex_to_bakoma.has_key(sym):
- basename, num = latex_to_bakoma[sym]
- sym = self.fonts[basename].get_glyph_name(num)
- num = self.glyphmaps[basename][num]
- elif len(sym) == 1:
- num = ord(sym)
- else:
- num = 0
- raise ValueError('unrecognized symbol "%s"' % (sym,))
+ self.pswriter.append(('glyph', ox, oy, filename, fontsize, num))
 
- return os.path.join(self.basepath, basename) + '.ttf', num
-
+ def render_rect_filled(self, x1, y1, x2, y2):
+ self.pswriter.append(('rect', x1, self.height - y2, x2 - x1, y2 - y1))
+ 
+class BakomaSVGFonts(BakomaFonts):
+ """Hack of BakomaFonts for SVG support."""
+ def __init__(self):
+ BakomaFonts.__init__(self)
+ self.svg_glyphs = []
+ self.svg_rects = []
+ 
 def render(self, ox, oy, font, sym, fontsize, dpi):
- fontname, metrics, glyphname, offset = \
+ basename, font, metrics, symbol_name, num, glyph, offset = \
 self._get_info(font, sym, fontsize, dpi)
- filename, num = self._get_filename_and_num(font, sym, fontsize, dpi)
- if fontname.lower() == 'cmex10':
- oy += offset - 512/2048.*10.
 
- self.pswriter.append((ox, oy, filename, fontsize, num))
+ oy = self.height - oy + offset
+ thetext = unichr(num)
+ thetext.encode('utf-8')
+ self.svg_glyphs.append((font, fontsize, thetext, ox, oy, metrics))
 
-
+ def render_rect_filled(self, x1, y1, x2, y2):
+ self.svg_rects.append((x1, self.height - y2, x2 - x1, y2 - y1))
+ 
 class StandardPSFonts(Fonts):
 """
 Use the standard postscript fonts for rendering to backend_ps
@@ -835,21 +790,51 @@
 # allocate a new set of fonts
 basepath = os.path.join( get_data_path(), 'fonts', 'afm' )
 
- fontmap = { 'cal' : 'pzcmi8a',
- 'rm' : 'pncr8a',
- 'tt' : 'pcrr8a',
- 'it' : 'pncri8a',
+ fontmap = { 'cal' : 'pzcmi8a', # Zapf Chancery
+ 'rm' : 'pncr8a', # New Century Schoolbook
+ 'tt' : 'pcrr8a', # Courier 
+ 'it' : 'pncri8a', # New Century Schoolbook Italic
+ 'sf' : 'phvr8a', # Helvetica
+ 'bf' : 'pncb8a', # New Century Schoolbook Bold
+ None : 'psyr' # Symbol
 }
 
 def __init__(self):
 self.glyphd = {}
- self.fonts = dict(
- [ (name, AFM(file(os.path.join(self.basepath, name) + '.afm')))
- for name in self.fnames])
+ self.fonts = {}
 
+ def _get_font(self, font):
+ if isinstance(font, str):
+ if font not in self.fontmap.values():
+ basename = self.fontmap[font]
+ else:
+ basename = font
+ else:
+ basename = font.get_fontname()
+
+ cached_font = self.fonts.get(basename)
+ if cached_font is None:
+ if isinstance(font, str):
+ fname = os.path.join(self.basepath, basename + ".afm")
+ cached_font = AFM(file(fname, 'r'))
+ cached_font.fname = fname
+ basename = cached_font.get_fontname()
+ else:
+ cached_font = font
+ self.fonts[basename] = cached_font
+ return basename, cached_font
+
+ def get_fonts(self):
+ return [x.font for x in self.fonts.values()]
+ 
 def _get_info (self, font, sym, fontsize, dpi):
 'load the cmfont, metrics and glyph with caching'
- key = font, sym, fontsize, dpi
+ if hasattr(font, 'get_fontname'):
+ fontname = font.get_fontname()
+ else:
+ fontname = font
+
+ key = fontname, sym, fontsize, dpi
 tup = self.glyphd.get(key)
 
 if tup is not None:
@@ -857,41 +842,42 @@
 
 if sym in "0123456789()" and font == 'it':
 font = 'rm'
- basename = self.fontmap[font]
 
 if latex_to_standard.has_key(sym):
- basename, num = latex_to_standard[sym]
- char = chr(num)
+ font, num = latex_to_standard[sym]
+ glyph = chr(num)
 elif len(sym) == 1:
- char = sym
+ glyph = sym
+ num = ord(glyph)
 else:
 raise ValueError('unrecognized symbol "%s"' % (sym))
-
+ basename, font = self._get_font(font) 
+ 
 try:
- sym = self.fonts[basename].get_name_char(char)
+ symbol_name = font.get_name_char(glyph)
 except KeyError:
 raise ValueError('unrecognized symbol "%s"' % (sym))
 
 offset = 0
- cmfont = self.fonts[basename]
- fontname = cmfont.get_fontname()
 
 scale = 0.001 * fontsize
 
 xmin, ymin, xmax, ymax = [val * scale
- for val in cmfont.get_bbox_char(char)]
+ for val in font.get_bbox_char(glyph)]
 metrics = Bunch(
 advance = (xmax-xmin),
- width = cmfont.get_width_char(char) * scale,
- height = cmfont.get_width_char(char) * scale,
+ width = font.get_width_char(glyph) * scale,
+ height = font.get_height_char(glyph) * scale,
 xmin = xmin,
 xmax = xmax,
 ymin = ymin+offset,
- ymax = ymax+offset
+ ymax = ymax+offset,
+ # iceberg is the equivalent of TeX's "height"
+ iceberg = ymax + offset
 )
 
- self.glyphd[key] = fontname, basename, metrics, sym, offset, char
- return fontname, basename, metrics, '/'+sym, offset, char
+ self.glyphd[key] = basename, font, metrics, symbol_name, num, glyph, offset
+ return self.glyphd[key]
 
 def set_canvas_size(self, w, h, pswriter):
 'Dimension the drawing canvas; may be a noop'
@@ -899,637 +885,1292 @@
 self.height = h
 self.pswriter = pswriter
 
-
 def render(self, ox, oy, font, sym, fontsize, dpi):
- fontname, basename, metrics, glyphname, offset, char = \
+ basename, font, metrics, symbol_name, num, glyph, offset = \
 self._get_info(font, sym, fontsize, dpi)
- ps = """/%(fontname)s findfont
+ oy = self.height - oy
+ ps = """/%(basename)s findfont
 %(fontsize)s scalefont
 setfont
 %(ox)f %(oy)f moveto
-/%(glyphname)s glyphshow
+/%(symbol_name)s glyphshow
 """ % locals()
 self.pswriter.write(ps)
 
 
 def get_metrics(self, font, sym, fontsize, dpi):
- fontname, basename, metrics, sym, offset, char = \
+ basename, font, metrics, symbol_name, num, glyph, offset = \
 self._get_info(font, sym, fontsize, dpi)
 return metrics
 
- def get_kern(self, font, symleft, symright, fontsize, dpi):
- fontname, basename, metrics, sym, offset, char1 = \
- self._get_info(font, symleft, fontsize, dpi)
- fontname, basename, metrics, sym, offset, char2 = \
- self._get_info(font, symright, fontsize, dpi)
- cmfont = self.fonts[basename]
- return cmfont.get_kern_dist(char1, char2) * 0.001 * fontsize
+ def get_kern(self, fontleft, symleft, fontsizeleft,
+ fontright, symright, fontsizeright, dpi):
+ if fontsizeleft == fontsizeright:
+ basename, font1, metrics, symbol_name, num, glyph1, offset = \
+ self._get_info(fontleft, symleft, fontsizeleft, dpi)
+ basename, font2, metrics, symbol_name, num, glyph2, offset = \
+ self._get_info(fontright, symright, fontsizeright, dpi)
+ if font1.get_fontname() == font2.get_fontname():
+ basename, font = self._get_font(font1)
+ return font.get_kern_dist(glyph1, glyph2) * 0.001 * fontsizeleft
+ return 0.0
 
-class Element:
- fontsize = 12
- dpi = 72
- font = 'it'
- _padx, _pady = 2, 2 # the x and y padding in points
- _scale = 1.0
+ def render_rect_filled(self, x1, y1, x2, y2):
+ ps = "%f %f %f %f rectfill" % (x1, self.height - y2, x2 - x1, y2 - y1)
+ self.pswriter.write(ps)
 
- def __init__(self):
- # a dict mapping the keys above, below, subscript,
- # superscript, right to Elements in that position
- self.neighbors = {}
- self.ox, self.oy = 0, 0
+ def get_xheight(self, font, fontsize, dpi):
+ basename, cached_font = self._get_font(font)
+ return cached_font.get_xheight() * 0.001 * fontsize
 
- def advance(self):
- 'get the horiz advance'
- raise NotImplementedError('derived must override')
+ def get_underline_thickness(self, font, fontsize, dpi):
+ basename, cached_font = self._get_font(font)
+ return cached_font.get_underline_thickness() * 0.001 * fontsize
+ 
+##############################################################################
+# TeX-LIKE BOX MODEL
 
- def height(self):
- 'get the element height: ymax-ymin'
- raise NotImplementedError('derived must override')
+# The following is based directly on the document 'woven' from the
+# TeX82 source code. This information is also available in printed
+# form:
+#
+# Knuth, Donald E.. 1986. Computers and Typesetting, Volume B:
+# TeX: The Program. Addison-Wesley Professional.
+#
+# The most relevant "chapters" are:
+# Data structures for boxes and their friends
+# Shipping pages out (Ship class)
+# Packaging (hpack and vpack)
+# Data structures for math mode
+# Subroutines for math mode
+# Typesetting math formulas
+#
+# Many of the docstrings below refer to a numbered "node" in that
+# book, e.g. @123
+#
+# Note that (as TeX) y increases downward, unlike many other parts of
+# matplotlib.
 
- def width(self):
- 'get the element width: xmax-xmin'
- raise NotImplementedError('derived must override')
+# How much text shrinks when going to the next-smallest level
+SHRINK_FACTOR = 0.7
+# The number of different sizes of chars to use, beyond which they will not
+# get any smaller
+NUM_SIZE_LEVELS = 3
+# Percentage of x-height that subscripts drop below the baseline
+SUBDROP = 0.05
+# Percentage of x-height that superscripts drop below the baseline
+SUP1 = 0.2
+# Percentage of x-height that subscripts drop below the baseline
+SUB1 = 0.3
+# Percentage of x-height that superscripts are offset relative to the subscript
+DELTA = 0.05
+ 
+class MathTextWarning(Warning):
+ pass
+ 
+class Node(object):
+ """A node in a linked list.
+ @133
+ """
+ def __init__(self):
+ self.link = None
+ self.size = 0
+ 
+ def __repr__(self):
+ s = self.__internal_repr__()
+ if self.link:
+ s += ' ' + self.link.__repr__()
+ return s
 
- def xmin(self):
- 'get the xmin of ink rect'
- raise NotImplementedError('derived must override')
+ def __internal_repr__(self):
+ return self.__class__.__name__
 
- def xmax(self):
- 'get the xmax of ink rect'
- raise NotImplementedError('derived must override')
+ def get_kerning(self, next):
+ return 0.0
 
- def ymin(self):
- 'get the ymin of ink rect'
- raise NotImplementedError('derived must override')
+ def set_link(self, other):
+ self.link = other
 
- def ymax(self):
- 'get the ymax of ink rect'
- raise NotImplementedError('derived must override')
+ def pack(self):
+ if self.link:
+ self.link.pack()
 
- def set_font(self, font):
- 'set the font (one of tt, it, rm , cal)'
- raise NotImplementedError('derived must override')
+ def shrink(self):
+ """Shrinks one level smaller. There are only three levels of sizes,
+ after which things will no longer get smaller."""
+ if self.link:
+ self.link.shrink()
+ self.size += 1
+ 
+ def render(self, x, y):
+ pass
 
- def render(self):
- 'render to the fonts canvas'
- for element in self.neighbors.values():
- element.render()
+class Box(Node):
+ """Represents any node with a physical location.
+ @135"""
+ def __init__(self, width, height, depth):
+ Node.__init__(self)
+ self.width = width
+ self.height = height
+ self.depth = depth
 
- def set_origin(self, ox, oy):
- self.ox, self.oy = ox, oy
+ def shrink(self):
+ Node.shrink(self)
+ if self.size < NUM_SIZE_LEVELS:
+ if self.width is not None:
+ self.width *= SHRINK_FACTOR
+ if self.height is not None:
+ self.height *= SHRINK_FACTOR
+ if self.depth is not None:
+ self.depth *= SHRINK_FACTOR
 
- # order matters! right needs to be evaled last
- keys = ('above', 'below', 'subscript', 'superscript', 'right')
- for loc in keys:
- element = self.neighbors.get(loc)
- if element is None: continue
+ def render(self, x1, y1, x2, y2):
+ pass
 
- if loc=='above':
- nx = self.centerx() - element.width()/2.0
- ny = self.ymax() + self.pady() + (element.oy - element.ymax() + element.height())
- #print element, self.ymax(), element.height(), element.ymax(), element.ymin(), ny
- elif loc=='below':
- nx = self.centerx() - element.width()/2.0
- ny = self.ymin() - self.pady() - element.height()
- elif loc=='superscript':
- nx = self.xmax()
- ny = self.ymax() - self.pady()
- elif loc=='subscript':
- nx = self.xmax()
- ny = self.oy - 0.5*element.height()
- elif loc=='right':
- nx = self.ox + self.advance()
- if self.neighbors.has_key('subscript'):
- o = self.neighbors['subscript']
- nx = max(nx, o.ox + o.advance())
- if self.neighbors.has_key('superscript'):
- o = self.neighbors['superscript']
- nx = max(nx, o.ox + o.advance())
+class Vbox(Box):
+ def __init__(self, height, depth):
+ Box.__init__(self, 0., height, depth)
 
- ny = self.oy
- element.set_origin(nx, ny)
+class Hbox(Box):
+ def __init__(self, width):
+ Box.__init__(self, width, 0., 0.)
+ 
+class Char(Node):
+ """Represents a single character. Unlike TeX, the font
+ information and metrics are stored with each Char to make it
+ easier to lookup the font metrics when needed. Note that TeX
+ boxes have a width, height, and depth, unlike Type1 and Truetype
+ which use a full bounding box and an advance in the x-direction.
+ The metrics must be converted to the TeX way, and the advance (if
+ different from width) must be converted into a Kern node when the
+ Char is added to its parent Hlist.
+ @134"""
+ def __init__(self, c, state):
+ Node.__init__(self)
+ self.c = c
+ self.font_output = state.font_output
+ self.font = state.font
+ self.fontsize = state.fontsize
+ self.dpi = state.dpi
+ # The real width, height and depth will be set during the
+ # pack phase, after we know the real fontsize
+ self._update_metrics()
+ 
+ def __internal_repr__(self):
+ return '`%s`' % self.c
 
- def set_size_info(self, fontsize, dpi):
- self.fontsize = self._scale*fontsize
- self.dpi = dpi
- for loc, element in self.neighbors.items():
- if loc in ('subscript', 'superscript'):
- element.set_size_info(0.7*self.fontsize, dpi)
- else:
- element.set_size_info(self.fontsize, dpi)
+ def _update_metrics(self):
+ metrics = self._metrics = self.font_output.get_metrics(
+ self.font, self.c, self.fontsize, self.dpi)
+ self.width = metrics.width
+ self.height = metrics.iceberg
+ self.depth = -(metrics.iceberg - metrics.height)
+ 
+ def get_kerning(self, next):
+ """Return the amount of kerning between this and the given
+ character. Called when characters are strung together into
+ Hlists to create Kern nodes."""
+ advance = self._metrics.advance - self.width
+ kern = 0.
+ if isinstance(next, Char):
+ kern = self.font_output.get_kern(self.font, self.c, self.fontsize, next.font, next.c, next.fontsize, self.dpi)
+ return advance + kern
+ 
+ def render(self, x, y):
+ """Render the character to the canvas"""
+ self.font_output.render(
+ x, y,
+ self.font, self.c, self.fontsize, self.dpi)
 
- def pady(self):
- return self.dpi/72.0*self._pady
+ def shrink(self):
+ Node.shrink(self)
+ if self.size < NUM_SIZE_LEVELS:
+ self.fontsize *= SHRINK_FACTOR
+ self._update_metrics()
 
- def padx(self):
- return self.dpi/72.0*self._padx
+class Accent(Char):
+ """The font metrics need to be dealt with differently for accents, since they
+ are already offset correctly from the baseline in TrueType fonts."""
+ def _update_metrics(self):
+ metrics = self._metrics = self.font_output.get_metrics(
+ self.font, self.c, self.fontsize, self.dpi)
+ self.width = metrics.width
+ self.height = metrics.ymax - metrics.ymin
+ self.depth = 0
 
- def set_padx(self, pad):
- 'set the y padding in points'
- self._padx = pad
+ def render(self, x, y):
+ """Render the character to the canvas"""
+ self.font_output.render(
+ x, y + (self._metrics.ymax - self.height),
+ self.font, self.c, self.fontsize, self.dpi)
+ 
+class List(Box):
+ """A list of nodes (either horizontal or vertical).
+ @135"""
+ def __init__(self, elements):
+ Box.__init__(self, 0., 0., 0.)
+ self.shift_amount = 0. # An arbitrary offset
+ self.list_head = None # The head of a linked list of Nodes in this box
+ # The following parameters are set in the vpack and hpack functions
+ self.glue_set = 0. # The glue setting of this list
+ self.glue_sign = 0 # 0: normal, -1: shrinking, 1: stretching
+ self.glue_order = 0 # The order of infinity (0 - 3) for the glue
+ 
+ # Convert the Python list to a linked list
+ if len(elements):
+ elem = self.list_head = elements[0]
+ for next in elements[1:]:
+ elem.set_link(next)
+ elem = next
 
- def set_pady(self, pad):
- 'set the y padding in points'
- self._pady = pad
+ def ...
 
[truncated message content]
From: <md...@us...> - 2007年07月26日 14:47:28
Revision: 3618
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3618&view=rev
Author: mdboom
Date: 2007年07月26日 07:47:27 -0700 (2007年7月26日)
Log Message:
-----------
Update information about mathtext improvements.
Modified Paths:
--------------
 trunk/matplotlib/API_CHANGES
 trunk/matplotlib/CHANGELOG
Modified: trunk/matplotlib/API_CHANGES
===================================================================
--- trunk/matplotlib/API_CHANGES	2007年07月26日 14:45:57 UTC (rev 3617)
+++ trunk/matplotlib/API_CHANGES	2007年07月26日 14:47:27 UTC (rev 3618)
@@ -1,3 +1,10 @@
+ The mathtext font commands (\cal, \rm, \it, \tt) now behave as TeX
+ does: they are in effect until the next font change command or the
+ end of the grouping. Therefore uses of $\cal{R}$ should be
+ changed to ${\cal R}$. Alternatively, you may use the new
+ LaTeX-style font commands (\mathcal, \mathrm, \mathit, \mathtt)
+ which do affect the following group, eg. $\mathcal{R}$.
+
 Text creation commands have a new default linespacing and
 a new linespacing kwarg, which is a multiple of the maximum
 vertical extent of a line of ordinary text. The default is
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2007年07月26日 14:45:57 UTC (rev 3617)
+++ trunk/matplotlib/CHANGELOG	2007年07月26日 14:47:27 UTC (rev 3618)
@@ -1,3 +1,52 @@
+2007年07月26日 Major rewrite of mathtext.py, using the TeX box layout model.
+
+	 There is one (known) backward incompatible change. The
+	 font commands (\cal, \rm, \it, \tt) now behave as TeX does:
+	 they are in effect until the next font change command or
+	 the end of the grouping. Therefore uses of $\cal{R}$
+	 should be changed to ${\cal R}$. Alternatively, you may
+	 use the new LaTeX-style font commands (\mathcal, \mathrm,
+	 \mathit, \mathtt) which do affect the following group,
+	 eg. $\mathcal{R}$.
+
+	 Other new features include:
+
+	 - Math may be interspersed with non-math text. Any text
+ with an even number of $'s (non-escaped) will be sent to
+	 the mathtext parser for layout.
+
+	 - Sub/superscripts are less likely to accidentally overlap.
+
+	 - Support for sub/superscripts in either order, eg. $x^i_j$
+ and $x_j^i$ are equivalent.
+
+	 - Double sub/superscripts (eg. $x_i_j$) are considered
+ ambiguous and raise an exception. Use braces to disambiguate.
+
+	 - $\frac{x}{y}$ can be used for displaying fractions
+
+	 - $\left(\frac{x}{y}\right)$ may be used to create
+ parentheses and other delimiters that automatically
+ resize to the height of their contents.
+
+	 - Spacing around operators etc. is now generally more like
+ TeX.
+
+ 	 - Added support (and fonts) for boldface (\bf) and
+ sans-serif (\sf) symbols.
+
+	 - Log-like function name shortcuts are supported. For
+ example, $\sin(x)$ may be used instead of ${\rm sin}(x)$
+
+	 - Limited use of kerning for the easy case (same font)
+
+	 Behind the scenes, the pyparsing.py module used for doing
+	 the math parsing was updated to the latest stable version
+	 (1.4.6). A lot of duplicate code was refactored out of the
+	 Font classes.
+
+	 - MGD
+
 2007年07月19日 completed numpification of most trivial cases - NN
 
 2007年07月19日 converted non-numpy relicts troughout the code - NN
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年07月26日 19:44:15
Revision: 3620
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3620&view=rev
Author: mdboom
Date: 2007年07月26日 12:44:09 -0700 (2007年7月26日)
Log Message:
-----------
Lots of sizing and layout tweaks. Support $\sqrt[3]{foo}. The line
meets up with the check mark rather clumsily on the Agg backends due
to rounding errors and lack of subpixel placement... will look into that.
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/lib/matplotlib/_mathtext_data.py
 trunk/matplotlib/lib/matplotlib/mathtext.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2007年07月26日 18:40:36 UTC (rev 3619)
+++ trunk/matplotlib/CHANGELOG	2007年07月26日 19:44:09 UTC (rev 3620)
@@ -23,8 +23,11 @@
 	 - Double sub/superscripts (eg. $x_i_j$) are considered
 ambiguous and raise an exception. Use braces to disambiguate.
 
-	 - $\frac{x}{y}$ can be used for displaying fractions
+	 - $\frac{x}{y}$ can be used for displaying fractions.
 
+	 - $\sqrt[3]{x}$ can be used to display the radical symbol
+ with a root number and body.
+
 	 - $\left(\frac{x}{y}\right)$ may be used to create
 parentheses and other delimiters that automatically
 resize to the height of their contents.
Modified: trunk/matplotlib/lib/matplotlib/_mathtext_data.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/_mathtext_data.py	2007年07月26日 18:40:36 UTC (rev 3619)
+++ trunk/matplotlib/lib/matplotlib/_mathtext_data.py	2007年07月26日 19:44:09 UTC (rev 3620)
@@ -170,6 +170,7 @@
 r'\swarrow' : ('cmsy10', 116),
 r'\propto' : ('cmsy10', 15),
 r'\prime' : ('cmsy10', 73),
+ r"'" : ('cmsy10', 73),
 r'\infty' : ('cmsy10', 32),
 r'\in' : ('cmsy10', 59),
 r'\ni' : ('cmsy10', 122),
@@ -253,6 +254,7 @@
 r'\prec' : ('cmsy10', 93),
 r'\succ' : ('cmsy10', 49),
 r'\rightarrow' : ('cmsy10', 12),
+ r'\to' : ('cmsy10', 12),
 r'\spadesuit' : ('cmsy10', 7),
 }
 
Modified: trunk/matplotlib/lib/matplotlib/mathtext.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mathtext.py	2007年07月26日 18:40:36 UTC (rev 3619)
+++ trunk/matplotlib/lib/matplotlib/mathtext.py	2007年07月26日 19:44:09 UTC (rev 3620)
@@ -138,7 +138,8 @@
 from matplotlib.pyparsing import Literal, Word, OneOrMore, ZeroOrMore, \
 Combine, Group, Optional, Forward, NotAny, alphas, nums, alphanums, \
 StringStart, StringEnd, ParseFatalException, FollowedBy, Regex, \
- operatorPrecedence, opAssoc, ParseResults, Or, Suppress, oneOf
+ operatorPrecedence, opAssoc, ParseResults, Or, Suppress, oneOf, \
+ ParseException, MatchFirst
 
 from matplotlib.afm import AFM
 from matplotlib.cbook import enumerate, iterable, Bunch, get_realpath_and_stat, \
@@ -151,13 +152,7 @@
 
 ####################
 
-# symbols that have the sub and superscripts over/under
-overunder_symbols = {
- r'\sum' : 1,
- r'\int' : 1,
- r'\prod' : 1,
- r'\coprod' : 1,
- }
+ 
 # a character over another character
 charOverChars = {
 # The first 2 entires in the tuple are (font, char, sizescale) for
@@ -692,7 +687,11 @@
 def render_rect_filled(self, x1, y1, x2, y2):
 assert len(self.fonts)
 font = self.fonts.values()[0]
- font.font.draw_rect_filled(x1, y1, max(x2 - 1, x1), max(y2 - 1, y1))
+ font.font.draw_rect_filled(
+ max(0, x1 - 1),
+ y1,
+ max(x2 - 1, x1),
+ max(y2 - 1, y1))
 
 def get_used_characters(self):
 return self.used_characters
@@ -956,14 +955,16 @@
 # The number of different sizes of chars to use, beyond which they will not
 # get any smaller
 NUM_SIZE_LEVELS = 3
-# Percentage of x-height that subscripts drop below the baseline
-SUBDROP = 0.05
+# Percentage of x-height of additional horiz. space after sub/superscripts
+SCRIPT_SPACE = 0.3
+# Percentage of x-height that sub/superscripts drop below the baseline
+SUBDROP = 0.4
 # Percentage of x-height that superscripts drop below the baseline
-SUP1 = 0.2
+SUP1 = 0.7
 # Percentage of x-height that subscripts drop below the baseline
-SUB1 = 0.3
+SUB1 = 0.0
 # Percentage of x-height that superscripts are offset relative to the subscript
-DELTA = 0.05
+DELTA = 0.1
 
 class MathTextWarning(Warning):
 pass
@@ -991,10 +992,6 @@
 def set_link(self, other):
 self.link = other
 
- def pack(self):
- if self.link:
- self.link.pack()
-
 def shrink(self):
 """Shrinks one level smaller. There are only three levels of sizes,
 after which things will no longer get smaller."""
@@ -1062,7 +1059,10 @@
 def _update_metrics(self):
 metrics = self._metrics = self.font_output.get_metrics(
 self.font, self.c, self.fontsize, self.dpi)
- self.width = metrics.width
+ if self.c == ' ':
+ self.width = metrics.advance
+ else:
+ self.width = metrics.width
 self.height = metrics.iceberg
 self.depth = -(metrics.iceberg - metrics.height)
 
@@ -1124,7 +1124,9 @@
 elem = next
 
 def __repr__(self):
- s = '[' + self.__internal_repr__() + " <%d %d %d %d> " % (self.width, self.height, self.depth, self.shift_amount)
+ s = '[%s <%d %d %d %d> ' % (self.__internal_repr__(),
+ self.width, self.height,
+ self.depth, self.shift_amount)
 if self.list_head:
 s += ' ' + self.list_head.__repr__()
 s += ']'
@@ -1162,6 +1164,7 @@
 Box.shrink(self)
 if self.size < NUM_SIZE_LEVELS:
 self.shift_amount *= SHRINK_FACTOR
+ self.glue_set *= SHRINK_FACTOR
 
 class Hlist(List):
 """A horizontal list of boxes.
@@ -1186,12 +1189,6 @@
 kern.link = next
 elem = next
 
- def pack(self):
- if self.list_head:
- self.list_head.pack()
- self.hpack()
- Node.pack(self)
- 
 def hpack(self, w=0., m='additional'):
 """The main duty of hpack is to compute the dimensions of the
 resulting boxes, and to adjust the glue if one of those dimensions is
@@ -1265,12 +1262,6 @@
 List.__init__(self, elements)
 self.vpack()
 
- def pack(self):
- if self.list_head:
- self.list_head.pack()
- self.vpack()
- Node.pack(self)
- 
 def vpack(self, h=0., m='additional', l=float('inf')):
 """The main duty of vpack is to compute the dimensions of the
 resulting boxes, and to adjust the glue if one of those dimensions is
@@ -1386,6 +1377,13 @@
 glue_spec = glue_spec.copy()
 self.glue_spec = glue_spec
 
+ def shrink(self):
+ Node.shrink(self)
+ if self.size < NUM_SIZE_LEVELS:
+ if self.glue_spec.width != 0.:
+ self.glue_spec = self.glue_spec.copy()
+ self.glue_spec.width *= SHRINK_FACTOR
+ 
 class GlueSpec(object):
 """@150, @151"""
 def __init__(self, width=0., stretch=0., stretch_order=0, shrink=0., shrink_order=0):
@@ -1406,7 +1404,7 @@
 def factory(cls, glue_type):
 return cls._types[glue_type]
 factory = classmethod(factory)
-
+ 
 GlueSpec._types = {
 'fil': GlueSpec(0., 1., 1, 0., 0),
 'fill': GlueSpec(0., 1., 2, 0., 0),
@@ -1444,11 +1442,6 @@
 def __init__(self):
 Glue.__init__(self, 'neg_filll')
 
-class FixedGlue(Glue):
- def __init__(self, width):
- Glue.__init__(self, 'empty', copy=True)
- self.glue_spec.width = width
-
 class SsGlue(Glue):
 def __init__(self):
 Glue.__init__(self, 'ss')
@@ -1463,7 +1456,7 @@
 """A convenience class to create an Vlist whose contents are centered
 within its enclosing box."""
 def __init__(self, elements):
- Vlist.__init__(self, [Fill()] + elements + [Fill()])
+ Vlist.__init__(self, [SsGlue()] + elements + [SsGlue()])
 
 class Kern(Node):
 """A Kern node has a width field to specify a (normally negative)
@@ -1668,7 +1661,7 @@
 
 class Parser(object):
 _binary_operators = Set(r'''
- + - *
+ + *
 \pm \sqcap \rhd
 \mp \sqcup \unlhd
 \times \vee \unrhd
@@ -1711,6 +1704,16 @@
 _spaced_symbols = _binary_operators | _relation_symbols | _arrow_symbols
 
 _punctuation_symbols = Set(r', ; . ! \ldotp \cdotp'.split())
+
+ _overunder_symbols = Set(r'''
+ \sum \int \prod \coprod \oint \bigcap \bigcup \bigsqcup \bigvee
+ \bigwedge \bigodot \bigotimes \bigoplus \biguplus
+ '''.split()
+ )
+
+ _overunder_functions = Set(
+ r"lim liminf limsup sup max min".split()
+ )
 
 def __init__(self):
 # All forward declarations are here
@@ -1761,14 +1764,14 @@
 r"[a-zA-Z0-9 ]",
 r"[+\-*/]",
 r"[<>=]",
- r"[:,.;!]",
- r"[!@%&]",
- r"[[\]()]",
+ r"[:,.;!'@[()]",
 r"\\[$%{}]",
 ])
 + ")"
 ).setParseAction(self.symbol).leaveWhitespace()
 
+ rightBracket = Literal("[").setParseAction(self.symbol).leaveWhitespace()
+
 accent = Group(
 Combine(bslash + accent)
 + placeable
@@ -1800,11 +1803,30 @@
 + group
 ).setParseAction(self.frac).setName("frac")
 
+ sqrt = Group(
+ Suppress(
+ bslash
+ + Literal("sqrt")
+ )
+ + Optional(
+ Suppress(Literal("["))
+ + OneOrMore(
+ symbol
+ ^ font
+ )
+ + Suppress(Literal("]")),
+ default = None
+ )
+ + group
+ ).setParseAction(self.sqrt).setName("sqrt")
+
 placeable <<(accent
 ^ function 
 ^ symbol
+ ^ rightBracket
 ^ group
 ^ frac
+ ^ sqrt
 )
 
 simple <<(space
@@ -1939,7 +1961,10 @@
 elif c in self._punctuation_symbols:
 return [Hlist([Char(c, self.get_state()),
 self._make_space(0.3)])]
- return [Char(toks[0], self.get_state())]
+ try:
+ return [Char(toks[0], self.get_state())]
+ except:
+ raise ParseException()
 
 _accent_map = {
 r'\hat' : r'\circumflexaccent',
@@ -1971,7 +1996,7 @@
 centered.shift_amount = accent._metrics.xmin
 return Vlist([
 centered,
- FixedGlue(thickness * 2.0),
+ Vbox(0., thickness * 2.0),
 Hlist([sym])
 ])
 
@@ -1982,6 +2007,7 @@
 state.font = 'rm'
 hlist = Hlist([Char(c, state) for c in toks[0]])
 self.pop_state()
+ hlist.function_name = toks[0]
 return hlist
 
 def start_group(self, s, loc, toks):
@@ -2007,7 +2033,9 @@
 
 def is_overunder(self, nucleus):
 if isinstance(nucleus, Char):
- return overunder_symbols.has_key(nucleus.c)
+ return nucleus.c in self._overunder_symbols
+ elif isinstance(nucleus, Hlist) and hasattr(nucleus, 'function_name'):
+ return nucleus.function_name in self._overunder_functions
 return False
 
 def subsuperscript(self, s, loc, toks):
@@ -2061,24 +2089,22 @@
 width = nucleus.width
 if super is not None:
 super.shrink()
- super.pack()
 width = max(width, super.width)
 if sub is not None:
 sub.shrink()
- sub.pack()
 width = max(width, sub.width)
 
 if super is not None:
 hlist = HCentered([super])
 hlist.hpack(width, 'exactly')
- vlist.extend([hlist, FixedGlue(rule_thickness * 2.0)])
+ vlist.extend([hlist, Vbox(0., rule_thickness * 2.0)])
 hlist = HCentered([nucleus])
 hlist.hpack(width, 'exactly')
 vlist.append(hlist)
 if sub is not None:
 hlist = HCentered([sub])
 hlist.hpack(width, 'exactly')
- vlist.extend([FixedGlue(rule_thickness), hlist])
+ vlist.extend([Vbox(0., rule_thickness), hlist])
 shift = hlist.height + hlist.depth + rule_thickness * 2.0
 vlist = Vlist(vlist)
 vlist.shift_amount = shift
@@ -2086,12 +2112,12 @@
 return [result]
 
 shift_up = nucleus.height - SUBDROP * xHeight
- shift_down = nucleus.depth + SUBDROP * xHeight
+ shift_down = SUBDROP * xHeight
 if super is None:
 # @757
 sub.shrink()
 x = Hlist([sub])
- #x.width += SCRIPT_SPACE
+ x.width += SCRIPT_SPACE * xHeight
 shift_down = max(shift_down, SUB1)
 clr = x.height - (abs(xHeight * 4.0) / 5.0)
 shift_down = max(shift_down, clr)
@@ -2099,7 +2125,7 @@
 else:
 super.shrink()
 x = Hlist([super])
- #x.width += SCRIPT_SPACE
+ x.width += SCRIPT_SPACE * xHeight
 clr = SUP1 * xHeight
 shift_up = max(shift_up, clr)
 clr = x.depth + (abs(xHeight) / 4.0)
@@ -2109,13 +2135,13 @@
 else: # Both sub and superscript
 sub.shrink()
 y = Hlist([sub])
- #y.width += SCRIPT_SPACE
+ y.width += SCRIPT_SPACE * xHeight
 shift_down = max(shift_down, SUB1 * xHeight)
 clr = 4.0 * rule_thickness - ((shift_up - x.depth) - (y.height - shift_down))
 if clr > 0.:
 shift_up += clr
 shift_down += clr
- x.shift_amount = DELTA
+ x.shift_amount = DELTA * xHeight
 x = Vlist([x,
 Kern((shift_up - x.depth) - (y.height - shift_down)),
 y])
@@ -2127,33 +2153,78 @@
 def frac(self, s, loc, toks):
 assert(len(toks)==1)
 assert(len(toks[0])==2)
+ state = self.get_state()
+ thickness = state.font_output.get_underline_thickness(
+ state.font, state.fontsize, state.dpi)
+ 
 num, den = toks[0]
 num.shrink()
 den.shrink()
 cnum = HCentered([num])
 cden = HCentered([den])
- width = max(num.width, den.height)
+ width = max(num.width, den.width) + thickness * 10.
 cnum.hpack(width, 'exactly')
 cden.hpack(width, 'exactly')
- state = self.get_state()
- thickness = state.font_output.get_underline_thickness(
- state.font, state.fontsize, state.dpi)
- space = thickness * 3.0
 vlist = Vlist([cnum,
- FixedGlue(thickness * 2.0),
- Hrule(self.get_state()),
- FixedGlue(thickness * 3.0),
+ Vbox(0, thickness * 2.0),
+ Hrule(state),
+ Vbox(0, thickness * 4.0),
 cden
 ])
 
+ # Shift so the fraction line sits in the middle of the
+ # equals sign
 metrics = state.font_output.get_metrics(
 state.font, '=', state.fontsize, state.dpi)
- shift = cden.height - (metrics.ymax + metrics.ymin) / 2 + thickness * 2.5
+ shift = (cden.height -
+ (metrics.ymax + metrics.ymin) / 2 +
+ thickness * 2.5)
 vlist.shift_amount = shift
 
- hlist = Hlist([vlist, FixedGlue(thickness * 2.)])
+ hlist = Hlist([vlist, Hbox(thickness * 2.)])
 return [hlist]
 
+ def sqrt(self, s, loc, toks):
+ #~ print "sqrt", toks
+ root, body = toks[0]
+ state = self.get_state()
+ thickness = state.font_output.get_underline_thickness(
+ state.font, state.fontsize, state.dpi)
+
+ if root is None:
+ root = Box()
+ else:
+ root.shrink()
+ root.shrink()
+
+ # Add a little extra to the height so the body
+ # doesn't seem cramped
+ height = body.height - body.shift_amount + thickness * 5.0
+ depth = body.depth + body.shift_amount
+ check = AutoSizedDelim(r'\sqrt', height, depth, state)
+
+ height = check.height - check.shift_amount
+ depth = check.depth + check.shift_amount
+ rightside = Vlist([Hrule(state),
+ Fill(),
+ # Pack a little extra to the left and right
+ # of the body
+ Hlist([Hbox(thickness * 2.0),
+ body,
+ Hbox(thickness * 2.0)])])
+ # Stretch the glue between the hrule and the body
+ rightside.vpack(height + 1.0, depth, 'exactly')
+
+ root_vlist = Vlist([Hlist([root])])
+ root_vlist.shift_amount = -height * 0.5
+ 
+ hlist = Hlist([root_vlist,
+ Kern(-check.width * 0.5),
+ check,
+ Kern(-thickness * 0.5),
+ rightside])
+ return [hlist]
+ 
 def auto_sized_delimiter(self, s, loc, toks):
 #~ print "auto_sized_delimiter", toks
 front, middle, back = toks
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2007年07月30日 02:04:54
Revision: 3628
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3628&view=rev
Author: efiring
Date: 2007年07月29日 19:04:46 -0700 (2007年7月29日)
Log Message:
-----------
changed pcolor default to shading='flat'; related cleanups
Modified Paths:
--------------
 trunk/matplotlib/API_CHANGES
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/examples/pcolor_demo.py
 trunk/matplotlib/examples/pcolor_log.py
 trunk/matplotlib/examples/pcolor_small.py
 trunk/matplotlib/lib/matplotlib/artist.py
 trunk/matplotlib/lib/matplotlib/axes.py
 trunk/matplotlib/lib/matplotlib/collections.py
Modified: trunk/matplotlib/API_CHANGES
===================================================================
--- trunk/matplotlib/API_CHANGES	2007年07月29日 08:03:12 UTC (rev 3627)
+++ trunk/matplotlib/API_CHANGES	2007年07月30日 02:04:46 UTC (rev 3628)
@@ -1,3 +1,6 @@
+ Changed pcolor default to shading='flat'; but as noted now in the
+ docstring, it is preferable to simply use the edgecolor kwarg.
+
 The mathtext font commands (\cal, \rm, \it, \tt) now behave as TeX
 does: they are in effect until the next font change command or the
 end of the grouping. Therefore uses of $\cal{R}$ should be
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2007年07月29日 08:03:12 UTC (rev 3627)
+++ trunk/matplotlib/CHANGELOG	2007年07月30日 02:04:46 UTC (rev 3628)
@@ -1,54 +1,58 @@
+2007年07月29日 Changed default pcolor shading to flat; added aliases
+ to make collection kwargs agree with setter names, so
+ updating works; related minor cleanups.
+
 2007年07月26日 Major rewrite of mathtext.py, using the TeX box layout model.
 
-	 There is one (known) backward incompatible change. The
-	 font commands (\cal, \rm, \it, \tt) now behave as TeX does:
-	 they are in effect until the next font change command or
-	 the end of the grouping. Therefore uses of $\cal{R}$
-	 should be changed to ${\cal R}$. Alternatively, you may
-	 use the new LaTeX-style font commands (\mathcal, \mathrm,
-	 \mathit, \mathtt) which do affect the following group,
-	 eg. $\mathcal{R}$.
+ There is one (known) backward incompatible change. The
+ font commands (\cal, \rm, \it, \tt) now behave as TeX does:
+ they are in effect until the next font change command or
+ the end of the grouping. Therefore uses of $\cal{R}$
+ should be changed to ${\cal R}$. Alternatively, you may
+ use the new LaTeX-style font commands (\mathcal, \mathrm,
+ \mathit, \mathtt) which do affect the following group,
+ eg. $\mathcal{R}$.
 
-	 Other new features include:
+ Other new features include:
 
-	 - Math may be interspersed with non-math text. Any text
+ - Math may be interspersed with non-math text. Any text
 with an even number of $'s (non-escaped) will be sent to
-	 the mathtext parser for layout.
+ the mathtext parser for layout.
 
-	 - Sub/superscripts are less likely to accidentally overlap.
+ - Sub/superscripts are less likely to accidentally overlap.
 
-	 - Support for sub/superscripts in either order, eg. $x^i_j$
+ - Support for sub/superscripts in either order, eg. $x^i_j$
 and $x_j^i$ are equivalent.
 
-	 - Double sub/superscripts (eg. $x_i_j$) are considered
+ - Double sub/superscripts (eg. $x_i_j$) are considered
 ambiguous and raise an exception. Use braces to disambiguate.
 
-	 - $\frac{x}{y}$ can be used for displaying fractions.
+ - $\frac{x}{y}$ can be used for displaying fractions.
 
-	 - $\sqrt[3]{x}$ can be used to display the radical symbol
+ - $\sqrt[3]{x}$ can be used to display the radical symbol
 with a root number and body.
 
-	 - $\left(\frac{x}{y}\right)$ may be used to create
+ - $\left(\frac{x}{y}\right)$ may be used to create
 parentheses and other delimiters that automatically
 resize to the height of their contents.
 
-	 - Spacing around operators etc. is now generally more like
+ - Spacing around operators etc. is now generally more like
 TeX.
 
- 	 - Added support (and fonts) for boldface (\bf) and
+ - Added support (and fonts) for boldface (\bf) and
 sans-serif (\sf) symbols.
 
-	 - Log-like function name shortcuts are supported. For
+ - Log-like function name shortcuts are supported. For
 example, $\sin(x)$ may be used instead of ${\rm sin}(x)$
 
-	 - Limited use of kerning for the easy case (same font)
+ - Limited use of kerning for the easy case (same font)
 
-	 Behind the scenes, the pyparsing.py module used for doing
-	 the math parsing was updated to the latest stable version
-	 (1.4.6). A lot of duplicate code was refactored out of the
-	 Font classes.
+ Behind the scenes, the pyparsing.py module used for doing
+ the math parsing was updated to the latest stable version
+ (1.4.6). A lot of duplicate code was refactored out of the
+ Font classes.
 
-	 - MGD
+ - MGD
 
 2007年07月19日 completed numpification of most trivial cases - NN
 
@@ -56,11 +60,11 @@
 
 2007年07月19日 replaced the Python code in numerix/ by a minimal wrapper around
 numpy that explicitly mentions all symbols that need to be
-	 addressed for further numpification - NN
+ addressed for further numpification - NN
 
-2007年07月18日 make usetex respect changes to rcParams. texmanager used to 
- only configure itself when it was created, now it 
- reconfigures when rcParams are changed. Thank you Alexander 
+2007年07月18日 make usetex respect changes to rcParams. texmanager used to
+ only configure itself when it was created, now it
+ reconfigures when rcParams are changed. Thank you Alexander
 Schmolck for contributing a patch - DSD
 
 2007年07月17日 added validation to setting and changing rcParams - DSD
@@ -71,7 +75,7 @@
 2007年07月16日 clean up some code in ticker.ScalarFormatter, use unicode to
 render multiplication sign in offset ticklabel - DSD
 
-2007年07月16日 fixed a formatting bug in ticker.ScalarFormatter's scientific 
+2007年07月16日 fixed a formatting bug in ticker.ScalarFormatter's scientific
 notation (10^0 was being rendered as 10 in some cases) - DSD
 
 2007年07月13日 Add MPL_isfinite64() and MPL_isinf64() for testing
@@ -83,7 +87,7 @@
 
 2007年07月13日 Removed the rest of the numerix extension code detritus,
 numpified axes.py, and cleaned up the imports in axes.py
-	 - JDH
+ - JDH
 
 2007年07月13日 Added legend.loc as configurable option that could in
 future default to 'best'. - NN
@@ -552,35 +556,35 @@
 
 2006年10月10日 deactivated rcfile-configurability of markerfacecolor
 and markeredgecolor. Both are now hardcoded to the special value
-	 'auto' to follow the line color. Configurability at run-time
-	 (using function arguments) remains functional. - NN
+ 'auto' to follow the line color. Configurability at run-time
+ (using function arguments) remains functional. - NN
 
 2006年10月07日 introduced dummy argument magnification=1.0 to
 FigImage.make_image to satisfy unit test figimage_demo.py
 The argument is not yet handled correctly, which should only
-	 show up when using non-standard DPI settings in PS backend,
-	 introduced by patch #1562394. - NN
+ show up when using non-standard DPI settings in PS backend,
+ introduced by patch #1562394. - NN
 
 2006年10月06日 add backend-agnostic example: simple3d.py - NN
 
 2006年09月29日 fix line-breaking for SVG-inline images (purely cosmetic) - NN
 
 2006年09月29日 reworked set_linestyle and set_marker
-	 markeredgecolor and markerfacecolor now default to
-	 a special value "auto" that keeps the color in sync with
-	 the line color
-	 further, the intelligence of axes.plot is cleaned up,
-	 improved and simplified. Complete compatibility cannot be
-	 guaranteed, but the new behavior should be much more predictable
-	 (see patch #1104615 for details) - NN
+ markeredgecolor and markerfacecolor now default to
+ a special value "auto" that keeps the color in sync with
+ the line color
+ further, the intelligence of axes.plot is cleaned up,
+ improved and simplified. Complete compatibility cannot be
+ guaranteed, but the new behavior should be much more predictable
+ (see patch #1104615 for details) - NN
 
 2006年09月29日 changed implementation of clip-path in SVG to work around a
 limitation in inkscape - NN
 
 2006年09月29日 added two options to matplotlibrc:
-	 svg.image_inline
-	 svg.image_noscale
-	 see patch #1533010 for details - NN
+ svg.image_inline
+ svg.image_noscale
+ see patch #1533010 for details - NN
 
 2006年09月29日 axes.py: cleaned up kwargs checking - NN
 
@@ -611,8 +615,8 @@
 2006年09月05日 Released 0.87.5 at revision 2761
 
 2006年09月04日 Added nxutils for some numeric add-on extension code --
-		 specifically a better/more efficient inside polygon tester (see
-		 unit/inside_poly_*.py) - JDH
+ specifically a better/more efficient inside polygon tester (see
+ unit/inside_poly_*.py) - JDH
 
 2006年09月04日 Made bitstream fonts the rc default - JDH
 
@@ -957,7 +961,7 @@
 2006年03月20日 Added contour.negative_linestyle rcParam - ADS
 
 2006年03月20日 Added _isnan extension module to test for nan with Numeric
-	 - ADS
+ - ADS
 
 2006年03月17日 Added Paul and Alex's support for faceting with quadmesh
 in sf patch 1411223 - JDH
@@ -1304,7 +1308,7 @@
 
 
 2005年11月09日 added axisbelow attr for Axes to determine whether ticks and such
- 	 are above or below the actors
+ are above or below the actors
 
 2005年11月08日 Added Nicolas' irregularly spaced image patch
 
@@ -1461,7 +1465,7 @@
 
 2005年07月24日 backend_gtk.py: modify print_figure() use own pixmap, fixing
 problems where print_figure() overwrites the display pixmap.
-	 return False from all button/key etc events - to allow the event
+ return False from all button/key etc events - to allow the event
 to propagate further - SC
 
 2005年07月23日 backend_gtk.py: change expose_event from using set_back_pixmap();
@@ -1483,7 +1487,7 @@
 2005年07月14日 Fixed a Windows related bug (#1238412) in texmanager - DSD
 
 2005年07月11日 Fixed color kwarg bug, setting color=1 or 0 caused an
-		 exception - DSD
+ exception - DSD
 
 2005年07月07日 Added Eric's MA set_xdata Line2D fix - JDH
 
@@ -1585,10 +1589,10 @@
 2005年06月13日 Exposed cap and join style for lines with new rc params and
 line properties
 
-	lines.dash_joinstyle : miter # miter|round|bevel
-	lines.dash_capstyle : butt # butt|round|projecting
-	lines.solid_joinstyle : miter # miter|round|bevel
-	lines.solid_capstyle : projecting # butt|round|projecting
+ lines.dash_joinstyle : miter # miter|round|bevel
+ lines.dash_capstyle : butt # butt|round|projecting
+ lines.solid_joinstyle : miter # miter|round|bevel
+ lines.solid_capstyle : projecting # butt|round|projecting
 
 
 2005年06月13日 Added kwargs to Axes init
@@ -1702,9 +1706,9 @@
 for the interp kwarg are
 
 'nearest', 'bilinear', 'bicubic', 'spline16', 'spline36',
-	 'hanning', 'hamming', 'hermite', 'kaiser', 'quadric',
-	 'catrom', 'gaussian', 'bessel', 'mitchell', 'sinc',
-	 'lanczos', 'blackman'
+ 'hanning', 'hamming', 'hermite', 'kaiser', 'quadric',
+ 'catrom', 'gaussian', 'bessel', 'mitchell', 'sinc',
+ 'lanczos', 'blackman'
 
 See help(imshow) for details, particularly the
 interpolation, filternorm and filterrad kwargs
Modified: trunk/matplotlib/examples/pcolor_demo.py
===================================================================
--- trunk/matplotlib/examples/pcolor_demo.py	2007年07月29日 08:03:12 UTC (rev 3627)
+++ trunk/matplotlib/examples/pcolor_demo.py	2007年07月30日 02:04:46 UTC (rev 3628)
@@ -19,7 +19,7 @@
 X,Y = meshgrid(x, y)
 
 Z = func3(X, Y)
-pcolor(X, Y, Z, shading='flat')
+pcolor(X, Y, Z)
 colorbar()
 axis([-3,3,-3,3])
 savefig('pcolor_demo')
Modified: trunk/matplotlib/examples/pcolor_log.py
===================================================================
--- trunk/matplotlib/examples/pcolor_log.py	2007年07月29日 08:03:12 UTC (rev 3627)
+++ trunk/matplotlib/examples/pcolor_log.py	2007年07月30日 02:04:46 UTC (rev 3628)
@@ -15,11 +15,11 @@
 Z1 = bivariate_normal(X, Y, 0.1, 0.2, 1.0, 1.0) + 0.1*bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
 
 subplot(2,1,1)
-pcolor(X, Y, Z1, shading='flat', norm=LogNorm(vmin=Z1.min(), vmax=Z1.max()))
+pcolor(X, Y, Z1, norm=LogNorm(vmin=Z1.min(), vmax=Z1.max()))
 colorbar()
 
 subplot(2,1,2)
-pcolor(X, Y, Z1, shading='flat')
+pcolor(X, Y, Z1)
 colorbar()
 
 
Modified: trunk/matplotlib/examples/pcolor_small.py
===================================================================
--- trunk/matplotlib/examples/pcolor_small.py	2007年07月29日 08:03:12 UTC (rev 3627)
+++ trunk/matplotlib/examples/pcolor_small.py	2007年07月30日 02:04:46 UTC (rev 3628)
@@ -2,15 +2,14 @@
 
 from pylab import *
 
-#Z = arange(60)
-#Z.shape = 6,10
-#Z.shape = 10,6
-#print Z
-Z = rand(10,6)
+Z = rand(6,10)
 
-#c = pcolor(Z, shading='flat') # default 'faceted'
+subplot(2,1,1)
 c = pcolor(Z)
-c.set_linewidth(4)
+title('default: no edges')
 
-#savefig('pcolor_small')
+subplot(2,1,2)
+c = pcolor(Z, edgecolors='k', linewidths=4)
+title('thick edges')
+
 show()
Modified: trunk/matplotlib/lib/matplotlib/artist.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/artist.py	2007年07月29日 08:03:12 UTC (rev 3627)
+++ trunk/matplotlib/lib/matplotlib/artist.py	2007年07月30日 02:04:46 UTC (rev 3628)
@@ -55,7 +55,7 @@
 Remove the artist from the figure if possible. The effect will not
 be visible until the figure is redrawn, e.g., with ax.draw_idle().
 Call ax.relim() to update the axes limits if desired.
- 
+
 Note: relim() will not see collections even if the collection
 was added to axes with autolim=True.
 
@@ -63,10 +63,10 @@
 '''
 
 # There is no method to set the callback. Instead the parent should set
- # the _remove_method attribute directly. This would be a protected 
+ # the _remove_method attribute directly. This would be a protected
 # attribute if Python supported that sort of thing. The callback
 # has one parameter, which is the child to be removed.
- if self._remove_method != None: 
+ if self._remove_method != None:
 self._remove_method(self)
 else:
 raise NotImplementedError('cannot remove artist')
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py	2007年07月29日 08:03:12 UTC (rev 3627)
+++ trunk/matplotlib/lib/matplotlib/axes.py	2007年07月30日 02:04:46 UTC (rev 3628)
@@ -3853,7 +3853,7 @@
 will be plotted.
 
 Other keyword args; the color mapping and normalization arguments will
- on be used if c is an array of floats
+ be used only if c is an array of floats
 
 * cmap = cm.jet : a colors.Colormap instance from cm.
 defaults to rc image.cmap
@@ -3876,7 +3876,12 @@
 
 * faceted: if True, will use the default edgecolor for the
 markers. If False, will set the edgecolors to be the same
- as the facecolors
+ as the facecolors.
+ This kwarg is deprecated;
+ please use the edgecolors kwarg instead:
+ shading='flat' --> edgecolors='None'
+ shading='faceted --> edgecolors=None
+ edgecolors also can be any mpl color or sequence of colors.
 
 Optional kwargs control the PatchCollection properties:
 %(PatchCollection)s
@@ -4468,7 +4473,14 @@
 instance, vmin and vmax will be None
 
 * shading = 'flat' : or 'faceted'. If 'faceted', a black grid is
- drawn around each rectangle; if 'flat', edges are not drawn
+ drawn around each rectangle; if 'flat', edges are not drawn.
+ Default is 'flat', contrary to Matlab(TM).
+ This kwarg is deprecated;
+ please use the edgecolors kwarg instead:
+ shading='flat' --> edgecolors='None'
+ shading='faceted --> edgecolors='k'
+ edgecolors can also be None to specify the rcParams
+ default, or any mpl color or sequence of colors.
 
 * alpha=1.0 : the alpha blending value
 
@@ -4526,7 +4538,7 @@
 cmap = kwargs.pop('cmap', None)
 vmin = kwargs.pop('vmin', None)
 vmax = kwargs.pop('vmax', None)
- shading = kwargs.pop('shading', 'faceted')
+ shading = kwargs.pop('shading', 'flat')
 
 if len(args)==1:
 C = args[0]
@@ -4586,14 +4598,11 @@
 edgecolors = (0,0,0,1),
 else:
 edgecolors = 'None'
+ kwargs.setdefault('edgecolors', edgecolors)
+ kwargs.setdefault('antialiaseds', (0,))
+ kwargs.setdefault('linewidths', (0.25,))
 
- collection = mcoll.PolyCollection(
- verts,
- edgecolors = edgecolors,
- antialiaseds = (0,),
- linewidths = (0.25,),
- **kwargs
- )
+ collection = mcoll.PolyCollection(verts, **kwargs)
 
 collection.set_alpha(alpha)
 collection.set_array(C)
@@ -4652,8 +4661,14 @@
 min and max of the color array C is used.
 
 * shading = 'flat' : or 'faceted'. If 'faceted', a black grid is
- drawn around each rectangle; if 'flat', edge colors are same as
- face colors
+ drawn around each rectangle; if 'flat', edges are not drawn.
+ Default is 'flat', contrary to Matlab(TM).
+ This kwarg is deprecated;
+ please use the edgecolors kwarg instead:
+ shading='flat' --> edgecolors='None'
+ shading='faceted --> edgecolors='k'
+ More flexible specification of edgecolors, as in pcolor,
+ is not presently supported.
 
 * alpha=1.0 : the alpha blending value
 
@@ -4675,7 +4690,8 @@
 cmap = kwargs.pop('cmap', None)
 vmin = kwargs.pop('vmin', None)
 vmax = kwargs.pop('vmax', None)
- shading = kwargs.pop('shading', 'faceted')
+ shading = kwargs.pop('shading', 'flat')
+ edgecolors = kwargs.pop('edgecolors', 'None')
 
 if len(args)==1:
 C = args[0]
@@ -4703,13 +4719,13 @@
 coords[:, 0] = X
 coords[:, 1] = Y
 
- if shading == 'faceted':
+ if shading == 'faceted' or edgecolors != 'None':
 showedges = 1
 else:
 showedges = 0
 
 collection = mcoll.QuadMesh(
- Nx - 1, Ny - 1, coords, showedges, **kwargs)
+ Nx - 1, Ny - 1, coords, showedges) # kwargs are not used
 collection.set_alpha(alpha)
 collection.set_array(C)
 if norm is not None: assert(isinstance(norm, mcolors.Normalize))
Modified: trunk/matplotlib/lib/matplotlib/collections.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/collections.py	2007年07月29日 08:03:12 UTC (rev 3627)
+++ trunk/matplotlib/lib/matplotlib/collections.py	2007年07月30日 02:04:46 UTC (rev 3628)
@@ -21,16 +21,12 @@
 
 class Collection(artist.Artist):
 """
- All properties in a collection must be sequences. The
+ All properties in a collection must be sequences or scalars;
+ if scalars, they will be converted to sequences. The
 property of the ith element of the collection is the
 
 prop[i % len(props)].
 
- This implies that the properties cycle if the len of props is less
- than the number of elements of the collection. A length 1
- property is shared by all the elements of the collection
-
- All color args to a collection are sequences of rgba tuples
 """
 
 def __init__(self):
@@ -133,8 +129,8 @@
 linewidths = (0,)
 else:
 self._edgecolors = _colors.colorConverter.to_rgba_list(edgecolors)
- self._linewidths = linewidths
- self._antialiaseds = antialiaseds
+ self._linewidths = self._get_value(linewidths)
+ self._antialiaseds = self._get_value(antialiaseds)
 #self._offsets = offsets
 self._offsets = offsets
 self._transOffset = transOffset
@@ -221,6 +217,8 @@
 ACCEPTS: float or sequence of floats
 """
 self._linewidths = self._get_value(lw)
+ def set_linewidths(self, lw):
+ self.set_linewidth(lw)
 
 def set_color(self, c):
 """
@@ -242,16 +240,23 @@
 ACCEPTS: matplotlib color arg or sequence of rgba tuples
 """
 self._facecolors = _colors.colorConverter.to_rgba_list(c)
+ def set_facecolors(self, c):
+ self.set_facecolor(c)
 
 def set_edgecolor(self, c):
 """
- Set the facecolor(s) of the collection. c can be a matplotlib color
+ Set the edgecolor(s) of the collection. c can be a matplotlib color
 arg (all patches have same color), or a a sequence or rgba tuples; if
 it is a sequence the patches will cycle through the sequence
 
 ACCEPTS: matplotlib color arg or sequence of rgba tuples
 """
- self._edgecolors = _colors.colorConverter.to_rgba_list(c)
+ if c == 'None':
+ self._linewidths = (0.0,)
+ else:
+ self._edgecolors = _colors.colorConverter.to_rgba_list(c)
+ def set_edgecolors(self, c):
+ self.set_edgecolor(c)
 
 def set_alpha(self, alpha):
 """
@@ -568,7 +573,8 @@
 
 class LineCollection(Collection, cm.ScalarMappable):
 """
- All parameters must be sequences. The property of the ith line
+ All parameters must be sequences or scalars; if scalars, they will
+ be converted to sequences. The property of the ith line
 segment is the prop[i % len(props)], ie the properties cycle if
 the len of props is less than the number of sements
 """
@@ -637,8 +643,8 @@
 antialiaseds = (mpl.rcParams['lines.antialiased'], )
 
 self._colors = _colors.colorConverter.to_rgba_list(colors)
- self._aa = antialiaseds
- self._lw = linewidths
+ self._aa = self._get_value(antialiaseds)
+ self._lw = self._get_value(linewidths)
 self.set_linestyle(linestyle)
 self._uniform_offsets = None
 if offsets is not None:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2007年07月30日 07:03:49
Revision: 3630
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3630&view=rev
Author: efiring
Date: 2007年07月30日 00:03:47 -0700 (2007年7月30日)
Log Message:
-----------
Removed last vestiges of old pcolor, scatter, quiver versions.
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/boilerplate.py
 trunk/matplotlib/lib/matplotlib/axes.py
 trunk/matplotlib/lib/matplotlib/pylab.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2007年07月30日 06:04:41 UTC (rev 3629)
+++ trunk/matplotlib/CHANGELOG	2007年07月30日 07:03:47 UTC (rev 3630)
@@ -1,6 +1,7 @@
 2007年07月29日 Changed default pcolor shading to flat; added aliases
 to make collection kwargs agree with setter names, so
 updating works; related minor cleanups.
+ Removed quiver_classic, scatter_classic, pcolor_classic. - EF
 
 2007年07月26日 Major rewrite of mathtext.py, using the TeX box layout model.
 
Modified: trunk/matplotlib/boilerplate.py
===================================================================
--- trunk/matplotlib/boilerplate.py	2007年07月30日 06:04:41 UTC (rev 3629)
+++ trunk/matplotlib/boilerplate.py	2007年07月30日 07:03:47 UTC (rev 3630)
@@ -82,7 +82,6 @@
 'stem',
 'vlines',
 'quiver',
- 'quiver2',
 'quiverkey',
 'xcorr',
 )
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py	2007年07月30日 06:04:41 UTC (rev 3629)
+++ trunk/matplotlib/lib/matplotlib/axes.py	2007年07月30日 07:03:47 UTC (rev 3630)
@@ -4051,34 +4051,6 @@
 
 scatter.__doc__ = cbook.dedent(scatter.__doc__) % martist.kwdocd
 
- def scatter_classic(self, x, y, s=None, c='b'):
- """
- scatter_classic is no longer available; please use scatter.
- To help in porting, for comparison to the scatter docstring,
- here is the scatter_classic docstring:
-
- SCATTER_CLASSIC(x, y, s=None, c='b')
-
- Make a scatter plot of x versus y. s is a size (in data coords) and
- can be either a scalar or an array of the same length as x or y. c is
- a color and can be a single color format string or an length(x) array
- of intensities which will be mapped by the colormap jet.
-
- If size is None a default size will be used
- """
- raise NotImplementedError('scatter_classic has been removed;\n'
- + 'please use scatter instead')
-
- def pcolor_classic(self, *args):
- """
- pcolor_classic is no longer available; please use pcolor,
- which is a drop-in replacement.
- """
- raise NotImplementedError('pcolor_classic has been removed;\n'
- + 'please use pcolor instead')
-
-
-
 def arrow(self, x, y, dx, dy, **kwargs):
 """
 Draws arrow on specified axis from (x,y) to (x+dx,y+dy).
@@ -4097,164 +4069,14 @@
 return qk
 quiverkey.__doc__ = mquiver.QuiverKey.quiverkey_doc
 
- def quiver2(self, *args, **kw):
+ def quiver(self, *args, **kw):
 q = mquiver.Quiver(self, *args, **kw)
 self.add_collection(q)
 self.update_datalim_numerix(q.X, q.Y)
 self.autoscale_view()
 return q
- quiver2.__doc__ = mquiver.Quiver.quiver_doc
-
- def quiver(self, *args, **kw):
- if (len(args) == 3 or len(args) == 5) and not iterable(args[-1]):
- return self.quiver_classic(*args, **kw)
- c = kw.get('color', None)
- if c is not None:
- if not mcolors.is_color_like(c):
- assert npy.shape(npy.asarray(c)) == npy.shape(npy.asarray(args[-1]))
- return self.quiver_classic(*args, **kw)
- return self.quiver2(*args, **kw)
 quiver.__doc__ = mquiver.Quiver.quiver_doc
 
- def quiver_classic(self, U, V, *args, **kwargs ):
- """
- QUIVER( X, Y, U, V )
- QUIVER( U, V )
- QUIVER( X, Y, U, V, S)
- QUIVER( U, V, S )
- QUIVER( ..., color=None, width=1.0, cmap=None, norm=None )
-
- Make a vector plot (U, V) with arrows on a grid (X, Y)
-
- If X and Y are not specified, U and V must be 2D arrays.
- Equally spaced X and Y grids are then generated using the
- meshgrid command.
-
- color can be a color value or an array of colors, so that the
- arrows can be colored according to another dataset. If cmap
- is specified and color is 'length', the colormap is used to
- give a color according to the vector's length.
-
- If color is a scalar field, the colormap is used to map the
- scalar to a color If a colormap is specified and color is an
- array of color triplets, then the colormap is ignored
-
- width is a scalar that controls the width of the arrows
-
- if S is specified it is used to scale the vectors. Use S=0 to
- disable automatic scaling. If S!=0, vectors are scaled to fit
- within the grid and then are multiplied by S.
-
-
- """
- msg = '''This version of quiver is obsolete and will be
- phased out; please use the new quiver.
- '''
- warnings.warn(msg, DeprecationWarning)
- if not self._hold: self.cla()
- do_scale = True
- S = 1.0
- if len(args)==0:
- # ( U, V )
- U = npy.asarray(U)
- V = npy.asarray(V)
- X,Y = mlab.meshgrid( npy.arange(U.shape[1]), npy.arange(U.shape[0]) )
- elif len(args)==1:
- # ( U, V, S )
- U = npy.asarray(U)
- V = npy.asarray(V)
- X,Y = mlab.meshgrid( npy.arange(U.shape[1]), npy.arange(U.shape[0]) )
- S = float(args[0])
- do_scale = ( S != 0.0 )
- elif len(args)==2:
- # ( X, Y, U, V )
- X = npy.asarray(U)
- Y = npy.asarray(V)
- U = npy.asarray(args[0])
- V = npy.asarray(args[1])
- elif len(args)==3:
- # ( X, Y, U, V )
- X = npy.asarray(U)
- Y = npy.asarray(V)
- U = npy.asarray(args[0])
- V = npy.asarray(args[1])
- S = float(args[2])
- do_scale = ( S != 0.0 )
-
- assert U.shape == V.shape
- assert X.shape == Y.shape
- assert U.shape == X.shape
-
- U = U.ravel()
- V = V.ravel()
- X = X.ravel()
- Y = Y.ravel()
-
- arrows = []
- N = npy.sqrt( U**2+V**2 )
- if do_scale:
- Nmax = maximum.reduce(N) or 1 # account for div by zero
- U = U*(S/Nmax)
- V = V*(S/Nmax)
- N = N*Nmax
-
- alpha = kwargs.pop('alpha', 1.0)
- width = kwargs.pop('width', .5)
- norm = kwargs.pop('norm', None)
- cmap = kwargs.pop('cmap', None)
- vmin = kwargs.pop('vmin', None)
- vmax = kwargs.pop('vmax', None)
- color = kwargs.pop('color', None)
- shading = kwargs.pop('shading', 'faceted')
-
- if len(kwargs):
- raise TypeError(
- "quiver() got an unexpected keyword argument '%s'"%kwargs.keys()[0])
-
- C = None
- if color == 'length' or color is True:
- if color is True:
- warnings.warn('''Use "color='length'",
- not "color=True"''', DeprecationWarning)
- C = N
- elif color is None:
- color = (0,0,0,1)
- else:
- clr = npy.asarray(color).ravel()
- if clr.shape == U.shape:
- C = clr
-
- I = U.shape[0]
- arrows = [mpatches.FancyArrow(X[i],Y[i],U[i],V[i],0.1*S ).get_verts()
- for i in xrange(I)]
-
- collection = mcoll.PolyCollection(
- arrows,
- edgecolors = 'None',
- antialiaseds = (1,),
- linewidths = (width,),
- )
- if C is not None:
- collection.set_array( C.ravel() )
- collection.set_cmap(cmap)
- collection.set_norm(norm)
- if norm is not None:
- collection.set_clim( vmin, vmax )
- else:
- collection.set_facecolor(color)
- self.add_collection( collection )
-
- lims = npy.asarray(arrows)
- _max = maximum.reduce( maximum.reduce( lims ))
- _min = minimum.reduce( minimum.reduce( lims ))
- self.update_datalim( [ tuple(_min), tuple(_max) ] )
- self.autoscale_view()
- return collection
-
-
-
-
-
 def fill(self, *args, **kwargs):
 """
 FILL(*args, **kwargs)
Modified: trunk/matplotlib/lib/matplotlib/pylab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/pylab.py	2007年07月30日 06:04:41 UTC (rev 3629)
+++ trunk/matplotlib/lib/matplotlib/pylab.py	2007年07月30日 07:03:47 UTC (rev 3630)
@@ -335,64 +335,6 @@
 colorbar.__doc__ = colorbar_doc
 
 
-def colorbar_classic(mappable = None,
- cax=None,
- orientation='vertical',
- tickfmt='%1.1f',
- cspacing='proportional',
- clabels=None,
- drawedges=False,
- edgewidth=0.5,
- edgecolor='k'):
- """
- Create a colorbar for mappable; if mappable is None,
- use current image.
-
- tickfmt is a format string to format the colorbar ticks
-
- cax is a colorbar axes instance in which the colorbar will be
- placed. If None, as default axesd will be created resizing the
- current aqxes to make room for it. If not None, the supplied axes
- will be used and the other axes positions will be unchanged.
-
- orientation is the colorbar orientation: one of 'vertical' | 'horizontal'
-
- cspacing controls how colors are distributed on the colorbar.
- if cspacing == 'linear', each color occupies an equal area
- on the colorbar, regardless of the contour spacing.
- if cspacing == 'proportional' (Default), the area each color
- occupies on the the colorbar is proportional to the contour interval.
- Only relevant for a Contour image.
-
- clabels can be a sequence containing the
- contour levels to be labelled on the colorbar, or None (Default).
- If clabels is None, labels for all contour intervals are
- displayed. Only relevant for a Contour image.
-
- if drawedges == True, lines are drawn at the edges between
- each color on the colorbar. Default False.
-
- edgecolor is the line color delimiting the edges of the colors
- on the colorbar (if drawedges == True). Default black ('k')
-
- edgewidth is the width of the lines delimiting the edges of
- the colors on the colorbar (if drawedges == True). Default 0.5
-
- return value is the colorbar axes instance
- """
- if mappable is None:
- mappable = gci()
- ret = gcf().colorbar_classic(mappable, cax = cax,
- orientation = orientation,
- tickfmt = tickfmt,
- cspacing=cspacing,
- clabels=clabels,
- drawedges=drawedges,
- edgewidth=edgewidth,
- edgecolor=edgecolor)
- draw_if_interactive()
- return ret
-
 def colors():
 """
 This is a do nothing function to provide you with help on how
@@ -1606,19 +1548,6 @@
 
 draw_if_interactive()
 
-### Deprecated functions:
-def scatter_classic(*args, **kwargs):
- return gca().scatter_classic(*args, **kwargs)
-if Axes.scatter_classic.__doc__ is not None:
- scatter_classic.__doc__ = dedent(Axes.scatter_classic.__doc__)
-
-def pcolor_classic(*args, **kwargs):
- return gca().pcolor_classic(*args, **kwargs)
-if Axes.pcolor_classic.__doc__ is not None:
- pcolor_classic.__doc__ = dedent(Axes.pcolor_classic.__doc__)
-
-
-
 ### Do not edit below this point
 # This function was autogenerated by boilerplate.py. Do not edit as
 # changes will be lost
@@ -2357,27 +2286,6 @@
 
 # This function was autogenerated by boilerplate.py. Do not edit as
 # changes will be lost
-def quiver2(*args, **kwargs):
- # allow callers to override the hold state by passing hold=True|False
- b = ishold()
- h = popd(kwargs, 'hold', None)
- if h is not None:
- hold(h)
- try:
- ret = gca().quiver2(*args, **kwargs)
- draw_if_interactive()
- except:
- hold(b)
- raise
- gci._current = ret
- hold(b)
- return ret
-if Axes.quiver2.__doc__ is not None:
- quiver2.__doc__ = dedent(Axes.quiver2.__doc__) + """
-Addition kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py. Do not edit as
-# changes will be lost
 def quiverkey(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ds...@us...> - 2007年07月30日 17:41:37
Revision: 3632
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3632&view=rev
Author: dsdale
Date: 2007年07月30日 10:41:14 -0700 (2007年7月30日)
Log Message:
-----------
Ability to use new, traited configuration system in mpl
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/lib/matplotlib/__init__.py
 trunk/matplotlib/lib/matplotlib/config/__init__.py
 trunk/matplotlib/lib/matplotlib/config/cutils.py
 trunk/matplotlib/lib/matplotlib/config/mplconfig.py
 trunk/matplotlib/lib/matplotlib/mpl-data/matplotlibrc
 trunk/matplotlib/setup.py
Removed Paths:
-------------
 trunk/matplotlib/lib/matplotlib/config/api.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2007年07月30日 16:41:53 UTC (rev 3631)
+++ trunk/matplotlib/CHANGELOG	2007年07月30日 17:41:14 UTC (rev 3632)
@@ -1,3 +1,12 @@
+2007年07月30日 Reorganized configuration code to work with traited config
+ objects. The new config system is located in the 
+ matplotlib.config package, but it is disabled by default.
+ To enable it, set NEWCONFIG=True in matplotlib.__init__.py.
+ The new configuration system will still use the old 
+ matplotlibrc files by default. To switch to the experimental,
+ traited configuration, set USE_TRAITED_CONFIG=True in 
+ config.__init__.py.
+
 2007年07月29日 Changed default pcolor shading to flat; added aliases
 to make collection kwargs agree with setter names, so
 updating works; related minor cleanups.
Modified: trunk/matplotlib/lib/matplotlib/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/__init__.py	2007年07月30日 16:41:53 UTC (rev 3631)
+++ trunk/matplotlib/lib/matplotlib/__init__.py	2007年07月30日 17:41:14 UTC (rev 3632)
@@ -55,6 +55,7 @@
 """
 from __future__ import generators
 
+NEWCONFIG = False
 
 __version__ = '0.90.1'
 __revision__ = '$Revision$'
@@ -706,6 +707,13 @@
 """
 rcParams.update(rcParamsDefault)
 
+if NEWCONFIG:
+ print "importing from reorganized config system!"
+ from config import rcParams, rcdefaults
+ try:
+ from config import mplConfig, save_config
+ except:
+ pass
 
 def use(arg):
 """
Modified: trunk/matplotlib/lib/matplotlib/config/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/__init__.py	2007年07月30日 16:41:53 UTC (rev 3631)
+++ trunk/matplotlib/lib/matplotlib/config/__init__.py	2007年07月30日 17:41:14 UTC (rev 3632)
@@ -1 +1,12 @@
-# Please keep this file empty
\ No newline at end of file
+# Please keep this file empty
+
+USE_TRAITED_CONFIG = False
+
+from rcparams import rc
+from cutils import get_config_file
+
+if USE_TRAITED_CONFIG:
+ print 'Using new config system!'
+ from mplconfig import rcParams, mplConfig, save_config, rcdefaults
+else:
+ from rcparams import rcParams, rcdefaults
Deleted: trunk/matplotlib/lib/matplotlib/config/api.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/api.py	2007年07月30日 16:41:53 UTC (rev 3631)
+++ trunk/matplotlib/lib/matplotlib/config/api.py	2007年07月30日 17:41:14 UTC (rev 3632)
@@ -1,12 +0,0 @@
-"""
-"""
-
-USE_NEW_CONFIG = True
-
-from rcparams import rc
-from cutils import get_config_file
-
-if USE_NEW_CONFIG:
- from mplconfig import rcParams, mplConfig, save_config
-else:
- from rcparams import rcParams
Modified: trunk/matplotlib/lib/matplotlib/config/cutils.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/cutils.py	2007年07月30日 16:41:53 UTC (rev 3631)
+++ trunk/matplotlib/lib/matplotlib/config/cutils.py	2007年07月30日 17:41:14 UTC (rev 3632)
@@ -179,4 +179,4 @@
 fname = os.path.join(path, filename)
 if not os.path.exists(fname):
 warnings.warn('Could not find %s; using defaults'%filename)
- return fname
\ No newline at end of file
+ return fname
Modified: trunk/matplotlib/lib/matplotlib/config/mplconfig.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/mplconfig.py	2007年07月30日 16:41:53 UTC (rev 3631)
+++ trunk/matplotlib/lib/matplotlib/config/mplconfig.py	2007年07月30日 17:41:14 UTC (rev 3632)
@@ -10,6 +10,7 @@
 # internal imports
 import mpltraits as mplT
 import cutils
+import checkdep
 from tconfig import TConfig, TConfigManager
 import pytz
 
@@ -266,210 +267,220 @@
 dpi = T.Float(100)
 facecolor = T.Trait('white', mplT.ColorHandler())
 edgecolor = T.Trait('white', mplT.ColorHandler())
-	orientation = T.Trait('portrait', 'portrait', 'landscape')
+ orientation = T.Trait('portrait', 'portrait', 'landscape')
 
 class verbose(TConfig):
 level = T.Trait('silent', 'silent', 'helpful', 'debug', 'debug-annoying')
 fileo = T.Trait('sys.stdout', 'sys.stdout', T.File)
 
 
-config_file = cutils.get_config_file(tconfig=True)
-old_config_file = cutils.get_config_file(tconfig=False)
-print 
-if os.path.exists(old_config_file) and not os.path.exists(config_file):
- CONVERT = True
-else: CONVERT = False
-configManager = TConfigManager(MPLConfig,
- cutils.get_config_file(tconfig=True),
- filePriority=True)
-mplConfig = configManager.tconf
-
-
-def save_config():
- """Save mplConfig customizations to current matplotlib.conf
- """
- configManager.write()
-
-
 class RcParamsWrapper(dict):
 
 """A backwards-compatible interface to a traited config object
 """
 
- tconf = {
- 'backend' : (mplConfig.backend, 'use'),
- 'numerix' : (mplConfig, 'numerix'),
- 'maskedarray' : (mplConfig, 'maskedarray'),
- 'toolbar' : (mplConfig, 'toolbar'),
- 'datapath' : (mplConfig, 'datapath'),
- 'units' : (mplConfig, 'units'),
- 'interactive' : (mplConfig, 'interactive'),
- 'timezone' : (mplConfig, 'timezone'),
+ def __init__(self, tconfig):
+ self.tconfig = tconfig
+ 
+ self.tconfig_map = {
+ 'backend' : (self.tconfig.backend, 'use'),
+ 'numerix' : (self.tconfig, 'numerix'),
+ 'maskedarray' : (self.tconfig, 'maskedarray'),
+ 'toolbar' : (self.tconfig, 'toolbar'),
+ 'datapath' : (self.tconfig, 'datapath'),
+ 'units' : (self.tconfig, 'units'),
+ 'interactive' : (self.tconfig, 'interactive'),
+ 'timezone' : (self.tconfig, 'timezone'),
 
- # the verbosity setting
- 'verbose.level' : (mplConfig.verbose, 'level'),
- 'verbose.fileo' : (mplConfig.verbose, 'fileo'),
+ # the verbosity setting
+ 'verbose.level' : (self.tconfig.verbose, 'level'),
+ 'verbose.fileo' : (self.tconfig.verbose, 'fileo'),
 
- # line props
- 'lines.linewidth' : (mplConfig.lines, 'linewidth'),
- 'lines.linestyle' : (mplConfig.lines, 'linestyle'),
- 'lines.color' : (mplConfig.lines, 'color'),
- 'lines.marker' : (mplConfig.lines, 'marker'),
- 'lines.markeredgewidth' : (mplConfig.lines, 'markeredgewidth'),
- 'lines.markersize' : (mplConfig.lines, 'markersize'),
- 'lines.antialiased' : (mplConfig.lines, 'antialiased'),
- 'lines.dash_joinstyle' : (mplConfig.lines, 'dash_joinstyle'),
- 'lines.solid_joinstyle' : (mplConfig.lines, 'solid_joinstyle'),
- 'lines.dash_capstyle' : (mplConfig.lines, 'dash_capstyle'),
- 'lines.solid_capstyle' : (mplConfig.lines, 'solid_capstyle'),
+ # line props
+ 'lines.linewidth' : (self.tconfig.lines, 'linewidth'),
+ 'lines.linestyle' : (self.tconfig.lines, 'linestyle'),
+ 'lines.color' : (self.tconfig.lines, 'color'),
+ 'lines.marker' : (self.tconfig.lines, 'marker'),
+ 'lines.markeredgewidth' : (self.tconfig.lines, 'markeredgewidth'),
+ 'lines.markersize' : (self.tconfig.lines, 'markersize'),
+ 'lines.antialiased' : (self.tconfig.lines, 'antialiased'),
+ 'lines.dash_joinstyle' : (self.tconfig.lines, 'dash_joinstyle'),
+ 'lines.solid_joinstyle' : (self.tconfig.lines, 'solid_joinstyle'),
+ 'lines.dash_capstyle' : (self.tconfig.lines, 'dash_capstyle'),
+ 'lines.solid_capstyle' : (self.tconfig.lines, 'solid_capstyle'),
 
- # patch props
- 'patch.linewidth' : (mplConfig.patch, 'linewidth'),
- 'patch.edgecolor' : (mplConfig.patch, 'edgecolor'),
- 'patch.facecolor' : (mplConfig.patch, 'facecolor'),
- 'patch.antialiased' : (mplConfig.patch, 'antialiased'),
+ # patch props
+ 'patch.linewidth' : (self.tconfig.patch, 'linewidth'),
+ 'patch.edgecolor' : (self.tconfig.patch, 'edgecolor'),
+ 'patch.facecolor' : (self.tconfig.patch, 'facecolor'),
+ 'patch.antialiased' : (self.tconfig.patch, 'antialiased'),
 
 
- # font props
- 'font.family' : (mplConfig.font, 'family'),
- 'font.style' : (mplConfig.font, 'style'),
- 'font.variant' : (mplConfig.font, 'variant'),
- 'font.stretch' : (mplConfig.lines, 'color'),
- 'font.weight' : (mplConfig.font, 'weight'),
- 'font.size' : (mplConfig.font, 'size'),
- 'font.serif' : (mplConfig.font, 'serif'),
- 'font.sans-serif' : (mplConfig.font, 'sans_serif'),
- 'font.cursive' : (mplConfig.font, 'cursive'),
- 'font.fantasy' : (mplConfig.font, 'fantasy'),
- 'font.monospace' : (mplConfig.font, 'monospace'),
+ # font props
+ 'font.family' : (self.tconfig.font, 'family'),
+ 'font.style' : (self.tconfig.font, 'style'),
+ 'font.variant' : (self.tconfig.font, 'variant'),
+ 'font.stretch' : (self.tconfig.lines, 'color'),
+ 'font.weight' : (self.tconfig.font, 'weight'),
+ 'font.size' : (self.tconfig.font, 'size'),
+ 'font.serif' : (self.tconfig.font, 'serif'),
+ 'font.sans-serif' : (self.tconfig.font, 'sans_serif'),
+ 'font.cursive' : (self.tconfig.font, 'cursive'),
+ 'font.fantasy' : (self.tconfig.font, 'fantasy'),
+ 'font.monospace' : (self.tconfig.font, 'monospace'),
 
- # text props
- 'text.color' : (mplConfig.text, 'color'),
- 'text.usetex' : (mplConfig.text, 'usetex'),
- 'text.latex.unicode' : (mplConfig.text.latex, 'unicode'),
- 'text.latex.preamble' : (mplConfig.text.latex, 'preamble'),
- 'text.dvipnghack' : (mplConfig.text.latex, 'dvipnghack'),
+ # text props
+ 'text.color' : (self.tconfig.text, 'color'),
+ 'text.usetex' : (self.tconfig.text, 'usetex'),
+ 'text.latex.unicode' : (self.tconfig.text.latex, 'unicode'),
+ 'text.latex.preamble' : (self.tconfig.text.latex, 'preamble'),
+ 'text.dvipnghack' : (self.tconfig.text.latex, 'dvipnghack'),
 
- 'image.aspect' : (mplConfig.image, 'aspect'),
- 'image.interpolation' : (mplConfig.image, 'interpolation'),
- 'image.cmap' : (mplConfig.image, 'cmap'),
- 'image.lut' : (mplConfig.image, 'lut'),
- 'image.origin' : (mplConfig.image, 'origin'),
+ 'image.aspect' : (self.tconfig.image, 'aspect'),
+ 'image.interpolation' : (self.tconfig.image, 'interpolation'),
+ 'image.cmap' : (self.tconfig.image, 'cmap'),
+ 'image.lut' : (self.tconfig.image, 'lut'),
+ 'image.origin' : (self.tconfig.image, 'origin'),
 
- 'contour.negative_linestyle' : (mplConfig.contour, 'negative_linestyle'),
+ 'contour.negative_linestyle' : (self.tconfig.contour, 'negative_linestyle'),
 
- # axes props
- 'axes.axisbelow' : (mplConfig.axes, 'axisbelow'),
- 'axes.hold' : (mplConfig.axes, 'hold'),
- 'axes.facecolor' : (mplConfig.axes, 'facecolor'),
- 'axes.edgecolor' : (mplConfig.axes, 'edgecolor'),
- 'axes.linewidth' : (mplConfig.axes, 'linewidth'),
- 'axes.titlesize' : (mplConfig.axes, 'titlesize'),
- 'axes.grid' : (mplConfig.axes, 'grid'),
- 'axes.labelsize' : (mplConfig.axes, 'labelsize'),
- 'axes.labelcolor' : (mplConfig.axes, 'labelcolor'),
- 'axes.formatter.limits' : (mplConfig.axes.formatter, 'limits'),
+ # axes props
+ 'axes.axisbelow' : (self.tconfig.axes, 'axisbelow'),
+ 'axes.hold' : (self.tconfig.axes, 'hold'),
+ 'axes.facecolor' : (self.tconfig.axes, 'facecolor'),
+ 'axes.edgecolor' : (self.tconfig.axes, 'edgecolor'),
+ 'axes.linewidth' : (self.tconfig.axes, 'linewidth'),
+ 'axes.titlesize' : (self.tconfig.axes, 'titlesize'),
+ 'axes.grid' : (self.tconfig.axes, 'grid'),
+ 'axes.labelsize' : (self.tconfig.axes, 'labelsize'),
+ 'axes.labelcolor' : (self.tconfig.axes, 'labelcolor'),
+ 'axes.formatter.limits' : (self.tconfig.axes.formatter, 'limits'),
 
- 'polaraxes.grid' : (mplConfig.axes, 'polargrid'),
+ 'polaraxes.grid' : (self.tconfig.axes, 'polargrid'),
 
- #legend properties
- 'legend.loc' : (mplConfig.legend, 'loc'),
- 'legend.isaxes' : (mplConfig.legend, 'isaxes'),
- 'legend.numpoints' : (mplConfig.legend, 'numpoints'),
- 'legend.fontsize' : (mplConfig.legend, 'fontsize'),
- 'legend.pad' : (mplConfig.legend, 'pad'),
- 'legend.markerscale' : (mplConfig.legend, 'markerscale'),
- 'legend.labelsep' : (mplConfig.legend, 'labelsep'),
- 'legend.handlelen' : (mplConfig.legend, 'handlelen'),
- 'legend.handletextsep' : (mplConfig.legend, 'handletextsep'),
- 'legend.axespad' : (mplConfig.legend, 'axespad'),
- 'legend.shadow' : (mplConfig.legend, 'shadow'),
+ #legend properties
+ 'legend.loc' : (self.tconfig.legend, 'loc'),
+ 'legend.isaxes' : (self.tconfig.legend, 'isaxes'),
+ 'legend.numpoints' : (self.tconfig.legend, 'numpoints'),
+ 'legend.fontsize' : (self.tconfig.legend, 'fontsize'),
+ 'legend.pad' : (self.tconfig.legend, 'pad'),
+ 'legend.markerscale' : (self.tconfig.legend, 'markerscale'),
+ 'legend.labelsep' : (self.tconfig.legend, 'labelsep'),
+ 'legend.handlelen' : (self.tconfig.legend, 'handlelen'),
+ 'legend.handletextsep' : (self.tconfig.legend, 'handletextsep'),
+ 'legend.axespad' : (self.tconfig.legend, 'axespad'),
+ 'legend.shadow' : (self.tconfig.legend, 'shadow'),
 
- # tick properties
- 'xtick.major.size' : (mplConfig.xticks.major, 'size'),
- 'xtick.minor.size' : (mplConfig.xticks.minor, 'size'),
- 'xtick.major.pad' : (mplConfig.xticks.major, 'pad'),
- 'xtick.minor.pad' : (mplConfig.xticks.minor, 'pad'),
- 'xtick.color' : (mplConfig.xticks, 'color'),
- 'xtick.labelsize' : (mplConfig.xticks, 'labelsize'),
- 'xtick.direction' : (mplConfig.xticks, 'direction'),
+ # tick properties
+ 'xtick.major.size' : (self.tconfig.xticks.major, 'size'),
+ 'xtick.minor.size' : (self.tconfig.xticks.minor, 'size'),
+ 'xtick.major.pad' : (self.tconfig.xticks.major, 'pad'),
+ 'xtick.minor.pad' : (self.tconfig.xticks.minor, 'pad'),
+ 'xtick.color' : (self.tconfig.xticks, 'color'),
+ 'xtick.labelsize' : (self.tconfig.xticks, 'labelsize'),
+ 'xtick.direction' : (self.tconfig.xticks, 'direction'),
 
- 'ytick.major.size' : (mplConfig.yticks.major, 'size'),
- 'ytick.minor.size' : (mplConfig.yticks.minor, 'size'),
- 'ytick.major.pad' : (mplConfig.yticks.major, 'pad'),
- 'ytick.minor.pad' : (mplConfig.yticks.minor, 'pad'),
- 'ytick.color' : (mplConfig.yticks, 'color'),
- 'ytick.labelsize' : (mplConfig.yticks, 'labelsize'),
- 'ytick.direction' : (mplConfig.yticks, 'direction'),
+ 'ytick.major.size' : (self.tconfig.yticks.major, 'size'),
+ 'ytick.minor.size' : (self.tconfig.yticks.minor, 'size'),
+ 'ytick.major.pad' : (self.tconfig.yticks.major, 'pad'),
+ 'ytick.minor.pad' : (self.tconfig.yticks.minor, 'pad'),
+ 'ytick.color' : (self.tconfig.yticks, 'color'),
+ 'ytick.labelsize' : (self.tconfig.yticks, 'labelsize'),
+ 'ytick.direction' : (self.tconfig.yticks, 'direction'),
 
- 'grid.color' : (mplConfig.grid, 'color'),
- 'grid.linestyle' : (mplConfig.grid, 'linestyle'),
- 'grid.linewidth' : (mplConfig.grid, 'linewidth'),
+ 'grid.color' : (self.tconfig.grid, 'color'),
+ 'grid.linestyle' : (self.tconfig.grid, 'linestyle'),
+ 'grid.linewidth' : (self.tconfig.grid, 'linewidth'),
 
 
- # figure props
- 'figure.figsize' : (mplConfig.figure, 'figsize'),
- 'figure.dpi' : (mplConfig.figure, 'dpi'),
- 'figure.facecolor' : (mplConfig.figure, 'facecolor'),
- 'figure.edgecolor' : (mplConfig.figure, 'edgecolor'),
+ # figure props
+ 'figure.figsize' : (self.tconfig.figure, 'figsize'),
+ 'figure.dpi' : (self.tconfig.figure, 'dpi'),
+ 'figure.facecolor' : (self.tconfig.figure, 'facecolor'),
+ 'figure.edgecolor' : (self.tconfig.figure, 'edgecolor'),
 
- 'figure.subplot.left' : (mplConfig.figure.subplot, 'left'),
- 'figure.subplot.right' : (mplConfig.figure.subplot, 'right'),
- 'figure.subplot.bottom' : (mplConfig.figure.subplot, 'bottom'),
- 'figure.subplot.top' : (mplConfig.figure.subplot, 'top'),
- 'figure.subplot.wspace' : (mplConfig.figure.subplot, 'wspace'),
- 'figure.subplot.hspace' : (mplConfig.figure.subplot, 'hspace'),
+ 'figure.subplot.left' : (self.tconfig.figure.subplot, 'left'),
+ 'figure.subplot.right' : (self.tconfig.figure.subplot, 'right'),
+ 'figure.subplot.bottom' : (self.tconfig.figure.subplot, 'bottom'),
+ 'figure.subplot.top' : (self.tconfig.figure.subplot, 'top'),
+ 'figure.subplot.wspace' : (self.tconfig.figure.subplot, 'wspace'),
+ 'figure.subplot.hspace' : (self.tconfig.figure.subplot, 'hspace'),
 
 
- 'savefig.dpi' : (mplConfig.savefig, 'dpi'),
- 'savefig.facecolor' : (mplConfig.savefig, 'facecolor'),
- 'savefig.edgecolor' : (mplConfig.savefig, 'edgecolor'),
- 'savefig.orientation' : (mplConfig.savefig, 'orientation'),
+ 'savefig.dpi' : (self.tconfig.savefig, 'dpi'),
+ 'savefig.facecolor' : (self.tconfig.savefig, 'facecolor'),
+ 'savefig.edgecolor' : (self.tconfig.savefig, 'edgecolor'),
+ 'savefig.orientation' : (self.tconfig.savefig, 'orientation'),
 
- 'cairo.format' : (mplConfig.backend.cairo, 'format'),
- 'tk.window_focus' : (mplConfig.backend.tk, 'window_focus'),
- 'tk.pythoninspect' : (mplConfig.backend.tk, 'pythoninspect'),
- 'ps.papersize' : (mplConfig.backend.ps, 'papersize'),
- 'ps.useafm' : (mplConfig.backend.ps, 'useafm'),
- 'ps.usedistiller' : (mplConfig.backend.ps.distiller, 'use'),
- 'ps.distiller.res' : (mplConfig.backend.ps.distiller, 'resolution'),
- 'ps.fonttype' : (mplConfig.backend.ps, 'fonttype'),
- 'pdf.compression' : (mplConfig.backend.pdf, 'compression'),
- 'pdf.inheritcolor' : (mplConfig.backend.pdf, 'inheritcolor'),
- 'pdf.use14corefonts' : (mplConfig.backend.pdf, 'use14corefonts'),
- 'pdf.fonttype' : (mplConfig.backend.pdf, 'fonttype'),
- 'svg.image_inline' : (mplConfig.backend.svg, 'image_inline'),
- 'svg.image_noscale' : (mplConfig.backend.svg, 'image_noscale'),
- 'svg.embed_char_paths' : (mplConfig.backend.svg, 'embed_chars'),
+ 'cairo.format' : (self.tconfig.backend.cairo, 'format'),
+ 'tk.window_focus' : (self.tconfig.backend.tk, 'window_focus'),
+ 'tk.pythoninspect' : (self.tconfig.backend.tk, 'pythoninspect'),
+ 'ps.papersize' : (self.tconfig.backend.ps, 'papersize'),
+ 'ps.useafm' : (self.tconfig.backend.ps, 'useafm'),
+ 'ps.usedistiller' : (self.tconfig.backend.ps.distiller, 'use'),
+ 'ps.distiller.res' : (self.tconfig.backend.ps.distiller, 'resolution'),
+ 'ps.fonttype' : (self.tconfig.backend.ps, 'fonttype'),
+ 'pdf.compression' : (self.tconfig.backend.pdf, 'compression'),
+ 'pdf.inheritcolor' : (self.tconfig.backend.pdf, 'inheritcolor'),
+ 'pdf.use14corefonts' : (self.tconfig.backend.pdf, 'use14corefonts'),
+ 'pdf.fonttype' : (self.tconfig.backend.pdf, 'fonttype'),
+ 'svg.image_inline' : (self.tconfig.backend.svg, 'image_inline'),
+ 'svg.image_noscale' : (self.tconfig.backend.svg, 'image_noscale'),
+ 'svg.embed_char_paths' : (self.tconfig.backend.svg, 'embed_chars'),
 
- # mathtext settings
- 'mathtext.mathtext2' : (mplConfig.text.math, 'mathtext2'),
- 'mathtext.rm' : (mplConfig.text.math, 'rm'),
- 'mathtext.it' : (mplConfig.text.math, 'it'),
- 'mathtext.tt' : (mplConfig.text.math, 'tt'),
- 'mathtext.mit' : (mplConfig.text.math, 'mit'),
- 'mathtext.cal' : (mplConfig.text.math, 'cal'),
- 'mathtext.nonascii' : (mplConfig.text.math, 'nonascii'),
- }
+ # mathtext settings
+ 'mathtext.mathtext2' : (self.tconfig.text.math, 'mathtext2'),
+ 'mathtext.rm' : (self.tconfig.text.math, 'rm'),
+ 'mathtext.it' : (self.tconfig.text.math, 'it'),
+ 'mathtext.tt' : (self.tconfig.text.math, 'tt'),
+ 'mathtext.mit' : (self.tconfig.text.math, 'mit'),
+ 'mathtext.cal' : (self.tconfig.text.math, 'cal'),
+ 'mathtext.nonascii' : (self.tconfig.text.math, 'nonascii'),
+ }
 
 def __setitem__(self, key, val):
 try:
- obj, attr = self.tconf[key]
+ obj, attr = self.tconfig_map[key]
 setattr(obj, attr, val)
 except KeyError:
 raise KeyError('%s is not a valid rc parameter.\
 See rcParams.keys() for a list of valid parameters.'%key)
 
 def __getitem__(self, key):
- obj, attr = self.tconf[key]
+ obj, attr = self.tconfig_map[key]
 return getattr(obj, attr)
 
- def keys():
- return self.tconf.keys()
+ def keys(self):
+ return self.tconfig_map.keys()
+ 
+ def has_key(self, val):
+ return self.tconfig_map.has_key(val)
 
 
-rcParams = RcParamsWrapper()
+config_file = cutils.get_config_file(tconfig=True)
+old_config_file = cutils.get_config_file(tconfig=False)
+if os.path.exists(old_config_file) and not os.path.exists(config_file):
+ CONVERT = True
+else: CONVERT = False
+configManager = TConfigManager(MPLConfig,
+ cutils.get_config_file(tconfig=True),
+ filePriority=True)
+mplConfig = configManager.tconf
+mplConfigDefault = MPLConfig()
 
+# TODO: move into traits validation
+mplConfig.backend.ps.distiller.use = \
+ checkdep.ps_distiller(mplConfig.backend.ps.distiller.use)
+mplConfig.text.usetex = checkdep.usetex(mplConfig.text.usetex)
+
+def save_config():
+ """Save mplConfig customizations to current matplotlib.conf
+ """
+ configManager.write()
+
+rcParams = RcParamsWrapper(mplConfig)
+rcParamsDefault = RcParamsWrapper(mplConfigDefault)
+
 # convert old matplotlibrc to new matplotlib.conf
 if CONVERT:
 from rcparams import rcParams as old_rcParams
@@ -479,6 +490,10 @@
 print '%s converted to %s'%(cutils.get_config_file(tconfig=False),
 config_file)
 
+def rcdefaults():
+ mplConfig = MPLConfig()
+ rcParams = RcParamsWrapper(mplConfig)
+
 ##############################################################################
 # Simple testing
 ##############################################################################
Modified: trunk/matplotlib/lib/matplotlib/mpl-data/matplotlibrc
===================================================================
--- trunk/matplotlib/lib/matplotlib/mpl-data/matplotlibrc	2007年07月30日 16:41:53 UTC (rev 3631)
+++ trunk/matplotlib/lib/matplotlib/mpl-data/matplotlibrc	2007年07月30日 17:41:14 UTC (rev 3632)
@@ -34,7 +34,6 @@
 #interactive : False # see http://matplotlib.sourceforge.net/interactive.html
 #toolbar : toolbar2 # None | classic | toolbar2
 #timezone : UTC # a pytz timezone string, eg US/Central or Europe/Paris
-#units : False
 
 # Where your matplotlib data lives if you installed to a non-default
 # location. This is where the matplotlib fonts, bitmaps, etc reside
@@ -197,7 +196,6 @@
 #grid.linewidth : 0.5 # in points
 
 ### Legend
-#legend.loc : upper right
 #legend.isaxes : True
 #legend.numpoints : 2 # the number of points in the legend line
 #legend.fontsize : 14
@@ -245,7 +243,6 @@
 #savefig.dpi : 100 # figure dots per inch
 #savefig.facecolor : white # figure facecolor when saving
 #savefig.edgecolor : white # figure edgecolor when saving
-#savefig.orientation: portrait
 
 #cairo.format : png # png, ps, pdf, svg
 
@@ -267,8 +264,6 @@
 #pdf.compression : 6 # integer from 0 to 9
 # 0 disables compression (good for debugging)
 #pdf.fonttype : 3 # Output Type 3 (Type3) or Type 42 (TrueType)
-#pdf.inheritcolor : False
-#pdf.use14corefonts : False
 
 # svg backend params
 #svg.image_inline : True # write raster image data directly into the svg file
Modified: trunk/matplotlib/setup.py
===================================================================
--- trunk/matplotlib/setup.py	2007年07月30日 16:41:53 UTC (rev 3631)
+++ trunk/matplotlib/setup.py	2007年07月30日 17:41:14 UTC (rev 3632)
@@ -130,7 +130,7 @@
 'matplotlib.numerix.linear_algebra',
 'matplotlib.numerix.random_array',
 'matplotlib.numerix.fft',
-
+ 'matplotlib.config'
 ]
 
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ds...@us...> - 2007年07月30日 21:37:13
Revision: 3639
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3639&view=rev
Author: dsdale
Date: 2007年07月30日 14:37:11 -0700 (2007年7月30日)
Log Message:
-----------
install matplotlib.conf in mpl-data for config package
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/mpl-data/matplotlib.conf
 trunk/matplotlib/setup.py
Modified: trunk/matplotlib/lib/matplotlib/mpl-data/matplotlib.conf
===================================================================
--- trunk/matplotlib/lib/matplotlib/mpl-data/matplotlib.conf	2007年07月30日 20:48:06 UTC (rev 3638)
+++ trunk/matplotlib/lib/matplotlib/mpl-data/matplotlib.conf	2007年07月30日 21:37:11 UTC (rev 3639)
@@ -49,7 +49,7 @@
 
 # Where your matplotlib data lives if you installed to a non-default 
 #location. This is where the matplotlib fonts, bitmaps, etc reside
-datapath = '/home/fperez/.matplotlib'
+#datapath = '/home/fperez/.matplotlib'
 
 #bogus = 1
 #[bogus_section]
@@ -62,7 +62,7 @@
 
 # 'GTKAgg', 'GTKCairo', 'QtAgg', 'Qt4Agg', 'TkAgg', 'Agg', 
 # 'Cairo', 'PS', 'PDF', 'SVG'
- use = 'Qt4Agg'
+ use = 'TkAgg'
 
 [[cairo]]
 # png, ps, pdf, svg
@@ -453,4 +453,4 @@
 level = 'silent'
 
 # a log filename, 'sys.stdout' or 'sys.stderr'
- fileo = 'sys.stdout'
\ No newline at end of file
+ fileo = 'sys.stdout'
Modified: trunk/matplotlib/setup.py
===================================================================
--- trunk/matplotlib/setup.py	2007年07月30日 20:48:06 UTC (rev 3638)
+++ trunk/matplotlib/setup.py	2007年07月30日 21:37:11 UTC (rev 3639)
@@ -93,6 +93,7 @@
 'mpl-data/images/*.png',
 'mpl-data/images/*.ppm',
 'mpl-data/matplotlibrc',
+ 'mpl-data/matplotlib.conf',
 'mpl-data/*.glade',
 'backends/Matplotlib.nib/*',
 ]}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
1 2 3 .. 15 > >> (Page 1 of 15)
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 によって変換されたページ (->オリジナル) /