|
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 (Sun, 15 Jul 2007)
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 (Mon, 16 Jul 2007)
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 (Mon, 16 Jul 2007)
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 (Tue, 17 Jul 2007)
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 (Tue, 17 Jul 2007)
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 (Tue, 17 Jul 2007)
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,
...
[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 (Wed, 18 Jul 2007)
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 (Wed, 18 Jul 2007)
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/...
[truncated message content] |
|
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 (Thu, 19 Jul 2007)
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 (Thu, 19 Jul 2007)
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},
+ ...
[truncated message content] |
|
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 (Thu, 19 Jul 2007)
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 im...
[truncated message content] |
|
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 (Thu, 19 Jul 2007)
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 (Thu, 19 Jul 2007)
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)
...
[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 (Fri, 20 Jul 2007)
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 (Fri, 20 Jul 2007)
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 (Fri, 20 Jul 2007)
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 (Fri, 20 Jul 2007)
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 (Sat, 21 Jul 2007)
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 (Thu, 26 Jul 2007)
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 = \
+ b...
[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 (Thu, 26 Jul 2007)
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 (Thu, 26 Jul 2007)
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 (Sun, 29 Jul 2007)
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 (Mon, 30 Jul 2007)
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 (Mon, 30 Jul 2007)
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 (Mon, 30 Jul 2007)
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.
|