SourceForge logo
SourceForge logo
Menu

matplotlib-checkins — Commit notification. DO NOT POST to this list, just subscribe to it.

You can subscribe to this list here.

2007 Jan
Feb
Mar
Apr
May
Jun
Jul
(115)
Aug
(120)
Sep
(137)
Oct
(170)
Nov
(461)
Dec
(263)
2008 Jan
(120)
Feb
(74)
Mar
(35)
Apr
(74)
May
(245)
Jun
(356)
Jul
(240)
Aug
(115)
Sep
(78)
Oct
(225)
Nov
(98)
Dec
(271)
2009 Jan
(132)
Feb
(84)
Mar
(74)
Apr
(56)
May
(90)
Jun
(79)
Jul
(83)
Aug
(296)
Sep
(214)
Oct
(76)
Nov
(82)
Dec
(66)
2010 Jan
(46)
Feb
(58)
Mar
(51)
Apr
(77)
May
(58)
Jun
(126)
Jul
(128)
Aug
(64)
Sep
(50)
Oct
(44)
Nov
(48)
Dec
(54)
2011 Jan
(68)
Feb
(52)
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
(1)
2018 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S






1
2
(1)
3
(4)
4
(9)
5
(14)
6
(8)
7
(14)
8
(1)
9
(2)
10
(9)
11
(5)
12
(11)
13
(4)
14
(4)
15
(1)
16
17
(1)
18
(2)
19
(4)
20
(10)
21
(3)
22
(3)
23
(2)
24
(8)
25
(6)
26
(5)
27
28
(3)
29
30
(3)






Showing results of 137

<< < 1 2 3 4 5 6 > >> (Page 4 of 6)
Revision: 3828
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3828&view=rev
Author: jouni
Date: 2007年09月10日 13:55:29 -0700 (2007年9月10日)
Log Message:
-----------
Bugfixes in pdf usetex
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py	2007年09月10日 20:31:01 UTC (rev 3827)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py	2007年09月10日 20:55:29 UTC (rev 3828)
@@ -519,12 +519,13 @@
 ul_position, ul_thickness = font.get_ps_font_info()
 
 if fontinfo.encodingfile is not None:
- differencesArray = [ Name(ch) for ch in 
- dviread.Encoding(fontinfo.encodingfile) ]
+ enc = dviread.Encoding(fontinfo.encodingfile)
+ widths = [ afmdata.get_width_from_char_name(ch)
+ for ch in enc ]
+ differencesArray = [ Name(ch) for ch in enc ]
 differencesArray = [ 0 ] + differencesArray
 firstchar = 0
 lastchar = len(differencesArray) - 2
- widths = [ 100 for x in range(firstchar,lastchar+1) ] # XXX TODO
 else:
 widths = [ None for i in range(256) ]
 for ch in range(256):
@@ -1427,7 +1428,7 @@
 # Pop off the global transformation
 self.file.output(Op.grestore)
 
- def draw_tex(self, gc, x, y, s, prop, angle):
+ def _draw_tex(self, gc, x, y, s, prop, angle):
 # Rename to draw_tex to enable
 
 texmanager = self.get_texmanager()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jo...@us...> - 2007年09月10日 20:31:04
Revision: 3827
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3827&view=rev
Author: jouni
Date: 2007年09月10日 13:31:01 -0700 (2007年9月10日)
Log Message:
-----------
Better bounding boxes for pdf usetex, including descents.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
 trunk/matplotlib/lib/matplotlib/dviread.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py	2007年09月10日 19:25:21 UTC (rev 3826)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py	2007年09月10日 20:31:01 UTC (rev 3827)
@@ -1427,14 +1427,14 @@
 # Pop off the global transformation
 self.file.output(Op.grestore)
 
- def _draw_tex(self, gc, x, y, s, prop, angle):
+ def draw_tex(self, gc, x, y, s, prop, angle):
 # Rename to draw_tex to enable
 
 texmanager = self.get_texmanager()
 fontsize = prop.get_size_in_points()
 dvifile = texmanager.make_dvi(s, fontsize)
 dvi = dviread.Dvi(dvifile, 72)
- text, boxes = iter(dvi).next()
+ page = iter(dvi).next()
 dvi.close()
 
 if angle == 0: # avoid rounding errors in common case
@@ -1448,7 +1448,7 @@
 # Gather font information and do some setup for combining
 # characters into strings.
 oldfontnum, seq = None, []
- for x1, y1, fontnum, glyph, width in text:
+ for x1, y1, fontnum, glyph, width in page.text:
 if fontnum != oldfontnum:
 texname, fontsize = dvi.fontinfo(fontnum)
 fontinfo = self.tex_font_mapping(texname)
@@ -1462,8 +1462,8 @@
 seq += [('end',)]
 
 # Find consecutive text strings with constant x coordinate and
- # combine into one string (if needed kern would be less than
- # 0.1 points) or several strings interspersed with kerns.
+ # combine into a sequence of strings and kerns, or just one
+ # string (if any kerns would be less than 0.1 points).
 i, curx = 0, 0
 while i < len(seq)-1:
 elt, next = seq[i:i+2]
@@ -1503,7 +1503,7 @@
 boxgc = self.new_gc()
 boxgc.copy_properties(gc)
 boxgc.set_linewidth(0)
- for x1, y1, h, w in boxes:
+ for x1, y1, h, w in page.boxes:
 (x1, y1), (x2, y2), (x3, y3), (x4, y4) = \
 mytrans(x1, y1), mytrans(x1+w, y1), \
 mytrans(x1+w, y1+h), mytrans(x1, y1+h)
@@ -1653,14 +1653,9 @@
 fontsize = prop.get_size_in_points()
 dvifile = texmanager.make_dvi(s, fontsize)
 dvi = dviread.Dvi(dvifile, 72)
- text, boxes = iter(dvi).next()
- # TODO: better bounding box -- this is not quite right:
- l = min(p[0] for p in text+boxes)
- r = max(p[0] for p in text+boxes) + fontsize
- b = min(p[1] for p in text+boxes)
- t = max(p[1] for p in text+boxes) + fontsize
- # (not to even mention finding the baseline)
- return r-l, t-b, t-b
+ page = iter(dvi).next()
+ dvi.close()
+ return page.width, page.height, page.descent
 if ismath:
 w, h, d, glyphs, rects, used_characters = \
 self.mathtext_parser.parse(s, 72, prop)
Modified: trunk/matplotlib/lib/matplotlib/dviread.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/dviread.py	2007年09月10日 19:25:21 UTC (rev 3826)
+++ trunk/matplotlib/lib/matplotlib/dviread.py	2007年09月10日 20:31:01 UTC (rev 3827)
@@ -6,19 +6,21 @@
 Interface:
 
 dvi = Dvi(filename, 72)
- for text, boxes in dvi: # iterate over pages
- text, boxes = dvi.output(72)
- for x,y,font,glyph,width in text:
+ for page in dvi: # iterate over pages
+ w, h, d = page.width, page.height, page.descent
+ for x,y,font,glyph,width in page.text:
 fontname, pointsize = dvi.fontinfo(font)
 ...
- for x,y,height,width in boxes:
+ for x,y,height,width in page.boxes:
 ...
 """
 
-# TODO: support for TeX virtual fonts (*.vf) which are a dvi-like format
+# TODO: support TeX virtual fonts (*.vf) which are a sort of
+# subroutine collections for dvi files
 
 import matplotlib
 import matplotlib.cbook as mpl_cbook
+import numpy as npy
 import os
 import struct
 
@@ -74,21 +76,34 @@
 def _output(self):
 """
 Output the text and boxes belonging to the most recent page.
- text, boxes = dvi._output()
+ page = dvi._output()
 """
- t0 = self.text[0]
- minx, miny, maxx, maxy = t0[0], t0[1], t0[0], t0[1]
+ minx, miny, maxx, maxy = npy.inf, npy.inf, -npy.inf, -npy.inf
+ maxy_pure = -npy.inf
 for elt in self.text + self.boxes:
- x,y = elt[:2]
- if x < minx: minx = x
- if y < miny: miny = y
- if x > maxx: maxx = x
- if y > maxy: maxy = y
+ if len(elt) == 4: # box
+ x,y,h,w = elt
+ e = 0 # zero depth
+ else: # glyph
+ x,y,f,g,w = elt
+ font = self.fonts[f]
+ h = (font.scale * font.tfm.height[g]) >> 20
+ e = (font.scale * font.tfm.depth[g]) >> 20
+ minx = min(minx, x)
+ miny = min(miny, y - h)
+ maxx = max(maxx, x + w)
+ maxy = max(maxy, y + e)
+ maxy_pure = max(maxy_pure, y)
+
 d = self.dpi / (72.27 * 2**16) # from TeX's "scaled points" to dpi units
 text = [ ((x-minx)*d, (maxy-y)*d, f, g, w*d) for (x,y,f,g,w) in self.text ]
 boxes = [ ((x-minx)*d, (maxy-y)*d, h*d, w*d) for (x,y,h,w) in self.boxes ]
- return text, boxes
 
+ return mpl_cbook.Bunch(text=text, boxes=boxes, 
+ width=(maxx-minx)*d, 
+ height=(maxy_pure-miny)*d, 
+ descent=(maxy-maxy_pure)*d)
+
 def fontinfo(self, f):
 """
 texname, pointsize = dvi.fontinfo(fontnum)
@@ -361,6 +376,7 @@
 width[i]: width of character #i, needs to be scaled 
 by the factor specified in the dvi file
 (this is a dict because indexing may not start from 0)
+ height[i], depth[i]: height and depth of character #i
 """
 
 def __init__(self, filename):
@@ -368,22 +384,29 @@
 
 try:
 header1 = file.read(24)
- lh, bc, ec, nw = \
- struct.unpack('!4H', header1[2:10])
+ lh, bc, ec, nw, nh, nd = \
+ struct.unpack('!6H', header1[2:14])
 header2 = file.read(4*lh)
 self.checksum, self.design_size = \
 struct.unpack('!2I', header2[:8])
 # there is also encoding information etc.
 char_info = file.read(4*(ec-bc+1))
 widths = file.read(4*nw)
+ heights = file.read(4*nh)
+ depths = file.read(4*nd)
 finally:
 file.close()
 
- widths = struct.unpack('!%dI' % nw, widths)
- self.width = {}
+ self.width, self.height, self.depth = {}, {}, {}
+ widths, heights, depths = \
+ [ struct.unpack('!%dI' % n, x) 
+ for n,x in [(nw, widths), (nh, heights), (nd, depths)] ]
 for i in range(ec-bc):
 self.width[bc+i] = widths[ord(char_info[4*i])]
+ self.height[bc+i] = heights[ord(char_info[4*i+1]) >> 4]
+ self.depth[bc+i] = depths[ord(char_info[4*i+1]) & 0xf]
 
+
 class PsfontsMap(object):
 """
 A psfonts.map formatted file, mapping TeX fonts to PS fonts.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年09月10日 19:25:26
Revision: 3826
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3826&view=rev
Author: mdboom
Date: 2007年09月10日 12:25:21 -0700 (2007年9月10日)
Log Message:
-----------
Running mathtext_demo.py without transforms.py/cpp. Totally broken,
though. Not surprising... ;)
Modified Paths:
--------------
 branches/transforms/lib/matplotlib/affine.py
 branches/transforms/lib/matplotlib/axes.py
 branches/transforms/lib/matplotlib/axis.py
 branches/transforms/lib/matplotlib/backend_bases.py
 branches/transforms/lib/matplotlib/backends/backend_agg.py
 branches/transforms/lib/matplotlib/bbox.py
 branches/transforms/lib/matplotlib/figure.py
 branches/transforms/lib/matplotlib/finance.py
 branches/transforms/lib/matplotlib/legend.py
 branches/transforms/lib/matplotlib/lines.py
 branches/transforms/lib/matplotlib/patches.py
 branches/transforms/lib/matplotlib/text.py
 branches/transforms/lib/matplotlib/ticker.py
 branches/transforms/src/_backend_agg.cpp
Modified: branches/transforms/lib/matplotlib/affine.py
===================================================================
--- branches/transforms/lib/matplotlib/affine.py	2007年09月10日 18:45:32 UTC (rev 3825)
+++ branches/transforms/lib/matplotlib/affine.py	2007年09月10日 19:25:21 UTC (rev 3826)
@@ -67,7 +67,10 @@
 def from_values(a, b, c, d, e, f):
 return Affine2D(Affine2D.matrix_from_values(a, b, c, d, e, f))
 from_values = staticmethod(from_values)
- 
+
+ def to_values(self):
+	return tuple(self.mtx[:2].swapaxes(0, 1).flatten())
+ 
 #@staticmethod
 def matrix_from_values(a, b, c, d, e, f):
 	affine = N.zeros((3,3), N.float_)
@@ -92,11 +95,12 @@
 
 	# This is nicer for now, however, since we can just keep a
 	# regular affine matrix around
+	# MGDTODO: Trap cases where this isn't an array and fix there
+	points = N.array(points, N.float_)
 	new_points = points.swapaxes(0, 1)
 	new_points = N.vstack((new_points, N.ones((1, points.shape[0]))))
 	result = N.dot(self.mtx, new_points)[:2]
-	result.swapaxes(0, 1)
-	return result
+	return result.swapaxes(0, 1)
 
 #@staticmethod
 def _concat(a, b):
@@ -198,10 +202,14 @@
 print transform.inverted()
 
 from bbox import Bbox
+ print "BBOX"
 boxin = Bbox([[10, 10], [320, 240]])
 boxout = Bbox([[25, 25], [640, 400]])
- trans = bbox_transform(boxin, boxout)
+ print boxin._points, boxin.xmin(), boxin.ymin(), boxin.xmax(), boxin.ymax()
+ print boxout._points, boxout.xmin(), boxout.ymin(), boxout.xmax(), boxout.ymax()
+ trans = get_bbox_transform(boxin, boxout)
 print trans
 print trans(N.array([[10, 10], [320, 240]]))
+ print trans([[10, 10]])
 
 __all__ = ['Transform', 'Affine2D']
Modified: branches/transforms/lib/matplotlib/axes.py
===================================================================
--- branches/transforms/lib/matplotlib/axes.py	2007年09月10日 18:45:32 UTC (rev 3825)
+++ branches/transforms/lib/matplotlib/axes.py	2007年09月10日 19:25:21 UTC (rev 3826)
@@ -618,10 +618,10 @@
 martist.Artist.set_figure(self, fig)
 
 l, b, w, h = self._position
- xmin = fig.bbox.ll().x()
- xmax = fig.bbox.ur().x()
- ymin = fig.bbox.ll().y()
- ymax = fig.bbox.ur().y()
+ xmin = fig.bbox.xmin()
+ xmax = fig.bbox.xmax()
+ ymin = fig.bbox.ymin()
+ ymax = fig.bbox.ymax()
 figw = xmax-xmin
 figh = ymax-ymin
 self.left = l*figw
@@ -695,9 +695,11 @@
 ACCEPTS: len(4) sequence of floats
 """
 if which in ('both', 'active'):
- # Change values within self._position--don't replace it.
- for num,val in zip(pos, self._position):
- val.set(num)
+	 # MGDTODO
+# # Change values within self._position--don't replace it.
+# for num,val in zip(pos, self._position):
+# val.set(num)
+	 self._position = pos
 if which in ('both', 'original'):
 self._originalPosition = pos
 
@@ -714,7 +716,8 @@
 self.xaxis.cla()
 self.yaxis.cla()
 
- self.dataLim.ignore(1)
+	# MGDTODO
+ # self.dataLim.ignore(1)
 self.callbacks = cbook.CallbackRegistry(('xlim_changed', 'ylim_changed'))
 
 if self._sharex is not None:
@@ -1176,7 +1179,9 @@
 # Otherwise, it will compute the bounds of it's current data
 # and the data in xydata
 #print type(x), type(y)
- self.dataLim.update_numerix(x, y, -1)
+	# MGDTODO
+ ## self.dataLim.update_numerix(x, y, -1)
+	pass
 
 def _get_verts_in_data_coords(self, trans, xys):
 if trans == self.transData:
@@ -1273,8 +1278,9 @@
 if not self.get_visible(): return
 renderer.open_group('axes')
 self.apply_aspect()
- self.transData.freeze() # eval the lazy objects
- self.transAxes.freeze()
+	# MGDTODO
+ # self.transData.freeze() # eval the lazy objects
+ # self.transAxes.freeze()
 if self.axison and self._frameon: self.axesPatch.draw(renderer)
 artists = []
 
@@ -1330,8 +1336,9 @@
 for zorder, i, a in dsu:
 a.draw(renderer)
 
- self.transData.thaw() # release the lazy objects
- self.transAxes.thaw() # release the lazy objects
+	# MGDTODO
+	# self.transData.thaw() # release the lazy objects
+ # self.transAxes.thaw() # release the lazy objects
 renderer.close_group('axes')
 self._cachedRenderer = renderer
 
Modified: branches/transforms/lib/matplotlib/axis.py
===================================================================
--- branches/transforms/lib/matplotlib/axis.py	2007年09月10日 18:45:32 UTC (rev 3825)
+++ branches/transforms/lib/matplotlib/axis.py	2007年09月10日 19:25:21 UTC (rev 3826)
@@ -261,7 +261,7 @@
 horizontalalignment='center',
 )
 
-	trans = blend_xy_sep_transformation(
+	trans = blend_xy_sep_transform(
 	 self.axes.transData, self.axes.transAxes)
 # offset the text upward with a post transformation
 trans = trans + Affine2D().translated(0, self._padPixels)
@@ -1037,7 +1037,8 @@
 bbox = bbox_union(bboxes)
 bottom = bbox.ymin()
 
- self.label.set_position( (x, bottom-self.LABELPAD*self.figure.dpi.get()/72.0))
+ self.label.set_position( (x, bottom-self.LABELPAD*self.figure.dpi/72.0))
+# self.label.set_position( (x, bottom-self.LABELPAD*self.figure.dpi.get()/72.0)) MGDTODO
 
 else:
 if not len(bboxes2):
@@ -1060,8 +1061,9 @@
 else:
 bbox = bbox_union(bboxes)
 bottom = bbox.ymin()
- self.offsetText.set_position((x, bottom-self.OFFSETTEXTPAD*self.figure.dpi.get()/72.0))
-
+ self.offsetText.set_position((x, bottom-self.OFFSETTEXTPAD*self.figure.dpi/72.0))
+# self.offsetText.set_position((x, bottom-self.OFFSETTEXTPAD*self.figure.dpi.get()/72.0)) MGDTODO
+	
 def set_ticks_position(self, position):
 """
 Set the ticks position (top, bottom, both or default)
@@ -1227,8 +1229,9 @@
 bbox = bbox_union(bboxes)
 left = bbox.xmin()
 
- self.label.set_position( (left-self.LABELPAD*self.figure.dpi.get()/72.0, y))
-
+ self.label.set_position( (left-self.LABELPAD*self.figure.dpi/72.0, y))
+	 # self.label.set_position( (left-self.LABELPAD*self.figure.dpi.get()/72.0, y)) MGDTODO
+	 
 else:
 if not len(bboxes2):
 right = self.axes.bbox.xmax()
@@ -1246,8 +1249,9 @@
 """
 x,y = self.offsetText.get_position()
 top = self.axes.bbox.ymax()
- self.offsetText.set_position((x, top+self.OFFSETTEXTPAD*self.figure.dpi.get()/72.0))
-
+ self.offsetText.set_position((x, top+self.OFFSETTEXTPAD*self.figure.dpi/72.0))
+# self.offsetText.set_position((x, top+self.OFFSETTEXTPAD*self.figure.dpi.get()/72.0)) MGDTODO
+	
 def set_offset_position(self, position):
 assert position == 'left' or position == 'right'
 
Modified: branches/transforms/lib/matplotlib/backend_bases.py
===================================================================
--- branches/transforms/lib/matplotlib/backend_bases.py	2007年09月10日 18:45:32 UTC (rev 3825)
+++ branches/transforms/lib/matplotlib/backend_bases.py	2007年09月10日 19:25:21 UTC (rev 3826)
@@ -1178,11 +1178,13 @@
 if dpi is None:
 dpi = rcParams['savefig.dpi']
 
- origDPI = self.figure.dpi.get()
+ origDPI = self.figure.dpi
 origfacecolor = self.figure.get_facecolor()
 origedgecolor = self.figure.get_edgecolor()
 
- self.figure.dpi.set(dpi)
+	# MGDTODO
+ # self.figure.dpi.set(dpi)
+ self.figure.dpi = dpi
 self.figure.set_facecolor(facecolor)
 self.figure.set_edgecolor(edgecolor)
 
@@ -1195,7 +1197,9 @@
 orientation=orientation,
 **kwargs)
 finally:
- self.figure.dpi.set(origDPI)
+	 # MGDTODO
+ # self.figure.dpi.set(origDPI)
+ self.figure.dpi = origDPI
 self.figure.set_facecolor(origfacecolor)
 self.figure.set_edgecolor(origedgecolor)
 self.figure.set_canvas(self)
Modified: branches/transforms/lib/matplotlib/backends/backend_agg.py
===================================================================
--- branches/transforms/lib/matplotlib/backends/backend_agg.py	2007年09月10日 18:45:32 UTC (rev 3825)
+++ branches/transforms/lib/matplotlib/backends/backend_agg.py	2007年09月10日 19:25:21 UTC (rev 3826)
@@ -106,14 +106,17 @@
 self.height = height
 if __debug__: verbose.report('RendererAgg.__init__ width=%s, \
 height=%s'%(width, height), 'debug-annoying')
- self._renderer = _RendererAgg(int(width), int(height), dpi.get(),
- debug=False)
+	# MGDTODO
+# self._renderer = _RendererAgg(int(width), int(height), dpi.get(),
+# 				 debug=False)
+ self._renderer = _RendererAgg(int(width), int(height), dpi,
+				 debug=False)
 if __debug__: verbose.report('RendererAgg.__init__ _RendererAgg done',
 'debug-annoying')
 self.draw_polygon = self._renderer.draw_polygon
 self.draw_rectangle = self._renderer.draw_rectangle
 self.draw_path = self._renderer.draw_path
- self.draw_lines = self._renderer.draw_lines
+ # self.draw_lines = self._renderer.draw_lines
 self.draw_markers = self._renderer.draw_markers
 self.draw_image = self._renderer.draw_image
 self.draw_line_collection = self._renderer.draw_line_collection
@@ -156,6 +159,9 @@
 y = npy.array([y1,y2], float)
 self._renderer.draw_lines(gc, x, y)
 
+ def draw_lines(self, gc, x, y, transform):
+	return self._renderer.draw_lines(gc, x, y, transform.to_values())
+	
 
 def draw_point(self, gc, x, y):
 """
@@ -173,7 +179,9 @@
 if __debug__: verbose.report('RendererAgg.draw_mathtext',
 'debug-annoying')
 ox, oy, width, height, descent, font_image, used_characters = \
- self.mathtext_parser.parse(s, self.dpi.get(), prop)
+ self.mathtext_parser.parse(s, self.dpi, prop)
+# ox, oy, width, height, descent, font_image, used_characters = \
+# self.mathtext_parser.parse(s, self.dpi.get(), prop) MGDTODO
 
 x = int(x) + ox
 y = int(y) - oy
@@ -228,7 +236,9 @@
 
 if ismath:
 ox, oy, width, height, descent, fonts, used_characters = \
- self.mathtext_parser.parse(s, self.dpi.get(), prop)
+ self.mathtext_parser.parse(s, self.dpi, prop)
+# ox, oy, width, height, descent, fonts, used_characters = \
+# self.mathtext_parser.parse(s, self.dpi.get(), prop) MGDTODO
 return width, height, descent
 font = self._get_agg_font(prop)
 font.set_text(s, 0.0, flags=LOAD_DEFAULT) # the width and height of unrotated string
@@ -302,7 +312,8 @@
 
 font.clear()
 size = prop.get_size_in_points()
- font.set_size(size, self.dpi.get())
+ font.set_size(size, self.dpi)
+ # font.set_size(size, self.dpi.get()) MGDTODO
 
 return font
 
@@ -380,7 +391,9 @@
 
 def get_renderer(self):
 l,b,w,h = self.figure.bbox.get_bounds()
- key = w, h, self.figure.dpi.get()
+	# MGDTODO
+ # key = w, h, self.figure.dpi.get()
+ key = w, h, self.figure.dpi
 try: self._lastKey, self.renderer
 except AttributeError: need_new_renderer = True
 else: need_new_renderer = (self._lastKey != key)
Modified: branches/transforms/lib/matplotlib/bbox.py
===================================================================
--- branches/transforms/lib/matplotlib/bbox.py	2007年09月10日 18:45:32 UTC (rev 3825)
+++ branches/transforms/lib/matplotlib/bbox.py	2007年09月10日 19:25:21 UTC (rev 3826)
@@ -6,9 +6,31 @@
 
 import numpy as N
 
+class Interval:
+ def __init__(self, bounds):
+	self._bounds = N.array(bounds, N.float_)
+
+ def contains(self, value):
+	bounds = self._bounds
+	return value >= bounds[0] and value <= bounds[1]
+
+ def contains_open(self, value):
+	bounds = self._bounds
+	return value > bounds[0] and value < bounds[1]
+
+ def get_bounds(self):
+	return self._bounds
+
+ def set_bounds(self, lower, upper):
+	self._bounds = lower, upper
+
+ def span(self):
+	bounds = self._bounds
+	return bounds[1] - bounds[0]
+	
 class Bbox:
 def __init__(self, points):
-	self._points = N.array(points)
+	self._points = N.array(points, N.float_)
 
 #@staticmethod
 def unit():
@@ -23,7 +45,10 @@
 #@staticmethod
 def from_lbrt(left, bottom, right, top):
 	return Bbox([[left, bottom], [right, top]])
- from_lbwh = staticmethod(from_lbwh)
+ from_lbrt = staticmethod(from_lbrt)
+
+ def copy(self):
+	return Bbox(self._points.copy())
 
 # MGDTODO: Probably a more efficient ways to do this...
 def xmin(self):
@@ -45,15 +70,29 @@
 	return self.ymax() - self.ymin()
 
 def transform(self, transform):
-	return Bbox(transform(points))
+	return Bbox(transform(self._points))
 
 def inverse_transform(self, transform):
-	return Bbox(transform.inverted()(points))
+	return Bbox(transform.inverted()(self._points))
 
 def get_bounds(self):
 	return (self.xmin(), self.ymin(),
 		self.xmax() - self.xmin(), self.ymax() - self.ymin())
- 
+
+ def intervalx(self):
+	return Interval(self._points[0])
+
+ def intervaly(self):
+	return Interval(self._points[1])
+
+ def scaled(self, sw, sh):
+	width = self.width()
+	height = self.height()
+	deltaw = (sw * width - width) / 2.0
+	deltah = (sh * height - height) / 2.0
+	a = N.array([[-deltaw, -deltah], [deltaw, deltah]])
+	return Bbox(self._points + a)
+	
 def lbwh_to_bbox(left, bottom, width, height):
 return Bbox([[left, bottom], [left + width, bottom + height]])
 
@@ -67,18 +106,18 @@
 	return bboxes[0]
 
 bbox = bboxes[0]
- xmin = bbox.xmin
- ymin = bbox.ymin
- xmax = bbox.xmax
- ymax = bbox.ymax
+ xmin = bbox.xmin()
+ ymin = bbox.ymin()
+ xmax = bbox.xmax()
+ ymax = bbox.ymax()
 
 for bbox in bboxes[1:]:
-	xmin = min(xmin, bbox.xmin)
-	ymin = min(ymin, bbox.ymin)
-	xmax = max(xmax, bbox.xmax)
-	ymax = max(ymax, bbox.ymax)
+	xmin = min(xmin, bbox.xmin())
+	ymin = min(ymin, bbox.ymin())
+	xmax = max(xmax, bbox.xmax())
+	ymax = max(ymax, bbox.ymax())
 
- return Bbox(xmin, ymin, xmax, ymax)
+ return Bbox.from_lbrt(xmin, ymin, xmax, ymax)
 
 # MGDTODO: There's probably a better place for this
 def nonsingular(vmin, vmax, expander=0.001, tiny=1e-15, increasing=True):
Modified: branches/transforms/lib/matplotlib/figure.py
===================================================================
--- branches/transforms/lib/matplotlib/figure.py	2007年09月10日 18:45:32 UTC (rev 3825)
+++ branches/transforms/lib/matplotlib/figure.py	2007年09月10日 19:25:21 UTC (rev 3826)
@@ -129,9 +129,10 @@
 if edgecolor is None: edgecolor = rcParams['figure.edgecolor']
 
 self.dpi = dpi
+	self.figsize = figsize
 	self.bbox = Bbox.from_lbwh(0, 0,
-				 self.figsize[0] * dpi,
-				 self.figsize[1] * dpi)
+				 figsize[0] * dpi,
+				 figsize[1] * dpi)
 	
 self.frameon = frameon
 
@@ -581,7 +582,8 @@
 #print 'figure draw'
 if not self.get_visible(): return
 renderer.open_group('figure')
- self.transFigure.freeze() # eval the lazy objects
+	# MGDTODO
+ # self.transFigure.freeze() # eval the lazy objects
 
 if self.frameon: self.figurePatch.draw(renderer)
 
@@ -615,7 +617,8 @@
 for legend in self.legends:
 legend.draw(renderer)
 
- self.transFigure.thaw() # release the lazy objects
+	# MGDTODO
+	# self.transFigure.thaw() # release the lazy objects
 renderer.close_group('figure')
 
 self._cachedRenderer = renderer
Modified: branches/transforms/lib/matplotlib/finance.py
===================================================================
--- branches/transforms/lib/matplotlib/finance.py	2007年09月10日 18:45:32 UTC (rev 3825)
+++ branches/transforms/lib/matplotlib/finance.py	2007年09月10日 19:25:21 UTC (rev 3826)
@@ -22,8 +22,7 @@
 from matplotlib.colors import colorConverter
 from lines import Line2D, TICKLEFT, TICKRIGHT
 from patches import Rectangle
-from matplotlib.transforms import scale_transform, Value, zero, one, \
- scale_sep_transform, blend_xy_sep_transform
+from matplotlib.affine import Affine2D
 
 
 
@@ -335,9 +334,9 @@
 offsetsClose = [ (i, close) for i, close in zip(xrange(len(closes)), closes) if close != -1 ]
 
 
- scale = ax.figure.dpi * Value(1/72.0)
+ scale = ax.figure.dpi * (1.0/72.0)
 
- tickTransform = scale_transform( scale, zero())
+ tickTransform = Affine2D().scaled(scale, 0.0)
 
 r,g,b = colorConverter.to_rgb(colorup)
 colorup = r,g,b,1
@@ -424,10 +423,10 @@
 
 offsetsBars = [ (i, open) for i,open in zip(xrange(len(opens)), opens) if open != -1 ]
 
- sx = ax.figure.dpi * Value(1/72.0) # scale for points
+ sx = ax.figure.dpi * (1.0/72.0) # scale for points
 sy = (ax.bbox.ur().y() - ax.bbox.ll().y()) / (ax.viewLim.ur().y() - ax.viewLim.ll().y())
 
- barTransform = scale_sep_transform(sx,sy)
+ barTransform = Affine2D().scaled(sx,sy)
 
 
 
@@ -512,10 +511,10 @@
 
 bars = [ ( (left, 0), (left, v), (right, v), (right, 0)) for v in volumes if v != -1 ]
 
- sx = ax.figure.dpi * Value(1/72.0) # scale for points
+ sx = ax.figure.dpi * (1.0/72.0) # scale for points
 sy = (ax.bbox.ur().y() - ax.bbox.ll().y()) / (ax.viewLim.ur().y() - ax.viewLim.ll().y())
 
- barTransform = scale_sep_transform(sx,sy)
+ barTransform = Affine2D().scaled(sx,sy)
 
 offsetsBars = [ (i, 0) for i,v in enumerate(volumes) if v != -1 ]
 
@@ -602,10 +601,10 @@
 
 bars = [ ( (left, 0), (left, volume), (right, volume), (right, 0)) for d, open, close, high, low, volume in quotes]
 
- sx = ax.figure.dpi * Value(1/72.0) # scale for points
+ sx = ax.figure.dpi * (1.0/72.0) # scale for points
 sy = (ax.bbox.ur().y() - ax.bbox.ll().y()) / (ax.viewLim.ur().y() - ax.viewLim.ll().y())
 
- barTransform = scale_sep_transform(sx,sy)
+ barTransform = Affine2D().scaled(sx,sy)
 
 dates = [d for d, open, close, high, low, volume in quotes]
 offsetsBars = [(d, 0) for d in dates]
@@ -662,10 +661,10 @@
 
 bars = [ ( (left, 0), (left, v), (right, v), (right, 0)) for v in vals if v != -1 ]
 
- sx = ax.figure.dpi * Value(1/72.0) # scale for points
+ sx = ax.figure.dpi * (1.0/72.0) # scale for points
 sy = (ax.bbox.ur().y() - ax.bbox.ll().y()) / (ax.viewLim.ur().y() - ax.viewLim.ll().y())
 
- barTransform = scale_sep_transform(sx,sy)
+ barTransform = Affine2D().scaled(sx,sy)
 
 offsetsBars = [ (i, 0) for i,v in enumerate(vals) if v != -1 ]
 
Modified: branches/transforms/lib/matplotlib/legend.py
===================================================================
--- branches/transforms/lib/matplotlib/legend.py	2007年09月10日 18:45:32 UTC (rev 3825)
+++ branches/transforms/lib/matplotlib/legend.py	2007年09月10日 19:25:21 UTC (rev 3826)
@@ -224,7 +224,7 @@
 a.set_transform(self.get_transform())
 
 def _approx_text_height(self):
- return self.fontsize/72.0*self.figure.dpi.get()/self.parent.bbox.height()
+ return self.fontsize/72.0*self.figure.dpi/self.parent.bbox.height()
 
 
 def draw(self, renderer):
@@ -531,7 +531,7 @@
 if not len(self.legendHandles) and not len(self.texts): return
 def get_tbounds(text): #get text bounds in axes coords
 bbox = text.get_window_extent(renderer)
- bboxa = inverse_transform_bbox(self.get_transform(), bbox)
+ bboxa = bbox.inverse_transform(self.get_transform())
 return bboxa.get_bounds()
 
 hpos = []
@@ -559,9 +559,11 @@
 handle.set_height(h/2)
 
 # Set the data for the legend patch
- bbox = self._get_handle_text_bbox(renderer).deepcopy()
+	# MGDTODO: This copy may no longer be needed now that Bboxes are
+	# essentially immutable
+ bbox = self._get_handle_text_bbox(renderer).copy()
 
- bbox.scale(1 + self.pad, 1 + self.pad)
+ bbox = bbox.scaled(1 + self.pad, 1 + self.pad)
 l,b,w,h = bbox.get_bounds()
 self.legendPatch.set_bounds(l,b,w,h)
 
Modified: branches/transforms/lib/matplotlib/lines.py
===================================================================
--- branches/transforms/lib/matplotlib/lines.py	2007年09月10日 18:45:32 UTC (rev 3825)
+++ branches/transforms/lib/matplotlib/lines.py	2007年09月10日 19:25:21 UTC (rev 3826)
@@ -362,8 +362,13 @@
 else:
 x, y = self._get_plottable()
 
-
- x, y = self.get_transform().numerix_x_y(x, y)
+	# MGDTODO: Put this in a single Nx2 array, rather than these
+	# separate ones
+	#### Conversion code
+	a = npy.vstack((x, y)).swapaxes(0, 1)
+	####
+ x, y = self.get_transform()(a)
+	
 #x, y = self.get_transform().seq_x_y(x, y)
 
 left = min(x)
@@ -373,7 +378,8 @@
 
 # correct for marker size, if any
 if self._marker is not None:
- ms = self._markersize/72.0*self.figure.dpi.get()
+ ms = self._markersize/72.0*self.figure.dpi
+ # ms = self._markersize/72.0*self.figure.dpi.get() MGDTODO
 left -= ms/2
 bottom -= ms/2
 width += ms
Modified: branches/transforms/lib/matplotlib/patches.py
===================================================================
--- branches/transforms/lib/matplotlib/patches.py	2007年09月10日 18:45:32 UTC (rev 3825)
+++ branches/transforms/lib/matplotlib/patches.py	2007年09月10日 19:25:21 UTC (rev 3826)
@@ -209,8 +209,13 @@
 gc.set_hatch(self._hatch )
 
 verts = self.get_verts()
- tverts = self.get_transform().seq_xy_tups(verts)
+ tverts = self.get_transform()(verts)
 
+	# MGDTODO: This result is an Nx2 numpy array, which could be passed
+	# directly to renderer.draw_polygon. However, it currently expects
+	# a list of tuples so we're converting it to that now.
+	tverts = [tuple(x) for x in tverts]
+	
 renderer.draw_polygon(gc, rgbFace, tverts)
 
 
Modified: branches/transforms/lib/matplotlib/text.py
===================================================================
--- branches/transforms/lib/matplotlib/text.py	2007年09月10日 18:45:32 UTC (rev 3825)
+++ branches/transforms/lib/matplotlib/text.py	2007年09月10日 19:25:21 UTC (rev 3826)
@@ -151,7 +151,7 @@
 def _get_xy_display(self):
 'get the (possibly unit converted) transformed x,y in display coords'
 x, y = self.get_position()
- return self.get_transform().xy_tup((x,y))
+ return self.get_transform()([[x,y]])[0]
 
 def _get_multialignment(self):
 if self._multialignment is not None: return self._multialignment
@@ -275,7 +275,8 @@
 ty = [float(v[1][0])+offsety for v in xys]
 
 # now inverse transform back to data coords
- xys = [self.get_transform().inverse_xy_tup( xy ) for xy in zip(tx, ty)]
+	inverse_transform = self.get_transform().inverted()
+ xys = inverse_transform(zip(tx, ty))
 
 xs, ys = zip(*xys)
 
@@ -328,7 +329,7 @@
 return
 
 for line, wh, x, y in info:
- x, y = trans.xy_tup((x, y))
+ x, y = trans([[x, y]])[0]
 
 if renderer.flipy():
 canvasw, canvash = renderer.get_canvas_width_height()
@@ -405,7 +406,7 @@
 return (x, y, self._text, self._color,
 self._verticalalignment, self._horizontalalignment,
 hash(self._fontproperties), self._rotation,
- self.get_transform().as_vec6_val(),
+ self.get_transform().to_values(),
 )
 
 def get_text(self):
Modified: branches/transforms/lib/matplotlib/ticker.py
===================================================================
--- branches/transforms/lib/matplotlib/ticker.py	2007年09月10日 18:45:32 UTC (rev 3825)
+++ branches/transforms/lib/matplotlib/ticker.py	2007年09月10日 19:25:21 UTC (rev 3826)
@@ -115,12 +115,11 @@
 import matplotlib as mpl
 from matplotlib import verbose, rcParams
 from matplotlib import cbook
-from matplotlib import transforms as mtrans
+from matplotlib import bbox as mbbox
 
 
 
 
-
 class TickHelper:
 
 viewInterval = None
@@ -149,8 +148,8 @@
 cases where the Intervals do not need to be updated
 automatically.
 '''
- self.dataInterval = mtrans.Interval(mtrans.Value(vmin), mtrans.Value(vmax))
- self.viewInterval = mtrans.Interval(mtrans.Value(vmin), mtrans.Value(vmax))
+ self.dataInterval = mbbox.Interval([vmin, vmax])
+ self.viewInterval = mbbox.Interval([vmin, vmax])
 
 class Formatter(TickHelper):
 """
@@ -572,7 +571,7 @@
 def autoscale(self):
 'autoscale the view limits'
 self.verify_intervals()
- return mtrans.nonsingular(*self.dataInterval.get_bounds())
+ return mbbox.nonsingular(*self.dataInterval.get_bounds())
 
 def pan(self, numsteps):
 'Pan numticks (can be positive or negative)'
@@ -714,7 +713,7 @@
 vmin = math.floor(scale*vmin)/scale
 vmax = math.ceil(scale*vmax)/scale
 
- return mtrans.nonsingular(vmin, vmax)
+ return mbbox.nonsingular(vmin, vmax)
 
 
 def closeto(x,y):
@@ -798,7 +797,7 @@
 vmin -=1
 vmax +=1
 
- return mtrans.nonsingular(vmin, vmax)
+ return mbbox.nonsingular(vmin, vmax)
 
 def scale_range(vmin, vmax, n = 1, threshold=100):
 dv = abs(vmax - vmin)
@@ -866,13 +865,13 @@
 def __call__(self):
 self.verify_intervals()
 vmin, vmax = self.viewInterval.get_bounds()
- vmin, vmax = mtrans.nonsingular(vmin, vmax, expander = 0.05)
+ vmin, vmax = mbbox.nonsingular(vmin, vmax, expander = 0.05)
 return self.bin_boundaries(vmin, vmax)
 
 def autoscale(self):
 self.verify_intervals()
 dmin, dmax = self.dataInterval.get_bounds()
- dmin, dmax = mtrans.nonsingular(dmin, dmax, expander = 0.05)
+ dmin, dmax = mbbox.nonsingular(dmin, dmax, expander = 0.05)
 return npy.take(self.bin_boundaries(dmin, dmax), [0,-1])
 
 
@@ -973,7 +972,7 @@
 if vmin==vmax:
 vmin = decade_down(vmin,self._base)
 vmax = decade_up(vmax,self._base)
- return mtrans.nonsingular(vmin, vmax)
+ return mbbox.nonsingular(vmin, vmax)
 
 class AutoLocator(MaxNLocator):
 def __init__(self):
Modified: branches/transforms/src/_backend_agg.cpp
===================================================================
--- branches/transforms/src/_backend_agg.cpp	2007年09月10日 18:45:32 UTC (rev 3825)
+++ branches/transforms/src/_backend_agg.cpp	2007年09月10日 19:25:21 UTC (rev 3826)
@@ -44,6 +44,27 @@
 #define M_PI_2 1.57079632679489661923
 #endif
 
+agg::trans_affine py_sequence_to_agg_transformation_matrix(const Py::Object& obj) {
+ Py::SeqBase<Py::Float> seq;
+ try {
+ seq = obj;
+ } catch(...) {
+ throw Py::ValueError("Transformation matrix must be given as a 6-element list.");
+ }
+
+ if (seq.size() != 6) {
+ throw Py::ValueError("Transformation matrix must be given as a 6-element list.");
+ }
+
+ agg::trans_affine xytrans = agg::trans_affine
+ (Py::Float(seq[0]), 
+ Py::Float(seq[1]), 
+ Py::Float(seq[2]), 
+ Py::Float(seq[3]), 
+ Py::Float(seq[4]), 
+ Py::Float(seq[5]));
+}
+
 GCAgg::GCAgg(const Py::Object &gc, double dpi, bool snapto) :
 dpi(dpi), snapto(snapto), isaa(true), linewidth(1.0), alpha(1.0),
 cliprect(NULL), clippath(NULL), 
@@ -646,7 +667,8 @@
 Py::SeqBase<Py::Object> linewidths = args[4];
 Py::SeqBase<Py::Object> linestyle = args[5];
 Py::SeqBase<Py::Object> antialiaseds = args[6];
- 
+
+ // MGDTODO: Verify we don't need this offset stuff anymore
 bool usingOffsets = args[7].ptr()!=Py_None;
 Py::SeqBase<Py::Object> offsets;
 Transformation* transOffset=NULL;
@@ -1534,24 +1556,14 @@
 //path_t transpath(path, xytrans);
 _process_alpha_mask(gc);
 
- Transformation* mpltransform = static_cast<Transformation*>(args[3].ptr());
+ agg::trans_affine xytrans = py_sequence_to_agg_transformation_matrix(args[3]);
 
- double a, b, c, d, tx, ty;
- try {
- mpltransform->affine_params_api(&a, &b, &c, &d, &tx, &ty);
- }
- catch(...) {
- throw Py::ValueError("Domain error on affine_params_api in RendererAgg::draw_lines");
- }
-
- agg::trans_affine xytrans = agg::trans_affine(a,b,c,d,tx,ty);
-
-
 agg::path_storage path;
 
+ // MGDTODO
+ bool needNonlinear = false;
+ // mpltransform->need_nonlinear_api();
 
- bool needNonlinear = mpltransform->need_nonlinear_api();
-
 double thisx(0.0), thisy(0.0);
 double origdx(0.0), origdy(0.0), origdNorm2(0);
 bool moveto = true;
@@ -1584,7 +1596,8 @@
 
 if (needNonlinear)
 try {
- mpltransform->nonlinear_only_api(&thisx, &thisy);
+	// MGDTODO
+ // mpltransform->nonlinear_only_api(&thisx, &thisy);
 }
 catch (...) {
 moveto = true;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <pki...@us...> - 2007年09月10日 18:45:33
Revision: 3825
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3825&view=rev
Author: pkienzle
Date: 2007年09月10日 11:45:32 -0700 (2007年9月10日)
Log Message:
-----------
Windows needs binary open flag for font files
Modified Paths:
--------------
 trunk/matplotlib/ttconv/pprdrv_tt.cpp
Modified: trunk/matplotlib/ttconv/pprdrv_tt.cpp
===================================================================
--- trunk/matplotlib/ttconv/pprdrv_tt.cpp	2007年09月10日 17:45:15 UTC (rev 3824)
+++ trunk/matplotlib/ttconv/pprdrv_tt.cpp	2007年09月10日 18:45:32 UTC (rev 3825)
@@ -1088,7 +1088,7 @@
 font.filename=filename;
 
 /* Open the font file */
- if( (font.file = fopen(filename,"r")) == (FILE*)NULL )
+ if( (font.file = fopen(filename,"rb")) == (FILE*)NULL )
 	throw TTException("Failed to open TrueType font");
 
 /* Allocate space for the unvarying part of the offset table. */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年09月10日 17:45:18
Revision: 3824
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3824&view=rev
Author: mdboom
Date: 2007年09月10日 10:45:15 -0700 (2007年9月10日)
Log Message:
-----------
Merged revisions 3813-3823 via svnmerge from 
http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib
........
 r3814 | jouni | 2007年09月07日 15:45:48 -0400 (2007年9月07日) | 3 lines
 
 In backend_pdf usetex, gather consecutive characters with same x
 coordinate and same font into strings.
........
 r3815 | mdboom | 2007年09月07日 16:28:01 -0400 (2007年9月07日) | 3 lines
 
 Support characters composed of multiple characters. Only one
 supported at the moment is AA (angstrom).
........
 r3816 | jouni | 2007年09月07日 16:43:20 -0400 (2007年9月07日) | 2 lines
 
 Return widths of glyphs to caller
........
 r3817 | efiring | 2007年09月08日 19:53:06 -0400 (2007年9月08日) | 2 lines
 
 Delete gd and paint backends.
........
 r3818 | efiring | 2007年09月08日 20:41:17 -0400 (2007年9月08日) | 2 lines
 
 Removed matplotlibrc; it is generated by setup.py.
........
 r3819 | efiring | 2007年09月09日 18:41:36 -0400 (2007年9月09日) | 2 lines
 
 Factored plotting part of pylab.py into pyplot.py
........
 r3820 | efiring | 2007年09月09日 21:42:39 -0400 (2007年9月09日) | 2 lines
 
 Numpification and cleanup of examples
........
 r3821 | efiring | 2007年09月10日 02:55:10 -0400 (2007年9月10日) | 2 lines
 
 Removed obsolete and broken methods from Axes and PolarAxes
........
Modified Paths:
--------------
 branches/transforms/API_CHANGES
 branches/transforms/CHANGELOG
 branches/transforms/boilerplate.py
 branches/transforms/examples/animation_blit.py
 branches/transforms/examples/animation_blit_fltk.py
 branches/transforms/examples/animation_blit_qt.py
 branches/transforms/examples/animation_blit_qt4.py
 branches/transforms/examples/animation_blit_tk.py
 branches/transforms/examples/animation_blit_wx.py
 branches/transforms/examples/backend_driver.py
 branches/transforms/examples/clippedline.py
 branches/transforms/examples/collections_demo.py
 branches/transforms/examples/color_by_yvalue.py
 branches/transforms/examples/contourf_demo.py
 branches/transforms/examples/data_helper.py
 branches/transforms/examples/dynamic_demo_wx.py
 branches/transforms/examples/dynamic_image_wxagg.py
 branches/transforms/examples/dynamic_image_wxagg2.py
 branches/transforms/examples/embedding_in_gtk.py
 branches/transforms/examples/embedding_in_gtk2.py
 branches/transforms/examples/embedding_in_gtk3.py
 branches/transforms/examples/embedding_in_qt.py
 branches/transforms/examples/embedding_in_qt4.py
 branches/transforms/examples/embedding_in_tk.py
 branches/transforms/examples/embedding_in_tk2.py
 branches/transforms/examples/embedding_in_wx.py
 branches/transforms/examples/embedding_in_wx2.py
 branches/transforms/examples/embedding_in_wx3.py
 branches/transforms/examples/embedding_in_wx4.py
 branches/transforms/examples/gtk_spreadsheet.py
 branches/transforms/examples/histogram_demo_canvasagg.py
 branches/transforms/examples/image_masked.py
 branches/transforms/examples/mathtext_wx.py
 branches/transforms/examples/mpl_with_glade.py
 branches/transforms/examples/multi_image.py
 branches/transforms/examples/pcolor_nonuniform.py
 branches/transforms/examples/polar_bar.py
 branches/transforms/examples/polar_demo.py
 branches/transforms/examples/polar_legend.py
 branches/transforms/examples/poly_editor.py
 branches/transforms/examples/printing_in_wx.py
 branches/transforms/examples/pythonic_matplotlib.py
 branches/transforms/examples/rc_traits.py
 branches/transforms/examples/scatter_masked.py
 branches/transforms/examples/strip_chart_demo.py
 branches/transforms/examples/tex_demo.py
 branches/transforms/examples/tex_unicode_demo.py
 branches/transforms/examples/vline_demo.py
 branches/transforms/examples/webapp_demo.py
 branches/transforms/examples/wxcursor_demo.py
 branches/transforms/lib/matplotlib/__init__.py
 branches/transforms/lib/matplotlib/axes.py
 branches/transforms/lib/matplotlib/backends/__init__.py
 branches/transforms/lib/matplotlib/backends/backend_pdf.py
 branches/transforms/lib/matplotlib/config/mplconfig.py
 branches/transforms/lib/matplotlib/config/rcsetup.py
 branches/transforms/lib/matplotlib/dviread.py
 branches/transforms/lib/matplotlib/mathtext.py
 branches/transforms/lib/matplotlib/mlab.py
 branches/transforms/lib/matplotlib/mpl-data/matplotlib.conf
 branches/transforms/lib/matplotlib/pylab.py
 branches/transforms/setupext.py
Added Paths:
-----------
 branches/transforms/lib/matplotlib/pyplot.py
Removed Paths:
-------------
 branches/transforms/examples/anim_tk.py
 branches/transforms/examples/gdtest.py
 branches/transforms/examples/image_demo_na.py
 branches/transforms/lib/matplotlib/backends/backend_gd.py
 branches/transforms/lib/matplotlib/backends/backend_paint.py
 branches/transforms/lib/matplotlib/mpl-data/matplotlibrc
Property Changed:
----------------
 branches/transforms/
Property changes on: branches/transforms
___________________________________________________________________
Name: svnmerge-integrated
 - /trunk/matplotlib:1-3812
 + /trunk/matplotlib:1-3823
Modified: branches/transforms/API_CHANGES
===================================================================
--- branches/transforms/API_CHANGES	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/API_CHANGES	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -1,3 +1,5 @@
+ The gd and paint backends have been deleted.
+
 The errorbar method and function now accept additional kwargs
 so that upper and lower limits can be indicated by capping the
 bar with a caret instead of a straight line segment.
Modified: branches/transforms/CHANGELOG
===================================================================
--- branches/transforms/CHANGELOG	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/CHANGELOG	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -1,3 +1,16 @@
+2007年09月09日 Split out the plotting part of pylab and put it in
+ pyplot.py; removed numerix from the remaining pylab.py,
+ which imports everything from pyplot.py. The intention
+ is that apart from cleanups, the result of importing
+ from pylab is nearly unchanged, but there is the
+ new alternative of importing from pyplot to get
+ the state-engine graphics without all the numeric
+ functions.
+ Numpified examples; deleted two that were obsolete;
+ modified some to use pyplot. - EF
+
+2007年09月08日 Eliminated gd and paint backends - EF
+
 2007年09月06日 .bmp file format is now longer an alias for .raw
 
 2007年09月07日 Added clip path support to pdf backend. - JKS
@@ -6,17 +19,17 @@
 Now it doesn't crash Preview.app. - JKS
 
 2007年09月06日 Refactored image saving code so that all GUI backends can
-	 save most image types. See FILETYPES for a matrix of
-	 backends and their supported file types. 
-	 Backend canvases should no longer write their own print_figure()
-	 method -- instead they should write a print_xxx method for
-	 each filetype they can output and add an entry to their
-	 class-scoped filetypes dictionary. - MGD
+ save most image types. See FILETYPES for a matrix of
+ backends and their supported file types.
+ Backend canvases should no longer write their own print_figure()
+ method -- instead they should write a print_xxx method for
+ each filetype they can output and add an entry to their
+ class-scoped filetypes dictionary. - MGD
 
 2007年09月05日 Fixed Qt version reporting in setupext.py - DSD
 
 2007年09月04日 Embedding Type 1 fonts in PDF, and thus usetex support
- via dviread, sort of works. To test, enable it by 
+ via dviread, sort of works. To test, enable it by
 renaming _draw_tex to draw_tex. - JKS
 
 2007年09月03日 Added ability of errorbar show limits via caret or
Modified: branches/transforms/boilerplate.py
===================================================================
--- branches/transforms/boilerplate.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/boilerplate.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -29,7 +29,7 @@
 return ret
 if Axes.%(func)s.__doc__ is not None:
 %(func)s.__doc__ = dedent(Axes.%(func)s.__doc__) + \"\"\"
-Addition kwargs: hold = [True|False] overrides default hold state\"\"\"
+Additional kwargs: hold = [True|False] overrides default hold state\"\"\"
 """
 
 _fmtmisc = """\
@@ -74,6 +74,8 @@
 'plot',
 'plot_date',
 'psd',
+ 'quiver',
+ 'quiverkey',
 'scatter',
 'semilogx',
 'semilogy',
@@ -82,8 +84,6 @@
 'stem',
 'step',
 'vlines',
- 'quiver',
- 'quiverkey',
 'xcorr',
 )
 
@@ -104,7 +104,6 @@
 'pcolormesh' : 'gci._current = ret',
 'imshow' : 'gci._current = ret',
 'spy' : 'gci._current = ret',
- 'quiver2' : 'gci._current = ret',
 'quiver' : 'gci._current = ret',
 'specgram' : 'gci._current = ret[-1]',
 
@@ -129,11 +128,13 @@
 # This function was autogenerated by boilerplate.py. Do not edit as
 # changes will be lost
 def %(name)s():
- 'set the default colormap to %(name)s and apply to current image if any. See help(colormaps) for more information'
+ '''
+ set the default colormap to %(name)s and apply to current image if any.
+ See help(colormaps) for more information
+ '''
 rc('image', cmap='%(name)s')
 im = gci()
 
-
 if im is not None:
 im.set_cmap(cm.%(name)s)
 draw_if_interactive()
Deleted: branches/transforms/examples/anim_tk.py
===================================================================
--- branches/transforms/examples/anim_tk.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/anim_tk.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -1,49 +0,0 @@
-# deprecated - this example is no longer needed. Follow the model of
-# anim.py to use interaction = True to avoid all the cruft of timers,
-# callbacks and the likes used here
-
-#!/usr/bin/env python2.3
-
-import matplotlib
-matplotlib.use('TkAgg')
-import pylab
-
-#import Tkinter as Tk
-import matplotlib.numerix as numerix
-fig = pylab.figure(1)
-ind = numerix.arange(60)
-
-
-
-x_tmp=[]
-for i in range(100):
- x_tmp.append(numerix.sin((ind+i)*numerix.pi/15.0))
-
-X=numerix.array(x_tmp)
-
-
-lines = pylab.plot(X[:,0],'o')
-
-manager = pylab.get_current_fig_manager()
-
-def updatefig(*args):
- updatefig.count += 1
- lines[0].set_ydata(X[:,updatefig.count%60])
- manager.canvas.draw()
- return updatefig.count
-updatefig.count=-1
-
-def run(*args):
- print 'called run'
-
- import time
- tstart = time.time()
- while 1:
- cnt = updatefig()
- if cnt==100: break
- print 'elapsed', 100.0/(time.time() - tstart)
-
-import Tkinter as Tk
-manager.window.after(10, run)
-manager.show()
-Tk.mainloop()
Modified: branches/transforms/examples/animation_blit.py
===================================================================
--- branches/transforms/examples/animation_blit.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/animation_blit.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -10,7 +10,7 @@
 
 import matplotlib
 matplotlib.use('GTKAgg')
-import matplotlib.numerix as nx
+import numpy as npy
 import pylab as p
 
 
@@ -21,8 +21,8 @@
 p.grid() # to ensure proper background restore
 
 # create the initial line
-x = nx.arange(0,2*nx.pi,0.01)
-line, = p.plot(x, nx.sin(x), animated=True, lw=2)
+x = npy.arange(0,2*npy.pi,0.01)
+line, = p.plot(x, npy.sin(x), animated=True, lw=2)
 
 # for profiling
 tstart = time.time()
@@ -34,7 +34,7 @@
 # restore the clean slate background
 canvas.restore_region(update_line.background)
 # update the data
- line.set_ydata(nx.sin(x+update_line.cnt/10.0))
+ line.set_ydata(npy.sin(x+update_line.cnt/10.0))
 # just draw the animated artist
 try:
 ax.draw_artist(line)
Modified: branches/transforms/examples/animation_blit_fltk.py
===================================================================
--- branches/transforms/examples/animation_blit_fltk.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/animation_blit_fltk.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -3,7 +3,7 @@
 import matplotlib
 matplotlib.use('FltkAgg')
 import pylab as p
-import matplotlib.numerix as nx
+import numpy as nx
 import time
 
 
Modified: branches/transforms/examples/animation_blit_qt.py
===================================================================
--- branches/transforms/examples/animation_blit_qt.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/animation_blit_qt.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -15,7 +15,7 @@
 ITERS = 1000
 
 import pylab as p
-import matplotlib.numerix as nx
+import numpy as npy
 import time
 
 class BlitQT(QObject):
@@ -27,8 +27,8 @@
 self.cnt = 0
 
 # create the initial line
- self.x = nx.arange(0,2*nx.pi,0.01)
- self.line, = p.plot(self.x, nx.sin(self.x), animated=True, lw=2)
+ self.x = npy.arange(0,2*npy.pi,0.01)
+ self.line, = p.plot(self.x, npy.sin(self.x), animated=True, lw=2)
 
 self.background = None
 
@@ -39,7 +39,7 @@
 # restore the clean slate background
 self.canvas.restore_region(self.background)
 # update the data
- self.line.set_ydata(nx.sin(self.x+self.cnt/10.0))
+ self.line.set_ydata(npy.sin(self.x+self.cnt/10.0))
 # just draw the animated artist
 self.ax.draw_artist(self.line)
 # just redraw the axes rectangle
Modified: branches/transforms/examples/animation_blit_qt4.py
===================================================================
--- branches/transforms/examples/animation_blit_qt4.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/animation_blit_qt4.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -10,7 +10,7 @@
 ITERS = 1000
 
 import pylab as p
-import matplotlib.numerix as nx
+import numpy as npy
 import time
 
 class BlitQT(QtCore.QObject):
@@ -22,8 +22,8 @@
 self.cnt = 0
 
 # create the initial line
- self.x = nx.arange(0,2*nx.pi,0.01)
- self.line, = p.plot(self.x, nx.sin(self.x), animated=True, lw=2)
+ self.x = npy.arange(0,2*npy.pi,0.01)
+ self.line, = p.plot(self.x, npy.sin(self.x), animated=True, lw=2)
 
 self.background = None
 
@@ -34,7 +34,7 @@
 # restore the clean slate background
 self.canvas.restore_region(self.background)
 # update the data
- self.line.set_ydata(nx.sin(self.x+self.cnt/10.0))
+ self.line.set_ydata(npy.sin(self.x+self.cnt/10.0))
 # just draw the animated artist
 self.ax.draw_artist(self.line)
 # just redraw the axes rectangle
Modified: branches/transforms/examples/animation_blit_tk.py
===================================================================
--- branches/transforms/examples/animation_blit_tk.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/animation_blit_tk.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -6,7 +6,7 @@
 
 import sys
 import pylab as p
-import matplotlib.numerix as nx
+import numpy as npy
 import time
 
 ax = p.subplot(111)
@@ -14,8 +14,8 @@
 
 
 # create the initial line
-x = nx.arange(0,2*nx.pi,0.01)
-line, = p.plot(x, nx.sin(x), animated=True, lw=2)
+x = npy.arange(0,2*npy.pi,0.01)
+line, = p.plot(x, npy.sin(x), animated=True, lw=2)
 
 def run(*args):
 background = canvas.copy_from_bbox(ax.bbox)
@@ -26,7 +26,7 @@
 # restore the clean slate background
 canvas.restore_region(background)
 # update the data
- line.set_ydata(nx.sin(x+run.cnt/10.0))
+ line.set_ydata(npy.sin(x+run.cnt/10.0))
 # just draw the animated artist
 ax.draw_artist(line)
 # just redraw the axes rectangle
Modified: branches/transforms/examples/animation_blit_wx.py
===================================================================
--- branches/transforms/examples/animation_blit_wx.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/animation_blit_wx.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -12,7 +12,7 @@
 import wx
 import sys
 import pylab as p
-import matplotlib.numerix as nx
+import numpy as npy
 import time
 
 
@@ -30,8 +30,8 @@
 p.grid() # to ensure proper background restore
 
 # create the initial line
-x = nx.arange(0,2*nx.pi,0.01)
-line, = p.plot(x, nx.sin(x), animated=True, lw=2)
+x = npy.arange(0,2*npy.pi,0.01)
+line, = p.plot(x, npy.sin(x), animated=True, lw=2)
 
 # for profiling
 tstart = time.time()
@@ -46,7 +46,7 @@
 # restore the clean slate background
 canvas.restore_region(update_line.background)
 # update the data
- line.set_ydata(nx.sin(x+update_line.cnt/10.0))
+ line.set_ydata(npy.sin(x+update_line.cnt/10.0))
 # just draw the animated artist
 ax.draw_artist(line)
 # just redraw the axes rectangle
Modified: branches/transforms/examples/backend_driver.py
===================================================================
--- branches/transforms/examples/backend_driver.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/backend_driver.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -42,7 +42,6 @@
 'histogram_demo.py',
 'image_demo.py',
 'image_demo2.py',
- 'image_demo_na.py',
 'image_masked.py',
 'image_origin.py',
 'invert_axes.py',
@@ -158,7 +157,7 @@
 
 if __name__ == '__main__':
 times = {}
- default_backends = ['Agg', 'PS', 'SVG', 'Template']
+ default_backends = ['Agg', 'PS', 'SVG', 'PDF', 'Template']
 if sys.platform == 'win32':
 python = r'c:\Python24\python.exe'
 else:
Modified: branches/transforms/examples/clippedline.py
===================================================================
--- branches/transforms/examples/clippedline.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/clippedline.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -4,7 +4,7 @@
 """
 
 from matplotlib.lines import Line2D
-import matplotlib.numerix as nx
+import numpy as npy
 from pylab import figure, show
 
 class ClippedLine(Line2D):
@@ -19,13 +19,13 @@
 
 def set_data(self, *args, **kwargs):
 Line2D.set_data(self, *args, **kwargs)
- self.xorig = nx.array(self._x)
- self.yorig = nx.array(self._y)
+ self.xorig = npy.array(self._x)
+ self.yorig = npy.array(self._y)
 
 def draw(self, renderer):
 xlim = self.ax.get_xlim()
 
- ind0, ind1 = nx.searchsorted(self.xorig, xlim)
+ ind0, ind1 = npy.searchsorted(self.xorig, xlim)
 self._x = self.xorig[ind0:ind1]
 self._y = self.yorig[ind0:ind1]
 N = len(self._x)
@@ -43,8 +43,8 @@
 fig = figure()
 ax = fig.add_subplot(111, autoscale_on=False)
 
-t = nx.arange(0.0, 100.0, 0.01)
-s = nx.sin(2*nx.pi*t)
+t = npy.arange(0.0, 100.0, 0.01)
+s = npy.sin(2*npy.pi*t)
 line = ClippedLine(ax, t, s, color='g', ls='-', lw=2)
 ax.add_line(line)
 ax.set_xlim(10,30)
Modified: branches/transforms/examples/collections_demo.py
===================================================================
--- branches/transforms/examples/collections_demo.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/collections_demo.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -17,10 +17,10 @@
 
 '''
 
-import pylab as P
+import matplotlib.pyplot as P
 from matplotlib import collections, axes, transforms
 from matplotlib.colors import colorConverter
-import matplotlib.numerix as N
+import numpy as N
 
 nverts = 50
 npts = 100
@@ -33,8 +33,8 @@
 spiral = zip(xx,yy)
 
 # Make some offsets
-xo = P.randn(npts)
-yo = P.randn(npts)
+xo = N.random.randn(npts)
+yo = N.random.randn(npts)
 xyo = zip(xo, yo)
 
 # Make a list of colors cycling through the rgbcmyk series.
@@ -90,7 +90,7 @@
 a = fig.add_subplot(2,2,3)
 
 col = collections.RegularPolyCollection(fig.dpi, 7,
- sizes = P.fabs(xx)*10, offsets=xyo,
+ sizes = N.fabs(xx)*10, offsets=xyo,
 transOffset=a.transData)
 a.add_collection(col, autolim=True)
 trans = transforms.scale_transform(fig.dpi/transforms.Value(72.),
@@ -111,12 +111,12 @@
 ncurves = 20
 offs = (0.1, 0.0)
 
-yy = P.linspace(0, 2*N.pi, nverts)
-ym = P.amax(yy)
+yy = N.linspace(0, 2*N.pi, nverts)
+ym = N.amax(yy)
 xx = (0.2 + (ym-yy)/ym)**2 * N.cos(yy-0.4) * 0.5
 segs = []
 for i in range(ncurves):
- xxx = xx + 0.02*P.randn(nverts)
+ xxx = xx + 0.02*N.random.randn(nverts)
 curve = zip(xxx, yy*100)
 segs.append(curve)
 
Modified: branches/transforms/examples/color_by_yvalue.py
===================================================================
--- branches/transforms/examples/color_by_yvalue.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/color_by_yvalue.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -1,7 +1,7 @@
 # use masked arrays to plot a line with different colors by y-value
-import matplotlib.numerix.ma as ma
-from matplotlib.numerix import logical_or
-from pylab import plot, show, arange, sin, pi
+import matplotlib.numerix.npyma as ma
+from numpy import logical_or, arange, sin, pi
+from matplotlib.pyplot import plot, show
 
 t = arange(0.0, 2.0, 0.01)
 s = sin(2*pi*t)
Modified: branches/transforms/examples/contourf_demo.py
===================================================================
--- branches/transforms/examples/contourf_demo.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/contourf_demo.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 from pylab import *
-import matplotlib.numerix.ma as ma
+import matplotlib.numerix.npyma as ma
 origin = 'lower'
 #origin = 'upper'
 
Modified: branches/transforms/examples/data_helper.py
===================================================================
--- branches/transforms/examples/data_helper.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/data_helper.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -1,7 +1,8 @@
 #!/usr/bin/env python
 # Some functions to load a return data for the plot demos
 
-from matplotlib.numerix import fromstring, argsort, take, array, resize
+from numpy import fromstring, argsort, take, array, resize
+
 def get_two_stock_data():
 """
 load stock time and price data for two stocks The return values
Modified: branches/transforms/examples/dynamic_demo_wx.py
===================================================================
--- branches/transforms/examples/dynamic_demo_wx.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/dynamic_demo_wx.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -63,7 +63,7 @@
 
 from matplotlib.figure import Figure
 from matplotlib.axes import Subplot
-import matplotlib.numerix as numpy
+import numpy
 from wx import *
 
 
Modified: branches/transforms/examples/dynamic_image_wxagg.py
===================================================================
--- branches/transforms/examples/dynamic_image_wxagg.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/dynamic_image_wxagg.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -12,26 +12,13 @@
 import matplotlib
 matplotlib.use('WXAgg')
 
-# jdh: you need to control Numeric vs numarray with numerix, otherwise
-# matplotlib may be using numeric under the hood and while you are
-# using numarray and this isn't efficient. Also, if you use
-# 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'
-
-
-# jdh: you can import cm directly, you don't need to go via
-# pylab
 import matplotlib.cm as cm
 
 from matplotlib.backends.backend_wxagg import Toolbar, FigureCanvasWxAgg
 
-# jdh: you don't need a figure manager in the GUI - this class was
-# designed for the pylab interface
-
 from matplotlib.figure import Figure
-import matplotlib.numerix as numerix
+import numpy as npy
 import wx
 
 
@@ -75,12 +62,12 @@
 # jdh you can add a subplot directly from the fig rather than
 # the fig manager
 a = self.fig.add_subplot(111)
- self.x = numerix.arange(120.0)*2*numerix.pi/120.0
+ self.x = npy.arange(120.0)*2*npy.pi/120.0
 self.x.resize((100,120))
- self.y = numerix.arange(100.0)*2*numerix.pi/100.0
+ self.y = npy.arange(100.0)*2*npy.pi/100.0
 self.y.resize((120,100))
- self.y = numerix.transpose(self.y)
- z = numerix.sin(self.x) + numerix.cos(self.y)
+ 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')
 
 def GetToolBar(self):
@@ -89,9 +76,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
Modified: branches/transforms/examples/dynamic_image_wxagg2.py
===================================================================
--- branches/transforms/examples/dynamic_image_wxagg2.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/dynamic_image_wxagg2.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -12,24 +12,14 @@
 import matplotlib
 matplotlib.use('WXAgg')
 
-# jdh: you need to control Numeric vs numarray with numerix, otherwise
-# matplotlib may be using numeric under the hood and while you are
-# using numarray and this isn't efficient. Also, if you use
-# numerix=numarray, it is important to compile matplotlib for numarray
-# by setting NUMERIX = 'numarray' in setup.py before building
 from matplotlib import rcParams
 import numpy as npy
 
-# jdh: you can import cm directly, you don't need to go via
-# pylab
 import matplotlib.cm as cm
 
 from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
 from matplotlib.backends.backend_wx import NavigationToolbar2Wx
 
-# jdh: you don't need a figure manager in the GUI - this class was
-# designed for the pylab interface
-
 from matplotlib.figure import Figure
 from wx import *
 
Modified: branches/transforms/examples/embedding_in_gtk.py
===================================================================
--- branches/transforms/examples/embedding_in_gtk.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/embedding_in_gtk.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -8,7 +8,7 @@
 
 from matplotlib.axes import Subplot
 from matplotlib.figure import Figure
-from matplotlib.numerix import arange, sin, pi
+from numpy import arange, sin, pi
 
 # uncomment to select /GTK/GTKAgg/GTKCairo
 from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
Modified: branches/transforms/examples/embedding_in_gtk2.py
===================================================================
--- branches/transforms/examples/embedding_in_gtk2.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/embedding_in_gtk2.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -7,7 +7,7 @@
 
 from matplotlib.axes import Subplot
 from matplotlib.figure import Figure
-from matplotlib.numerix import arange, sin, pi
+from numpy import arange, sin, pi
 
 # uncomment to select /GTK/GTKAgg/GTKCairo
 from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
Modified: branches/transforms/examples/embedding_in_gtk3.py
===================================================================
--- branches/transforms/examples/embedding_in_gtk3.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/embedding_in_gtk3.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -7,7 +7,7 @@
 
 from matplotlib.axes import Subplot
 from matplotlib.figure import Figure
-from matplotlib.numerix import arange, sin, pi
+from numpy import arange, sin, pi
 
 # uncomment to select /GTK/GTKAgg/GTKCairo
 #from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
Modified: branches/transforms/examples/embedding_in_qt.py
===================================================================
--- branches/transforms/examples/embedding_in_qt.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/embedding_in_qt.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -11,7 +11,7 @@
 import sys, os, random
 from qt import *
 
-from matplotlib.numerix import arange, sin, pi
+from numpy import arange, sin, pi
 from matplotlib.backends.backend_qtagg import FigureCanvasQTAgg as FigureCanvas
 from matplotlib.figure import Figure
 
Modified: branches/transforms/examples/embedding_in_qt4.py
===================================================================
--- branches/transforms/examples/embedding_in_qt4.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/embedding_in_qt4.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -12,7 +12,7 @@
 import sys, os, random
 from PyQt4 import QtGui, QtCore
 
-from matplotlib.numerix import arange, sin, pi
+from numpy import arange, sin, pi
 from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
 from matplotlib.figure import Figure
 
Modified: branches/transforms/examples/embedding_in_tk.py
===================================================================
--- branches/transforms/examples/embedding_in_tk.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/embedding_in_tk.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -2,7 +2,7 @@
 import matplotlib
 matplotlib.use('TkAgg')
 
-from matplotlib.numerix import arange, sin, pi
+from numpy import arange, sin, pi
 from matplotlib.axes import Subplot
 from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
 from matplotlib.figure import Figure
Modified: branches/transforms/examples/embedding_in_tk2.py
===================================================================
--- branches/transforms/examples/embedding_in_tk2.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/embedding_in_tk2.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -2,7 +2,7 @@
 import matplotlib
 matplotlib.use('TkAgg')
 
-from matplotlib.numerix import arange, sin, pi
+from numpy import arange, sin, pi
 from matplotlib.axes import Subplot
 from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
 from matplotlib.figure import Figure
Modified: branches/transforms/examples/embedding_in_wx.py
===================================================================
--- branches/transforms/examples/embedding_in_wx.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/embedding_in_wx.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -44,7 +44,7 @@
 
 from matplotlib.figure import Figure
 from matplotlib.axes import Subplot
-import matplotlib.numerix as numpy
+import numpy
 from wx import *
 
 
Modified: branches/transforms/examples/embedding_in_wx2.py
===================================================================
--- branches/transforms/examples/embedding_in_wx2.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/embedding_in_wx2.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -4,7 +4,7 @@
 toolbar - comment out the setA_toolbar line for no toolbar
 """
 
-from matplotlib.numerix import arange, sin, pi
+from numpy import arange, sin, pi
 
 import matplotlib
 
Modified: branches/transforms/examples/embedding_in_wx3.py
===================================================================
--- branches/transforms/examples/embedding_in_wx3.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/embedding_in_wx3.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -25,8 +25,6 @@
 from matplotlib.backends.backend_wxagg import Toolbar, FigureCanvasWxAgg
 from matplotlib.figure import Figure
 import numpy as npy
-import matplotlib.numerix.mlab as mlab
-from matplotlib.mlab import meshgrid
 
 from wx import *
 from wx.xrc import *
@@ -61,11 +59,11 @@
 
 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)
+ self.x, self.y = npy.meshgrid(x, 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
+ zmax = npy.amax(z) - ERR_TOL
 ymax_i, xmax_i = npy.nonzero(z >= zmax)
 if self.im.origin == 'upper':
 ymax_i = z.shape[0]-ymax_i
@@ -84,7 +82,7 @@
 z = npy.sin(self.x) + npy.cos(self.y)
 self.im.set_array(z)
 
- zmax = mlab.max(mlab.max(z))-ERR_TOL
+ zmax = npy.amax(z) - ERR_TOL
 ymax_i, xmax_i = npy.nonzero(z >= zmax)
 if self.im.origin == 'upper':
 ymax_i = z.shape[0]-ymax_i
Modified: branches/transforms/examples/embedding_in_wx4.py
===================================================================
--- branches/transforms/examples/embedding_in_wx4.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/embedding_in_wx4.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -4,7 +4,7 @@
 toolbar
 """
 
-from matplotlib.numerix import arange, sin, pi
+from numpy import arange, sin, pi
 
 import matplotlib
 
@@ -19,7 +19,7 @@
 
 from matplotlib.backends.backend_wx import _load_bitmap
 from matplotlib.figure import Figure
-from matplotlib.numerix.mlab import rand
+from numpy.random import rand
 
 from wx import *
 
Deleted: branches/transforms/examples/gdtest.py
===================================================================
--- branches/transforms/examples/gdtest.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/gdtest.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -1,34 +0,0 @@
-#!/usr/bin/env python
-import matplotlib
-matplotlib.use('GD')
-from pylab import *
-
-def f(t):
- s1 = cos(2*pi*t)
- e1 = exp(-t)
- return multiply(s1,e1)
-
-t1 = arange(0.0, 5.0, .1)
-t2 = arange(0.0, 5.0, 0.02)
-t3 = arange(0.0, 2.0, 0.01)
-
-
-if 1:
- subplot(211)
- l = plot(t1, f(t1), 'k-^')
- setp(l, 'markerfacecolor', 'r')
- xlim(0,5)
- title('A tale of 2 subplots', fontsize=12)
- ylabel('Signal 1', fontsize=10)
-
- subplot(212)
- l = plot(t1, f(t1), 'k->')
- xlim(0,5)
- ylabel('Signal 2', fontsize=10)
- xlabel('time (s)', fontsize=10, fontname='Courier')
-
-ax = gca()
-
-
-#savefig('gdtest', dpi=150)
-show()
Modified: branches/transforms/examples/gtk_spreadsheet.py
===================================================================
--- branches/transforms/examples/gtk_spreadsheet.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/gtk_spreadsheet.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -14,15 +14,13 @@
 matplotlib.use('GTKAgg') # or 'GTK'
 from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
 
-#from matplotlib.numerix import rand
-from matplotlib.numerix.random_array import random
+from numpy.random import random
 from matplotlib.figure import Figure
 
 
 class DataManager(gtk.Window):
 numRows, numCols = 20,10
 
- #data = rand(numRows, numCols)
 data = random((numRows, numCols))
 
 def __init__(self):
Modified: branches/transforms/examples/histogram_demo_canvasagg.py
===================================================================
--- branches/transforms/examples/histogram_demo_canvasagg.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/histogram_demo_canvasagg.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -13,7 +13,8 @@
 from matplotlib.figure import Figure
 from matplotlib.axes import Subplot
 from matplotlib.mlab import normpdf
-from matplotlib.numerix.mlab import randn
+from numpy.random import randn
+import numpy
 
 fig = Figure(figsize=(5,4), dpi=100)
 ax = fig.add_subplot(111)
@@ -42,14 +43,14 @@
 
 s = canvas.tostring_rgb() # save this and convert to bitmap as needed
 
-# get the figure dimensions for creating bitmaps or numeric arrays,
+# get the figure dimensions for creating bitmaps or numpy arrays,
 # etc.
 l,b,w,h = fig.bbox.get_bounds()
 w, h = int(w), int(h)
 
 if 0:
- # convert to a Numeric array
- X = fromstring(s, UInt8)
+ # convert to a numpy array
+ X = numpy.fromstring(s, numpy.uint8)
 X.shape = h, w, 3
 
 if 0:
Deleted: branches/transforms/examples/image_demo_na.py
===================================================================
--- branches/transforms/examples/image_demo_na.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/image_demo_na.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -1,40 +0,0 @@
-#!/usr/bin/env python
-from matplotlib import rcParams
-rcParams['numerix'] = 'numarray'
-
-from pylab import *
-
-
-def bivariate_normal(X, Y, sigmax=1.0, sigmay=1.0,
- mux=0.0, muy=0.0, sigmaxy=0.0):
- """
- Bivariate gaussan distribution for equal shape X, Y
-
- http://mathworld.wolfram.com/BivariateNormalDistribution.html
- """
- Xmu = X-mux
- Ymu = Y-muy
-
- rho = sigmaxy/(sigmax*sigmay)
- z = (1.0/sigmax**2)*Xmu**2 + (1.0/sigmay)*Ymu**2 - (2*rho/(sigmax*sigmay))*Xmu*Ymu
- return 1.0/(2*pi*sigmax*sigmay*(1-rho**2)) * exp( -1/(2*(1-rho**2))*z)
-
-
-delta = 0.025
-x = arange(-3.0, 3.0, delta)
-y = arange(-3.0, 3.0, delta)
-X,Y = meshgrid(x, y)
-Z1 = bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
-Z2 = bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
-
-# difference of Gaussians
-im = imshow(Z2-Z1)
-
-# set the interpolation method: 'nearest', 'bilinear', 'bicubic' and much more
-im.set_interpolation('bilinear')
-
-
-axis('off')
-#savefig('test')
-show()
-
Modified: branches/transforms/examples/image_masked.py
===================================================================
--- branches/transforms/examples/image_masked.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/image_masked.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -4,7 +4,7 @@
 '''
 
 from pylab import *
-import matplotlib.numerix.ma as ma
+import matplotlib.numerix.npyma as ma
 import matplotlib.colors as colors
 
 delta = 0.025
Modified: branches/transforms/examples/mathtext_wx.py
===================================================================
--- branches/transforms/examples/mathtext_wx.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/mathtext_wx.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -5,7 +5,7 @@
 
 import matplotlib
 matplotlib.use("WxAgg")
-from matplotlib.numerix import arange, sin, pi, cos, log
+from numpy import arange, sin, pi, cos, log
 from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
 from matplotlib.backends.backend_wx import NavigationToolbar2Wx
 from matplotlib.figure import Figure
@@ -42,14 +42,14 @@
 self.figure = Figure()
 self.axes = self.figure.add_subplot(111)
 self.change_plot(0)
- 
+
 self.canvas = FigureCanvas(self, -1, self.figure)
 
 self.sizer = wx.BoxSizer(wx.VERTICAL)
 self.add_buttonbar()
 self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
 self.add_toolbar() # comment this out for no toolbar
- 
+
 menuBar = wx.MenuBar()
 
 # File Menu
@@ -104,21 +104,21 @@
 
 def OnChangePlot(self, event):
 self.change_plot(event.GetId() - 1000)
- 
+
 def change_plot(self, plot_number):
 t = arange(1.0,3.0,0.01)
 s = functions[plot_number][1](t)
 self.axes.clear()
 self.axes.plot(t, s)
 self.Refresh()
- 
+
 class MyApp(wx.App):
 def OnInit(self):
 frame = CanvasFrame(None, "wxPython mathtext demo app")
 self.SetTopWindow(frame)
 frame.Show(True)
 return True
- 
+
 app = MyApp()
 app.MainLoop()
 
Modified: branches/transforms/examples/mpl_with_glade.py
===================================================================
--- branches/transforms/examples/mpl_with_glade.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/mpl_with_glade.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -8,7 +8,7 @@
 from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar
 from matplotlib.widgets import SpanSelector
 
-from matplotlib.numerix import arange, sin, pi
+from numpy import arange, sin, pi
 import gtk
 import gtk.glade
 
Modified: branches/transforms/examples/multi_image.py
===================================================================
--- branches/transforms/examples/multi_image.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/multi_image.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -5,19 +5,20 @@
 It also illustrates colorbar tick labelling with a multiplier.
 '''
 
-import pylab
+from matplotlib.pyplot import figure, show, sci
 from matplotlib import cm, colors
 from matplotlib.font_manager import FontProperties
-from matplotlib.numerix.mlab import amin, amax
+from numpy import amin, amax, ravel
+from numpy.random import rand
 
 Nr = 3
 Nc = 2
 
-fig = pylab.gcf()
+fig = figure()
 cmap = cm.cool
 
 figtitle = 'Multiple images'
-t = pylab.gcf().text(0.5, 0.95, figtitle,
+t = fig.text(0.5, 0.95, figtitle,
 horizontalalignment='center',
 fontproperties=FontProperties(size=16))
 
@@ -37,8 +38,8 @@
 a.set_xticklabels([])
 # Make some fake data with a range that varies
 # somewhat from one plot to the next.
- data =((1+i+j)/10.0)*pylab.rand(10,20)*1e-6
- dd = pylab.ravel(data)
+ data =((1+i+j)/10.0)*rand(10,20)*1e-6
+ dd = ravel(data)
 # Manually find the min and max of all colors for
 # use in setting the color scale.
 vmin = min(vmin, amin(dd))
@@ -60,12 +61,13 @@
 
 # We need the following only if we want to run this
 # script interactively and be able to change the colormap.
-pylab.sci(images[0])
 
-pylab.show()
+sci(images[0])
 
+show()
 
 
 
 
 
+
Modified: branches/transforms/examples/pcolor_nonuniform.py
===================================================================
--- branches/transforms/examples/pcolor_nonuniform.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/pcolor_nonuniform.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -1,11 +1,11 @@
-from pylab import figure, show
-import matplotlib.numerix as nx
+from matplotlib.pyplot import figure, show
+import numpy as npy
 from matplotlib.image import NonUniformImage
 
-x = nx.arange(-4, 4, 0.005)
-y = nx.arange(-4, 4, 0.005)
+x = npy.arange(-4, 4, 0.005)
+y = npy.arange(-4, 4, 0.005)
 print 'Size %d points' % (len(x) * len(y))
-z = nx.sqrt(x[nx.NewAxis,:]**2 + y[:,nx.NewAxis]**2)
+z = npy.sqrt(x[npy.newaxis,:]**2 + y[:,npy.newaxis]**2)
 
 fig = figure()
 ax = fig.add_subplot(111)
Modified: branches/transforms/examples/polar_bar.py
===================================================================
--- branches/transforms/examples/polar_bar.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/polar_bar.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -1,9 +1,8 @@
 #!/usr/bin/env python
 
-import matplotlib.numerix as nx
-from matplotlib.mlab import linspace
+import numpy as npy
 import matplotlib.cm as cm
-from pylab import figure, show, rc
+from matplotlib.pyplot import figure, show, rc
 
 
 # force square figure and square axes looks better for polar, IMO
@@ -11,9 +10,9 @@
 ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True)
 
 N = 20
-theta = nx.arange(0.0, 2*nx.pi, 2*nx.pi/N)
-radii = 10*nx.mlab.rand(N)
-width = nx.pi/4*nx.mlab.rand(N)
+theta = npy.arange(0.0, 2*npy.pi, 2*npy.pi/N)
+radii = 10*npy.random.rand(N)
+width = npy.pi/4*npy.random.rand(N)
 bars = ax.bar(theta, radii, width=width, bottom=0.1)
 for r,bar in zip(radii, bars):
 bar.set_facecolor( cm.jet(r/10.))
Modified: branches/transforms/examples/polar_demo.py
===================================================================
--- branches/transforms/examples/polar_demo.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/polar_demo.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -39,8 +39,8 @@
 # See the pylab rgrids and thetagrids functions for
 # information on how to customize the grid locations and labels
 
-import matplotlib.numerix as nx
-from pylab import figure, show, rc
+import numpy as npy
+from matplotlib.pyplot import figure, show, rc
 
 # radar green, solid grid lines
 rc('grid', color='#316931', linewidth=1, linestyle='-')
@@ -51,8 +51,8 @@
 fig = figure(figsize=(8,8))
 ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True, axisbg='#d5de9c')
 
-r = nx.arange(0, 3.0, 0.01)
-theta = 2*nx.pi*r
+r = npy.arange(0, 3.0, 0.01)
+theta = 2*npy.pi*r
 ax.plot(theta, r, color='#ee8d18', lw=3)
 ax.set_rmax(2.0)
 
Modified: branches/transforms/examples/polar_legend.py
===================================================================
--- branches/transforms/examples/polar_legend.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/polar_legend.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 
-import matplotlib.numerix as nx
-from pylab import figure, show, rc
+import numpy as npy
+from matplotlib.pyplot import figure, show, rc
 
 # radar green, solid grid lines
 rc('grid', color='#316931', linewidth=1, linestyle='-')
@@ -12,8 +12,8 @@
 fig = figure(figsize=(8,8))
 ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True, axisbg='#d5de9c')
 
-r = nx.arange(0, 3.0, 0.01)
-theta = 2*nx.pi*r
+r = npy.arange(0, 3.0, 0.01)
+theta = 2*npy.pi*r
 ax.plot(theta, r, color='#ee8d18', lw=3, label='a line')
 ax.plot(0.5*theta, r, color='blue', ls='--', lw=3, label='another line')
 ax.legend()
Modified: branches/transforms/examples/poly_editor.py
===================================================================
--- branches/transforms/examples/poly_editor.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/poly_editor.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -5,8 +5,7 @@
 """
 from matplotlib.artist import Artist
 from matplotlib.patches import Polygon, CirclePolygon
-from matplotlib.numerix import sqrt, nonzero, equal, asarray, dot, Float
-from matplotlib.numerix.mlab import amin
+from numpy import sqrt, nonzero, equal, asarray, dot, amin
 from matplotlib.mlab import dist_point_to_segment
 
 
Modified: branches/transforms/examples/printing_in_wx.py
===================================================================
--- branches/transforms/examples/printing_in_wx.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/printing_in_wx.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -39,7 +39,7 @@
 from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigCanvas
 
 from matplotlib.figure import Figure
-import matplotlib.numerix as numpy
+import numpy
 
 class PlotFrame(wx.Frame):
 help_msg=""" Menus for
Modified: branches/transforms/examples/pythonic_matplotlib.py
===================================================================
--- branches/transforms/examples/pythonic_matplotlib.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/pythonic_matplotlib.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -54,7 +54,7 @@
 
 
 from pylab import figure, close, axes, subplot, show
-from matplotlib.numerix import arange, sin, pi
+from numpy import arange, sin, pi
 
 t = arange(0.0, 1.0, 0.01)
 
Modified: branches/transforms/examples/rc_traits.py
===================================================================
--- branches/transforms/examples/rc_traits.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/rc_traits.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -128,8 +128,8 @@
 antialiased = flexible_true_trait
 
 timezones = 'UTC', 'US/Central', 'ES/Eastern' # fixme: and many more
-backends = ('GTKAgg', 'Cairo', 'FltkAgg', 'GD', 'GDK', 'GTK', 'Agg',
- 'GTKCairo', 'Paint', 'PS', 'SVG', 'Template', 'TkAgg',
+backends = ('GTKAgg', 'Cairo', 'FltkAgg', 'GDK', 'GTK', 'Agg',
+ 'GTKCairo', 'PS', 'SVG', 'Template', 'TkAgg',
 'WX')
 
 class RC(traits.HasTraits):
Modified: branches/transforms/examples/scatter_masked.py
===================================================================
--- branches/transforms/examples/scatter_masked.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/scatter_masked.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 from pylab import *
-import matplotlib.numerix.ma as ma
+import matplotlib.numerix.npyma as ma
 
 N = 100
 r0 = 0.6
Modified: branches/transforms/examples/strip_chart_demo.py
===================================================================
--- branches/transforms/examples/strip_chart_demo.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/strip_chart_demo.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -12,7 +12,7 @@
 import gobject, gtk
 import matplotlib
 matplotlib.use('GTKAgg')
-import matplotlib.numerix as nx
+import numpy as npy
 from matplotlib.lines import Line2D
 
 
@@ -36,9 +36,9 @@
 
 def emitter(self, p=0.01):
 'return a random value with probability p, else 0'
- v = nx.mlab.rand(1)
+ v = npy.random.rand(1)
 if v>p: return 0.
- else: return nx.mlab.rand(1)
+ else: return npy.random.rand(1)
 
 def update(self, *args):
 if self.background is None: return True
Modified: branches/transforms/examples/tex_demo.py
===================================================================
--- branches/transforms/examples/tex_demo.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/tex_demo.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -11,8 +11,8 @@
 
 """
 from matplotlib import rc
-from matplotlib.numerix import arange, cos, pi
-from pylab import figure, axes, plot, xlabel, ylabel, title, \
+from numpy import arange, cos, pi
+from matplotlib.pyplot import figure, axes, plot, xlabel, ylabel, title, \
 grid, savefig, show
 
 
Modified: branches/transforms/examples/tex_unicode_demo.py
===================================================================
--- branches/transforms/examples/tex_unicode_demo.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/tex_unicode_demo.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -7,8 +7,8 @@
 from matplotlib import rcParams
 rcParams['text.usetex']=True
 rcParams['text.latex.unicode']=True
-from matplotlib.numerix import arange, cos, pi
-from pylab import figure, axes, plot, xlabel, ylabel, title, \
+from numpy import arange, cos, pi
+from matplotlib.pyplot import figure, axes, plot, xlabel, ylabel, title, \
 grid, savefig, show
 
 figure(1)
Modified: branches/transforms/examples/vline_demo.py
===================================================================
--- branches/transforms/examples/vline_demo.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/vline_demo.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -1,17 +1,17 @@
 #!/usr/bin/env python
-from pylab import *
-from matplotlib.numerix import sin, exp, multiply, absolute, pi
-from matplotlib.numerix.random_array import normal
+from matplotlib.pyplot import *
+from numpy import sin, exp, absolute, pi, arange
+from numpy.random import normal
 
 def f(t):
 s1 = sin(2*pi*t)
 e1 = exp(-t)
- return absolute(multiply(s1,e1))+.05
+ return absolute((s1*e1))+.05
 
 
 t = arange(0.0, 5.0, 0.1)
 s = f(t)
-nse = multiply(normal(0.0, 0.3, t.shape), s)
+nse = normal(0.0, 0.3, t.shape) * s
 
 plot(t, s+nse, 'b^')
 vlines(t, [0], s)
Modified: branches/transforms/examples/webapp_demo.py
===================================================================
--- branches/transforms/examples/webapp_demo.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/webapp_demo.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -21,7 +21,7 @@
 from matplotlib.backends.backend_agg import FigureCanvasAgg
 from matplotlib.figure import Figure
 from matplotlib.cbook import iterable
-import matplotlib.numerix as nx
+import numpy as npy
 
 def make_fig():
 """
@@ -40,9 +40,9 @@
 line, = ax.plot([1,2,3], 'ro--', markersize=12, markerfacecolor='g')
 
 # make a translucent scatter collection
- x = nx.mlab.rand(100)
- y = nx.mlab.rand(100)
- area = nx.pi*(10 * nx.mlab.rand(100))**2 # 0 to 10 point radiuses
+ x = npy.random.rand(100)
+ y = npy.random.rand(100)
+ area = npy.pi*(10 * npy.random.rand(100))**2 # 0 to 10 point radiuses
 c = ax.scatter(x,y,area)
 c.set_alpha(0.5)
 
Modified: branches/transforms/examples/wxcursor_demo.py
===================================================================
--- branches/transforms/examples/wxcursor_demo.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/examples/wxcursor_demo.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -6,7 +6,7 @@
 from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
 from matplotlib.backends.backend_wx import NavigationToolbar2Wx
 from matplotlib.figure import Figure
-from matplotlib.numerix import arange, sin, pi
+from numpy import arange, sin, pi
 
 import wx
 
Modified: branches/transforms/lib/matplotlib/__init__.py
===================================================================
--- branches/transforms/lib/matplotlib/__init__.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/lib/matplotlib/__init__.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -530,16 +530,16 @@
 
 
 class RcParams(dict):
- 
+
 """A dictionary object including validation
- 
+
 validating functions are defined and associated with rc parameters in
 rcsetup.py
 """
- 
+
 validate = dict([ (key, converter) for key, (default, converter) in \
 defaultParams.iteritems() ])
- 
+
 def __setitem__(self, key, val):
 try:
 if key in _deprecated_map.keys():
@@ -620,7 +620,7 @@
 ret['datapath'] = get_data_path()
 
 verbose.report('loaded rc file %s'%fname)
- 
+
 return ret
 
 
Modified: branches/transforms/lib/matplotlib/axes.py
===================================================================
--- branches/transforms/lib/matplotlib/axes.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/lib/matplotlib/axes.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -1867,31 +1867,6 @@
 c =mcolors.colorConverter.to_rgba(c)
 self._cursorProps = lw, c
 
-
- def panx(self, numsteps):
- 'Pan the x axis numsteps (plus pan right, minus pan left)'
- self.xaxis.pan(numsteps)
- xmin, xmax = self.viewLim.intervalx().get_bounds()
- self._send_xlim_event()
-
- def pany(self, numsteps):
- 'Pan the x axis numsteps (plus pan up, minus pan down)'
- self.yaxis.pan(numsteps)
- self._send_ylim_event()
-
- def zoomx(self, numsteps):
- 'Zoom in on the x xaxis numsteps (plus for zoom in, minus for zoom out)'
- self.xaxis.zoom(numsteps)
- xmin, xmax = self.viewLim.intervalx().get_bounds()
- self._send_xlim_event()
-
- def zoomy(self, numsteps):
- 'Zoom in on the x xaxis numsteps (plus for zoom in, minus for zoom out)'
- self.yaxis.zoom(numsteps)
- self._send_ylim_event()
-
-
-
 def connect(self, s, func):
 """
 Register observers to be notified when certain events occur. Register
@@ -1913,6 +1888,7 @@
 def disconnect(self, cid):
 'disconnect from the Axes event.'
 raise DeprecationWarning('use the callbacks CallbackRegistry instance instead')
+
 def get_children(self):
 'return a list of child artists'
 children = []
@@ -5683,38 +5659,14 @@
 'ylabel not implemented'
 raise NotImplementedError('ylabel not defined for polar axes (yet)')
 
+ def set_xlim(self, xmin=None, xmax=None, emit=True, **kwargs):
+ 'xlim not implemented'
+ raise NotImplementedError('xlim not meaningful for polar axes')
 
- def set_xlim(self, xmin=None, xmax=None, emit=True):
- """
- set the xlimits
- ACCEPTS: len(2) sequence of floats
- """
- if xmax is None and iterable(xmin):
- xmin,xmax = xmin
+ def set_ylim(self, ymin=None, ymax=None, emit=True, **kwargs):
+ 'ylim not implemented'
+ raise NotImplementedError('ylim not meaningful for polar axes')
 
- old_xmin,old_xmax = self.get_xlim()
- if xmin is None: xmin = old_xmin
- if xmax is None: xmax = old_xmax
-
- self.viewLim.intervalx().set_bounds(xmin, xmax)
- if emit: self._send_xlim_event()
-
-
- def set_ylim(self, ymin=None, ymax=None, emit=True):
- """
- set the ylimits
- ACCEPTS: len(2) sequence of floats
- """
- if ymax is None and iterable(ymin):
- ymin,ymax = ymin
-
- old_ymin,old_ymax = self.get_ylim()
- if ymin is None: ymin = old_ymin
- if ymax is None: ymax = old_ymax
-
- self.viewLim.intervaly().set_bounds(ymin, ymax)
- if emit: self._send_ylim_event()
-
 def get_xscale(self):
 'return the xaxis scale string'
 return 'polar'
@@ -5765,10 +5717,9 @@
 """
 # 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 ke
-eping this around as an example for
+# cleaner way to do it, but am keeping 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
+# like this a method one day, or better yet make get_verts an Artist
 # method
 
 minx, maxx = self.get_xlim()
Modified: branches/transforms/lib/matplotlib/backends/__init__.py
===================================================================
--- branches/transforms/lib/matplotlib/backends/__init__.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/lib/matplotlib/backends/__init__.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -7,7 +7,7 @@
 
 interactive_bk = ['GTK', 'GTKAgg', 'GTKCairo', 'FltkAgg', 'QtAgg', 'Qt4Agg',
 'TkAgg', 'WX', 'WXAgg', 'CocoaAgg', 'Aqt']
-non_interactive_bk = ['Agg2', 'Agg', 'Cairo', 'EMF', 'GD', 'GDK', 'Paint',
+non_interactive_bk = ['Agg2', 'Agg', 'Cairo', 'EMF', 'GDK',
 'Pdf', 'PS', 'SVG', 'Template']
 all_backends = interactive_bk + non_interactive_bk
 
Deleted: branches/transforms/lib/matplotlib/backends/backend_gd.py
===================================================================
--- branches/transforms/lib/matplotlib/backends/backend_gd.py	2007年09月10日 17:40:47 UTC (rev 3823)
+++ branches/transforms/lib/matplotlib/backends/backend_gd.py	2007年09月10日 17:45:15 UTC (rev 3824)
@@ -1,374 +0,0 @@
-"""
-A gd backend http://newcenturycomputers.net/projects/gdmodule.html
-"""
-
-
-from __future__ import division
-import sys, os, math, warnings
-
-import numpy as npy
-
-try:
- import gd
-except ImportError:
- print >>sys.stderr, 'You must first install the gd module http://newcenturycomputers.net/projects/gdmodule.html'
- sys.exit()
-
-from matplotlib.backend_bases import RendererBase, \
- GraphicsContextBase, FigureManagerBase, FigureCanvasBase
-from matplotlib import verbose
-from matplotlib._pylab_helpers import Gcf
-from matplotlib.cbook import enumerate, pieces, is_string_like
-from matplotlib.colors import colorConverter
-from matplotlib.figure import Figure
-from matplotlib.transforms import Bbox
-from matplotlib.font_manager import findfont
-# support old font names
-if (os.environ.has_key('GDFONTPATH') and not
- os.environ.has_key('TTFPATH')):
- os.environ['TTFPATH'] = os.environ['GDFONTPATH']
-
-
-
-
-PIXELS_PER_INCH = 96 # constant GD uses for screen DPI
-
-
-def round(x):
- return int(math.floor(x+0.5))
-
-
-class RendererGD(RendererBase):
- """
- The renderer handles all the drawing primitives using a graphics
- context instance that controls the colors/styles
- """
-
-
- # todo: can gd support cap and join styles?
- def __init__(self, im, dpi):
- "Initialize the renderer with a gd image instance"
- self.im = im
- self._cached = {} # a map from get_color args to colors
-
- self.width, self.height = im.size()
- self.dpi = dpi
-
-
- def get_canvas_width_height(...
 
[truncated message content]
From: <md...@us...> - 2007年09月10日 17:40:51
Revision: 3823
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3823&view=rev
Author: mdboom
Date: 2007年09月10日 10:40:47 -0700 (2007年9月10日)
Log Message:
-----------
Adding new files that will eventually replace transforms.py/cpp
Added Paths:
-----------
 branches/transforms/lib/matplotlib/affine.py
 branches/transforms/lib/matplotlib/bbox.py
Added: branches/transforms/lib/matplotlib/affine.py
===================================================================
--- branches/transforms/lib/matplotlib/affine.py	 (rev 0)
+++ branches/transforms/lib/matplotlib/affine.py	2007年09月10日 17:40:47 UTC (rev 3823)
@@ -0,0 +1,207 @@
+"""
+A set of classes to handle transformations.
+
+2007 Michael Droettboom
+"""
+
+import numpy as N
+from numpy.linalg import inv
+
+class Transform(object):
+ def __call__(self, points):
+	raise NotImplementedError()
+
+ def __add__(self, other):
+	if isinstance(other, Transform):
+	 return CompositeTransform(self, other)
+	raise TypeError("Can not add Transform to object of type '%s'" % type(other))
+
+ def __radd__(self, other):
+	if isinstance(other, Transform):
+	 return CompositeTransform(other, self)
+	raise TypeError("Can not add Transform to object of type '%s'" % type(other))
+ 
+ def has_inverse(self):
+	raise NotImplementedError()
+ 
+ def inverted(self):
+	raise NotImplementedError()
+
+ def is_separable(self):
+	return False
+
+class CompositeTransform(Transform):
+ def __init__(self, a, b):
+	assert a.output_dims == b.input_dims
+	self.a = a
+	self.b = b
+
+ def __call__(self, points):
+	return self.b(self.a(points))
+ 
+class Affine2D(Transform):
+ input_dims = 2
+ output_dims = 2
+ 
+ def __init__(self, matrix = None):
+ """
+ Initialize an Affine transform from a 3x3 numpy float array.
+
+ a c e
+ b d f
+ 0 0 1
+ """
+	if matrix is None:
+	 matrix = N.identity(3)
+	else:
+	 assert matrix.shape == (3, 3)
+	self.mtx = matrix
+
+ def __repr__(self):
+	return repr(self.mtx)
+
+ def __str__(self):
+	return str(self.mtx)
+ 
+ #@staticmethod
+ def from_values(a, b, c, d, e, f):
+ return Affine2D(Affine2D.matrix_from_values(a, b, c, d, e, f))
+ from_values = staticmethod(from_values)
+ 
+ #@staticmethod
+ def matrix_from_values(a, b, c, d, e, f):
+	affine = N.zeros((3,3), N.float_)
+	affine[0,] = a, c, e
+	affine[1,] = b, d, f
+	affine[2,2] = 1
+	return affine
+ matrix_from_values = staticmethod(matrix_from_values)
+
+ def __call__(self, points):
+ """
+ Applies the transformation to a set of 2D points and
+	returns the result.
+
+	points must be a numpy array of shape (N, 2), where N is the
+	number of points.
+	"""
+	# MGDTODO: This involves a copy. We may need to do something like
+	# http://neuroimaging.scipy.org/svn/ni/ni/trunk/neuroimaging/core/reference/mapping.py
+	# to separate the matrix out into the translation and scale components
+	# and apply each separately (which is still sub-optimal)
+
+	# This is nicer for now, however, since we can just keep a
+	# regular affine matrix around
+	new_points = points.swapaxes(0, 1)
+	new_points = N.vstack((new_points, N.ones((1, points.shape[0]))))
+	result = N.dot(self.mtx, new_points)[:2]
+	result.swapaxes(0, 1)
+	return result
+ 
+ #@staticmethod
+ def _concat(a, b):
+ return N.dot(b, a)
+ _concat = staticmethod(_concat)
+
+ def concat(a, b):
+	return Affine2D(Affine2D._concat(a.mtx, b.mtx))
+ concat = staticmethod(concat)
+ 
+ #@staticmethod
+ def identity():
+ return Affine2D(N.identity(3))
+ identity = staticmethod(identity)
+
+ def __add__(self, other):
+ if isinstance(other, Affine2D):
+	 return Affine2D.concat(self, other)
+	return Transform.__add__(self, other)
+
+ def __radd__(self, other):
+ if isinstance(other, Affine2D):
+	 return Affine2D.concat(other, self)
+	return Transform.__radd__(self, other)
+	
+ def rotated(self, theta):
+ a = N.cos(theta)
+ b = N.sin(theta)
+ rotate_mtx = self.matrix_from_values(a, b, -b, a, 0, 0)
+ return Affine2D(self._concat(self.mtx, rotate_mtx))
+
+ def rotated_deg(self, degrees):
+ return self.rotated(degrees*N.pi/180.)
+
+ def translated(self, tx, ty):
+ translate_mtx = self.matrix_from_values(1., 0., 0., 1., tx, ty)
+ return Affine2D(self._concat(self.mtx, translate_mtx))
+
+ def scaled(self, sx, sy=None):
+	if sy is None:
+	 sy = sx
+	scale_mtx = self.matrix_from_values(sx, 0., 0., sy, 0., 0.)
+ return Affine2D(self._concat(self.mtx, scale_mtx))
+
+ def inverted(self):
+	# MGDTODO: We may want to optimize by storing the inverse
+	# of the transform with every transform
+	return Affine2D(inv(self.mtx))
+ 
+ def is_separable(self):
+	mtx = self.mtx
+	return mtx[0, 1] == 0.0 and mtx[1, 0] == 0.0
+
+class BlendedAffine2D(Affine2D):
+ def __init__(self, x_transform, y_transform):
+	assert isinstance(x_transform, Affine2D)
+	assert isinstance(y_transform, Affine2D)
+	assert x_transform.is_separable()
+	assert y_transform.is_separable()
+	x_mtx = x_transform.mtx
+	y_mtx = y_transform.mtx
+	self.mtx = self.matrix_from_values(
+	 x_mtx[0,0], 0.0, 0.0, y_mtx[1,1], x_mtx[0,2], y_mtx[1,2])
+
+# This is a placeholder since eventually we may need to handle the
+# more general case of two transforms that aren't affines
+BlendedTransform = BlendedAffine2D
+
+def blend_xy_sep_transform(x_transform, y_transform):
+ return BlendedAffine2D(x_transform, y_transform)
+
+def get_bbox_transform(boxin, boxout):
+ x_scale = boxout.width() / boxin.width()
+ y_scale = boxout.height() / boxin.height()
+ 
+ # MGDTODO: Optimize
+ return Affine2D() \
+	.translated(-boxin.xmin(), -boxin.ymin()) \
+	.scaled(x_scale, y_scale) \
+	.translated(boxout.xmin(), boxout.ymin())
+ 
+if __name__ == '__main__':
+ print Affine2D.from_values(1., 0, 0, 1, 0, 0)
+ 
+ print "translated", Affine2D.identity().translated(5, 4)
+ print "rotated", Affine2D.identity().rotated_deg(30)
+ print "scaled", Affine2D.identity().scaled(5, 4)
+ 
+ transform = Affine2D.identity().rotated_deg(30).translated(5, 4)
+
+ points = N.array([[1, 2], [3, 4], [5, 6]])
+
+ print inv(transform.mtx)
+ 
+ print transform(points)
+
+ transform = Affine2D.identity().scaled(5., 1.).translated(10, 0)
+ print transform
+ print transform.inverted()
+
+ from bbox import Bbox
+ boxin = Bbox([[10, 10], [320, 240]])
+ boxout = Bbox([[25, 25], [640, 400]])
+ trans = bbox_transform(boxin, boxout)
+ print trans
+ print trans(N.array([[10, 10], [320, 240]]))
+ 
+__all__ = ['Transform', 'Affine2D']
Added: branches/transforms/lib/matplotlib/bbox.py
===================================================================
--- branches/transforms/lib/matplotlib/bbox.py	 (rev 0)
+++ branches/transforms/lib/matplotlib/bbox.py	2007年09月10日 17:40:47 UTC (rev 3823)
@@ -0,0 +1,108 @@
+"""
+A convenience class for handling bounding boxes
+
+2007 Michael Droettboom
+"""
+
+import numpy as N
+
+class Bbox:
+ def __init__(self, points):
+	self._points = N.array(points)
+
+ #@staticmethod
+ def unit():
+	return Bbox([[0,0], [1,1]])
+ unit = staticmethod(unit)
+
+ #@staticmethod
+ def from_lbwh(left, bottom, width, height):
+	return Bbox([[left, bottom], [left + width, bottom + height]])
+ from_lbwh = staticmethod(from_lbwh)
+
+ #@staticmethod
+ def from_lbrt(left, bottom, right, top):
+	return Bbox([[left, bottom], [right, top]])
+ from_lbwh = staticmethod(from_lbwh)
+ 
+ # MGDTODO: Probably a more efficient ways to do this...
+ def xmin(self):
+	return self._points[0,0]
+
+ def ymin(self):
+	return self._points[0,1]
+
+ def xmax(self):
+	return self._points[1,0]
+ 
+ def ymax(self):
+	return self._points[1,1]
+
+ def width(self):
+	return self.xmax() - self.xmin()
+
+ def height(self):
+	return self.ymax() - self.ymin()
+
+ def transform(self, transform):
+	return Bbox(transform(points))
+
+ def inverse_transform(self, transform):
+	return Bbox(transform.inverted()(points))
+
+ def get_bounds(self):
+	return (self.xmin(), self.ymin(),
+		self.xmax() - self.xmin(), self.ymax() - self.ymin())
+ 
+def lbwh_to_bbox(left, bottom, width, height):
+ return Bbox([[left, bottom], [left + width, bottom + height]])
+ 
+def bbox_union(bboxes):
+ """
+ Return the Bbox that bounds all bboxes
+ """
+ assert(len(bboxes))
+
+ if len(bboxes) == 1:
+	return bboxes[0]
+
+ bbox = bboxes[0]
+ xmin = bbox.xmin
+ ymin = bbox.ymin
+ xmax = bbox.xmax
+ ymax = bbox.ymax
+
+ for bbox in bboxes[1:]:
+	xmin = min(xmin, bbox.xmin)
+	ymin = min(ymin, bbox.ymin)
+	xmax = max(xmax, bbox.xmax)
+	ymax = max(ymax, bbox.ymax)
+
+ return Bbox(xmin, ymin, xmax, ymax)
+
+# MGDTODO: There's probably a better place for this
+def nonsingular(vmin, vmax, expander=0.001, tiny=1e-15, increasing=True):
+ '''
+ Ensure the endpoints of a range are not too close together.
+
+ "too close" means the interval is smaller than 'tiny' times
+ the maximum absolute value.
+
+ If they are too close, each will be moved by the 'expander'.
+ If 'increasing' is True and vmin > vmax, they will be swapped,
+ regardless of whether they are too close.
+ '''
+ swapped = False
+ if vmax < vmin:
+ vmin, vmax = vmax, vmin
+ swapped = True
+ if vmax - vmin <= max(abs(vmin), abs(vmax)) * tiny:
+ if vmin==0.0:
+ vmin = -expander
+ vmax = expander
+ else:
+ vmin -= expander*abs(vmin)
+ vmax += expander*abs(vmax)
+ if swapped and not increasing:
+ vmin, vmax = vmax, vmin
+ return vmin, vmax
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年09月10日 17:39:47
Revision: 3822
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3822&view=rev
Author: mdboom
Date: 2007年09月10日 10:39:37 -0700 (2007年9月10日)
Log Message:
-----------
Baby steps and horrible breakage on transforms branch.
Modified Paths:
--------------
 branches/transforms/lib/matplotlib/artist.py
 branches/transforms/lib/matplotlib/axes.py
 branches/transforms/lib/matplotlib/axis.py
 branches/transforms/lib/matplotlib/backends/backend_agg.py
 branches/transforms/lib/matplotlib/figure.py
 branches/transforms/lib/matplotlib/legend.py
 branches/transforms/lib/matplotlib/lines.py
 branches/transforms/lib/matplotlib/pylab.py
 branches/transforms/lib/matplotlib/table.py
 branches/transforms/lib/matplotlib/text.py
 branches/transforms/lib/matplotlib/transforms.py
 branches/transforms/lib/matplotlib/widgets.py
Modified: branches/transforms/lib/matplotlib/artist.py
===================================================================
--- branches/transforms/lib/matplotlib/artist.py	2007年09月10日 06:55:10 UTC (rev 3821)
+++ branches/transforms/lib/matplotlib/artist.py	2007年09月10日 17:39:37 UTC (rev 3822)
@@ -1,7 +1,7 @@
 from __future__ import division
 import sys, re
 from cbook import iterable, flatten
-from transforms import identity_transform
+from affine import Affine2D
 import matplotlib.units as units
 
 ## Note, matplotlib artists use the doc strings for set and get
@@ -145,7 +145,7 @@
 def get_transform(self):
 'return the Transformation instance used by this artist'
 if self._transform is None:
- self._transform = identity_transform()
+ self._transform = Affine2D()
 return self._transform
 
 def hitlist(self,event):
Modified: branches/transforms/lib/matplotlib/axes.py
===================================================================
--- branches/transforms/lib/matplotlib/axes.py	2007年09月10日 06:55:10 UTC (rev 3821)
+++ branches/transforms/lib/matplotlib/axes.py	2007年09月10日 17:39:37 UTC (rev 3822)
@@ -9,6 +9,8 @@
 rcParams = matplotlib.rcParams
 
 from matplotlib import artist as martist
+from matplotlib import affine as maffine
+from matplotlib import bbox as mbbox
 from matplotlib import agg
 from matplotlib import axis as maxis
 from matplotlib import cbook
@@ -23,11 +25,11 @@
 from matplotlib import mlab
 from matplotlib import cm
 from matplotlib import patches as mpatches
+from matplotlib import pbox as mpbox
 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
@@ -413,14 +415,7 @@
 yield seg
 remaining=remaining[2:]
 
-ValueType=type(mtrans.zero())
-def makeValue(v):
- if type(v) == ValueType:
- return v
- else:
- return mtrans.Value(v)
 
-
 class Axes(martist.Artist):
 """
 The Axes contains most of the figure elements: Axis, Tick, Line2D,
@@ -434,10 +429,15 @@
 
 """
 
- scaled = {mtrans.IDENTITY : 'linear',
- mtrans.LOG10 : 'log',
+ # MGDTODO
+# scaled = {mtrans.IDENTITY : 'linear',
+# mtrans.LOG10 : 'log',
+# }
+ scaled = {0 : 'linear',
+ 1 : 'log',
 }
 
+ 
 def __str__(self):
 return "Axes(%g,%g;%gx%g)"%(self._position[0].get(),self._position[1].get(),
 self._position[2].get(),self._position[3].get())
@@ -485,7 +485,7 @@
 
 """
 martist.Artist.__init__(self)
- self._position = map(makeValue, rect)
+ self._position = rect
 self._originalPosition = rect
 self.set_axes(self)
 self.set_aspect('auto')
@@ -629,12 +629,9 @@
 self.right = (l+w)*figw
 self.top = (b+h)*figh
 
-
- Bbox = mtrans.Bbox
- Point = mtrans.Point
- self.bbox = Bbox(
- Point(self.left, self.bottom),
- Point(self.right, self.top ),
+ self.bbox = mbbox.Bbox.from_lbrt(
+ self.left, self.bottom,
+ self.right, self.top,
 )
 #these will be updated later as data is added
 self._set_lim_and_transforms()
@@ -644,40 +641,36 @@
 set the dataLim and viewLim BBox attributes and the
 transData and transAxes Transformation attributes
 """
-
-
- one = mtrans.one
- zero = mtrans.zero
- Point = mtrans.Point
- Bbox = mtrans.Bbox
+ Bbox = mbbox.Bbox
 if self._sharex is not None:
- left=self._sharex.viewLim.ll().x()
- right=self._sharex.viewLim.ur().x()
+ left = self._sharex.viewLim.xmin()
+ right = self._sharex.viewLim.xmax()
 else:
- left=zero()
- right=one()
+ left = 0.0
+ right = 1.0
 if self._sharey is not None:
- bottom=self._sharey.viewLim.ll().y()
- top=self._sharey.viewLim.ur().y()
+ bottom = self._sharey.viewLim.ymin()
+ top = self._sharey.viewLim.ymax()
 else:
- bottom=zero()
- top=one()
+ bottom = 0.0
+ top = 1.0
 
 
 
- self.viewLim = Bbox(Point(left, bottom), Point(right, top))
- self.dataLim = mtrans.unit_bbox()
+ self.viewLim = Bbox.from_lbrt(left, bottom, right, top)
+ self.dataLim = Bbox.unit()
 
- self.transData = mtrans.get_bbox_transform(
+ self.transData = maffine.get_bbox_transform(
 self.viewLim, self.bbox)
- self.transAxes = mtrans.get_bbox_transform(
- mtrans.unit_bbox(), self.bbox)
+ self.transAxes = maffine.get_bbox_transform(
+ Bbox.unit(), self.bbox)
 
- if self._sharex:
- self.transData.set_funcx(self._sharex.transData.get_funcx())
+	# MGDTODO
+# if self._sharex:
+# self.transData.set_funcx(self._sharex.transData.get_funcx())
 
- if self._sharey:
- self.transData.set_funcy(self._sharey.transData.get_funcy())
+# if self._sharey:
+# self.transData.set_funcy(self._sharey.transData.get_funcy())
 
 def get_position(self, original=False):
 'Return the axes rectangle left, bottom, width, height'
@@ -861,7 +854,7 @@
 """
 ACCEPTS: ['C', 'SW', 'S', 'SE', 'E', 'NE', 'N', 'NW', 'W']
 """
- if anchor in mtrans.PBox.coefs.keys() or len(anchor) == 2:
+ if anchor in mpbox.PBox.coefs.keys() or len(anchor) == 2:
 self._anchor = anchor
 else:
 raise ValueError('argument must be among %s' %
@@ -901,7 +894,7 @@
 if data_ratio is None:
 data_ratio = ysize/xsize
 box_aspect = A * data_ratio
- pb = mtrans.PBox(self._originalPosition)
+ pb = mpbox.PBox(self._originalPosition)
 pb1 = pb.shrink_to_aspect(box_aspect, fig_aspect)
 self.set_position(pb1.anchor(self._anchor), 'active')
 return
@@ -1538,11 +1531,12 @@
 if xmin is None: xmin = old_xmin
 if xmax is None: xmax = old_xmax
 
- if (self.transData.get_funcx().get_type()==mtrans.LOG10
- and min(xmin, xmax)<=0):
- raise ValueError('Cannot set nonpositive limits with log transform')
+	# MGDTODO
+# 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 = mtrans.nonsingular(xmin, xmax, increasing=False)
+ xmin, xmax = mbbox.nonsingular(xmin, xmax, increasing=False)
 self.viewLim.intervalx().set_bounds(xmin, xmax)
 if emit: self.callbacks.process('xlim_changed', self)
 
@@ -1574,19 +1568,22 @@
 #if subsx is None: subsx = range(2, basex)
 assert(value.lower() in ('log', 'linear', ))
 if value == 'log':
- 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()
+	 # MGDTODO
+# 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()
+	 pass
 elif value == 'linear':
 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 )
+ # self.transData.get_funcx().set_type( mtrans.IDENTITY )
+	 self.transData.get_funcx().set_type( 0 ) # MGDTODO
 
 def get_xticks(self):
 'Return the x ticks as a list of locations'
@@ -1659,11 +1656,12 @@
 if ymin is None: ymin = old_ymin
 if ymax is None: ymax = old_ymax
 
- if (self.transData.get_funcy().get_type()==mtrans.LOG10
- and min(ymin, ymax)<=0):
- raise ValueError('Cannot set nonpositive limits with log transform')
+	# MGDTODO
+# 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 = mtrans.nonsingular(ymin, ymax, increasing=False)
+ ymin, ymax = mbbox.nonsingular(ymin, ymax, increasing=False)
 self.viewLim.intervaly().set_bounds(ymin, ymax)
 if emit: self.callbacks.process('ylim_changed', self)
 
@@ -1696,21 +1694,24 @@
 assert(value.lower() in ('log', 'linear', ))
 
 if value == 'log':
- 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()
-
+	 # MGDTODO
+# 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()
+	 pass
+	 
 elif value == 'linear':
 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 )
-
+ # self.transData.get_funcy().set_type( mtrans.IDENTITY ) MGDTODO
+ self.transData.get_funcy().set_type( 0 )
+	 
 def get_yticks(self):
 'Return the y ticks as a list of locations'
 return self.yaxis.get_ticklocs()
@@ -1744,9 +1745,11 @@
 
 def toggle_log_lineary(self):
 'toggle between log and linear on the y axis'
- funcy = self.transData.get_funcy().get_type()
- if funcy==mtrans.LOG10: self.set_yscale('linear')
- elif funcy==mtrans.IDENTITY: self.set_yscale('log')
+	# MGDTODO
+# funcy = self.transData.get_funcy().get_type()
+# if funcy==mtrans.LOG10: self.set_yscale('linear')
+# elif funcy==mtrans.IDENTITY: self.set_yscale('log')
+	pass
 
 def xaxis_date(self, tz=None):
 """Sets up x-axis ticks and labels that treat the x data as dates.
@@ -2172,7 +2175,7 @@
 %(Annotation)s
 """
 a = mtext.Annotation(*args, **kwargs)
- a.set_transform(mtrans.identity_transform())
+ a.set_transform(maffine.Affine2D.identity())
 self._set_artist_props(a)
 if kwargs.has_key('clip_on'): a.set_clip_box(self.bbox)
 self.texts.append(a)
@@ -2211,7 +2214,7 @@
 %(Line2D)s
 """
 
- trans = mtrans.blend_xy_sep_transform( self.transAxes, self.transData)
+ trans = maffine.blend_xy_sep_transform( self.transAxes, self.transData)
 l, = self.plot([xmin,xmax], [y,y], transform=trans, scalex=False, **kwargs)
 return l
 
@@ -2247,7 +2250,7 @@
 %(Line2D)s
 """
 
- trans = mtrans.blend_xy_sep_transform( self.transData, self.transAxes )
+ trans = maffine.blend_xy_sep_transform( self.transData, self.transAxes )
 l, = self.plot([x,x], [ymin,ymax] , transform=trans, scaley=False, **kwargs)
 return l
 
@@ -2286,7 +2289,7 @@
 %(Polygon)s
 """
 # convert y axis units
- trans = mtrans.blend_xy_sep_transform( self.transAxes, self.transData)
+ trans = maffine.blend_xy_sep_transform( self.transAxes, self.transData)
 verts = (xmin, ymin), (xmin, ymax), (xmax, ymax), (xmax, ymin)
 p = mpatches.Polygon(verts, **kwargs)
 p.set_transform(trans)
@@ -2326,7 +2329,7 @@
 %(Polygon)s
 """
 # convert x axis units
- trans = mtrans.blend_xy_sep_transform(self.transData, self.transAxes)
+ trans = maffine.blend_xy_sep_transform(self.transData, self.transAxes)
 verts = [(xmin, ymin), (xmin, ymax), (xmax, ymax), (xmax, ymin)]
 p = mpatches.Polygon(verts, **kwargs)
 p.set_transform(trans)
@@ -4105,7 +4108,7 @@
 offsets = zip(x,y),
 transOffset = self.transData,
 )
- collection.set_transform(mtrans.identity_transform())
+ collection.set_transform(maffine.Affine2D())
 collection.set_alpha(alpha)
 collection.update(kwargs)
 
@@ -5299,21 +5302,22 @@
 
 # the lim are theta, r
 
- Bbox = mtrans.Bbox
- Value = mtrans.Value
- Point = mtrans.Point
- self.dataLim = Bbox( Point( Value(5/4.*math.pi), Value(math.sqrt(2))),
- Point( Value(1/4.*math.pi), Value(math.sqrt(2))))
- self.viewLim = Bbox( Point( Value(5/4.*math.pi), Value(math.sqrt(2))),
- Point( Value(1/4.*math.pi), Value(math.sqrt(2))))
+	# MGDTODO
+# Bbox = mtrans.Bbox
+# Value = mtrans.Value
+# Point = mtrans.Point
+# self.dataLim = Bbox( Point( Value(5/4.*math.pi), Value(math.sqrt(2))),
+# Point( Value(1/4.*math.pi), Value(math.sqrt(2))))
+# self.viewLim = Bbox( Point( Value(5/4.*math.pi), Value(math.sqrt(2))),
+# Point( Value(1/4.*math.pi), Value(math.sqrt(2))))
 
- self.transData = mtrans.NonseparableTransformation(
- self.viewLim, self.bbox,
- mtrans.FuncXY(mtrans.POLAR))
- self.transAxes = mtrans.get_bbox_transform(
- mtrans.unit_bbox(), self.bbox)
+# self.transData = mtrans.NonseparableTransformation(
+# self.viewLim, self.bbox,
+# mtrans.FuncXY(mtrans.POLAR))
+# self.transAxes = mtrans.get_bbox_transform(
+# mtrans.unit_bbox(), self.bbox)
+	pass
 
-
 def contains(self,mouseevent):
 """Test whether the mouse event occured in the axes.
 
@@ -5380,6 +5384,7 @@
 
 # we need to set a view and data interval from 0->rmax to make
 # the formatter and locator work correctly
+	# MGDTODO
 Value = mtrans.Value
 Interval = mtrans.Interval
 self.rintv = Interval(Value(0), Value(1))
Modified: branches/transforms/lib/matplotlib/axis.py
===================================================================
--- branches/transforms/lib/matplotlib/axis.py	2007年09月10日 06:55:10 UTC (rev 3821)
+++ branches/transforms/lib/matplotlib/axis.py	2007年09月10日 17:39:37 UTC (rev 3822)
@@ -15,8 +15,8 @@
 from ticker import NullFormatter, FixedFormatter, ScalarFormatter, LogFormatter
 from ticker import NullLocator, FixedLocator, LinearLocator, LogLocator, AutoLocator
 
-from transforms import Value, blend_xy_sep_transform,\
- translation_transform, bbox_all, identity_transform
+from affine import Affine2D, blend_xy_sep_transform
+from bbox import bbox_union
 from font_manager import FontProperties
 from text import Text, TextWithDash, _process_text_args
 from patches import bbox_artist
@@ -81,16 +81,16 @@
 if self._tickdir == 'in':
 self._xtickmarkers = (TICKUP, TICKDOWN)
 self._ytickmarkers = (TICKRIGHT, TICKLEFT)
- self._pad = Value(pad)
+ self._pad = pad
 else:
 self._xtickmarkers = (TICKDOWN, TICKUP)
 self._ytickmarkers = (TICKLEFT, TICKRIGHT)
- self._pad = Value(pad + size)
+ self._pad = pad + size
 
 self._loc = loc
 self._size = size
 
- self._padPixels = self.figure.dpi*self._pad*Value(1/72.0)
+ self._padPixels = self.figure.dpi * self._pad * (1/72.0)
 
 
 self.tick1line = self._get_tick1line(loc)
@@ -236,14 +236,11 @@
 xaxis=True,
 )
 
-
- trans = blend_xy_sep_transform( self.axes.transData,
- self.axes.transAxes)
+	trans = blend_xy_sep_transform(
+	 self.axes.transData, self.axes.transAxes)
 #offset the text downward with a post transformation
- transOffset = translation_transform(
- Value(0), Value(-1)*self._padPixels)
- trans.set_offset( (0,0), transOffset)
- t.set_transform( trans)
+	trans = trans + Affine2D().translated(0, -1 * self._padPixels)
+ t.set_transform(trans)
 
 self._set_artist_props(t)
 return t
@@ -264,12 +261,10 @@
 horizontalalignment='center',
 )
 
- trans = blend_xy_sep_transform( self.axes.transData,
- self.axes.transAxes)
+	trans = blend_xy_sep_transformation(
+	 self.axes.transData, self.axes.transAxes)
 # offset the text upward with a post transformation
- transOffset = translation_transform(
- Value(0), self._padPixels)
- trans.set_offset( (0,0), transOffset)
+ trans = trans + Affine2D().translated(0, self._padPixels)
 t.set_transform( trans )
 self._set_artist_props(t)
 return t
@@ -284,8 +279,8 @@
 marker = self._xtickmarkers[0],
 markersize=self._size,
 )
- l.set_transform( blend_xy_sep_transform( self.axes.transData,
- self.axes.transAxes) )
+ l.set_transform(blend_xy_sep_transform(
+		self.axes.transData, self.axes.transAxes) )
 self._set_artist_props(l)
 return l
 
@@ -300,8 +295,8 @@
 markersize=self._size,
 )
 
- l.set_transform( blend_xy_sep_transform( self.axes.transData,
- self.axes.transAxes) )
+ l.set_transform(blend_xy_sep_transform(
+		self.axes.transData, self.axes.transAxes) )
 self._set_artist_props(l)
 return l
 
@@ -314,8 +309,9 @@
 linewidth=rcParams['grid.linewidth'],
 antialiased=False,
 )
- l.set_transform( blend_xy_sep_transform( self.axes.transData,
- self.axes.transAxes) )
+ l.set_transform(
+	 blend_xy_sep_transform(
+		self.axes.transData, self.axes.transAxes))
 l.set_clip_box(self.axes.bbox)
 self._set_artist_props(l)
 
@@ -363,13 +359,11 @@
 dashdirection=0,
 xaxis=False,
 )
- trans = blend_xy_sep_transform( self.axes.transAxes,
- self.axes.transData)
+ trans = blend_xy_sep_transform(
+	 self.axes.transAxes, self.axes.transData)
 # offset the text leftward with a post transformation
+	trans = trans + Affine2D().translated(-1 * self._padPixels, 0)
 
- transOffset = translation_transform(
- Value(-1)*self._padPixels, Value(0))
- trans.set_offset( (0,0), transOffset)
 t.set_transform( trans )
 #t.set_transform( self.axes.transData )
 self._set_artist_props(t)
@@ -388,13 +382,10 @@
 xaxis=False,
 horizontalalignment='left',
 )
- trans = blend_xy_sep_transform( self.axes.transAxes,
- self.axes.transData)
+ trans = blend_xy_sep_transform(
+	 self.axes.transAxes, self.axes.transData)
 # offset the text rightward with a post transformation
-
- transOffset = translation_transform(
- self._padPixels, Value(0))
- trans.set_offset( (0,0), transOffset)
+	trans = trans + Affine2D().translated(self._padPixels, 0)
 t.set_transform( trans )
 self._set_artist_props(t)
 return t
@@ -409,8 +400,9 @@
 linestyle = 'None',
 markersize=self._size,
 )
- l.set_transform( blend_xy_sep_transform( self.axes.transAxes,
- self.axes.transData) )
+ l.set_transform(
+	 blend_xy_sep_transform(
+		self.axes.transAxes, self.axes.transData))
 self._set_artist_props(l)
 return l
 
@@ -424,8 +416,9 @@
 markersize=self._size,
 )
 
- l.set_transform( blend_xy_sep_transform( self.axes.transAxes,
- self.axes.transData) )
+ l.set_transform(
+	 blend_xy_sep_transform(
+		self.axes.transAxes, self.axes.transData))
 self._set_artist_props(l)
 return l
 
@@ -439,8 +432,8 @@
 antialiased=False,
 )
 
- l.set_transform( blend_xy_sep_transform( self.axes.transAxes,
- self.axes.transData) )
+ l.set_transform( blend_xy_sep_transform(
+		self.axes.transAxes, self.axes.transData) )
 l.set_clip_box(self.axes.bbox)
 
 self._set_artist_props(l)
@@ -989,8 +982,8 @@
 verticalalignment='top',
 horizontalalignment='center',
 )
- label.set_transform( blend_xy_sep_transform( self.axes.transAxes,
- identity_transform() ))
+ label.set_transform( blend_xy_sep_transform(
+		self.axes.transAxes, Affine2D() ))
 
 self._set_artist_props(label)
 self.label_position='bottom'
@@ -1004,8 +997,8 @@
 verticalalignment='top',
 horizontalalignment='right',
 )
- offsetText.set_transform( blend_xy_sep_transform( self.axes.transAxes,
- identity_transform() ))
+ offsetText.set_transform( blend_xy_sep_transform(
+		self.axes.transAxes, Affine2D() ))
 self._set_artist_props(offsetText)
 self.offset_text_position='bottom'
 return offsetText
@@ -1041,7 +1034,7 @@
 bottom = self.axes.bbox.ymin()
 else:
 
- bbox = bbox_all(bboxes)
+ bbox = bbox_union(bboxes)
 bottom = bbox.ymin()
 
 self.label.set_position( (x, bottom-self.LABELPAD*self.figure.dpi.get()/72.0))
@@ -1051,7 +1044,7 @@
 top = self.axes.bbox.ymax()
 else:
 
- bbox = bbox_all(bboxes2)
+ bbox = bbox_union(bboxes2)
 top = bbox.ymax()
 
 self.label.set_position( (x, top+self.LABELPAD*self.figure.dpi.get()/72.0))
@@ -1065,7 +1058,7 @@
 if not len(bboxes):
 bottom = self.axes.bbox.ymin()
 else:
- bbox = bbox_all(bboxes)
+ bbox = bbox_union(bboxes)
 bottom = bbox.ymin()
 self.offsetText.set_position((x, bottom-self.OFFSETTEXTPAD*self.figure.dpi.get()/72.0))
 
@@ -1179,8 +1172,8 @@
 horizontalalignment='right',
 rotation='vertical',
 )
- label.set_transform( blend_xy_sep_transform( identity_transform(),
- self.axes.transAxes) )
+ label.set_transform( blend_xy_sep_transform(
+		Affine2D(), self.axes.transAxes) )
 
 self._set_artist_props(label)
 self.label_position='left'
@@ -1194,8 +1187,8 @@
 verticalalignment = 'bottom',
 horizontalalignment = 'left',
 )
- offsetText.set_transform(blend_xy_sep_transform(self.axes.transAxes,
- identity_transform()) )
+ offsetText.set_transform(blend_xy_sep_transform(
+		self.axes.transAxes, Affine2D()) )
 self._set_artist_props(offsetText)
 self.offset_text_position='left'
 return offsetText
@@ -1231,7 +1224,7 @@
 left = self.axes.bbox.xmin()
 else:
 
- bbox = bbox_all(bboxes)
+ bbox = bbox_union(bboxes)
 left = bbox.xmin()
 
 self.label.set_position( (left-self.LABELPAD*self.figure.dpi.get()/72.0, y))
@@ -1241,7 +1234,7 @@
 right = self.axes.bbox.xmax()
 else:
 
- bbox = bbox_all(bboxes2)
+ bbox = bbox_union(bboxes2)
 right = bbox.xmax()
 
 self.label.set_position( (right+self.LABELPAD*self.figure.dpi.get()/72.0, y))
Modified: branches/transforms/lib/matplotlib/backends/backend_agg.py
===================================================================
--- branches/transforms/lib/matplotlib/backends/backend_agg.py	2007年09月10日 06:55:10 UTC (rev 3821)
+++ branches/transforms/lib/matplotlib/backends/backend_agg.py	2007年09月10日 17:39:37 UTC (rev 3822)
@@ -84,7 +84,7 @@
 from matplotlib.font_manager import findfont
 from matplotlib.ft2font import FT2Font, LOAD_DEFAULT
 from matplotlib.mathtext import MathTextParser
-from matplotlib.transforms import lbwh_to_bbox
+from matplotlib.bbox import Bbox
 
 from _backend_agg import RendererAgg as _RendererAgg
 
@@ -126,7 +126,7 @@
 self.mathtext_parser = MathTextParser('Agg')
 self._fontd = {}
 
- self.bbox = lbwh_to_bbox(0,0, self.width, self.height)
+ self.bbox = Bbox.from_lbwh(0,0, self.width, self.height)
 if __debug__: verbose.report('RendererAgg.__init__ done',
 'debug-annoying')
 
@@ -277,7 +277,7 @@
 
 cliprect = gc.get_clip_rectangle()
 if cliprect is None: bbox = None
- else: bbox = lbwh_to_bbox(*cliprect)
+ else: bbox = Bbox.from_lbwh(*cliprect)
 self.draw_image(x, self.height-y, im, bbox)
 
 def get_canvas_width_height(self):
Modified: branches/transforms/lib/matplotlib/figure.py
===================================================================
--- branches/transforms/lib/matplotlib/figure.py	2007年09月10日 06:55:10 UTC (rev 3821)
+++ branches/transforms/lib/matplotlib/figure.py	2007年09月10日 17:39:37 UTC (rev 3822)
@@ -18,7 +18,8 @@
 from text import Text, _process_text_args
 
 from legend import Legend
-from transforms import Bbox, Value, Point, get_bbox_transform, unit_bbox
+from affine import get_bbox_transform
+from bbox import Bbox
 from ticker import FormatStrFormatter
 from cm import ScalarMappable
 from contour import ContourSet
@@ -127,17 +128,14 @@
 if facecolor is None: facecolor = rcParams['figure.facecolor']
 if edgecolor is None: edgecolor = rcParams['figure.edgecolor']
 
- self.dpi = Value(dpi)
- self.figwidth = Value(figsize[0])
- self.figheight = Value(figsize[1])
- self.ll = Point( Value(0), Value(0) )
- self.ur = Point( self.figwidth*self.dpi,
- self.figheight*self.dpi )
- self.bbox = Bbox(self.ll, self.ur)
-
+ self.dpi = dpi
+	self.bbox = Bbox.from_lbwh(0, 0,
+				 self.figsize[0] * dpi,
+				 self.figsize[1] * dpi)
+	
 self.frameon = frameon
 
- self.transFigure = get_bbox_transform( unit_bbox(), self.bbox)
+ self.transFigure = get_bbox_transform( Bbox.unit(), self.bbox)
 
 
 
Modified: branches/transforms/lib/matplotlib/legend.py
===================================================================
--- branches/transforms/lib/matplotlib/legend.py	2007年09月10日 06:55:10 UTC (rev 3821)
+++ branches/transforms/lib/matplotlib/legend.py	2007年09月10日 17:39:37 UTC (rev 3822)
@@ -34,12 +34,9 @@
 from patches import Patch, Rectangle, RegularPolygon, Shadow, bbox_artist, draw_bbox
 from collections import LineCollection, RegularPolyCollection, PatchCollection
 from text import Text
-from transforms import Bbox, Point, Value, get_bbox_transform, bbox_all,\
- unit_bbox, inverse_transform_bbox, lbwh_to_bbox
+from affine import get_bbox_transform
+from bbox import Bbox, bbox_union
 
-
-
-
 def line_cuts_bbox(line, bbox):
 """ Return True if and only if line cuts bbox. """
 minx, miny, width, height = bbox.get_bounds()
@@ -168,7 +165,7 @@
 else:
 raise TypeError("Legend needs either Axes or Figure as parent")
 self.parent = parent
- self.set_transform( get_bbox_transform( unit_bbox(), parent.bbox) )
+ self.set_transform( get_bbox_transform( Bbox.unit(), parent.bbox) )
 
 if loc is None:
 loc = rcParams["legend.loc"]
@@ -263,10 +260,10 @@
 
 bboxesAll = bboxesText
 bboxesAll.extend(bboxesHandles)
- bbox = bbox_all(bboxesAll)
+ bbox = bbox_union(bboxesAll)
 self.save = bbox
 
- ibox = inverse_transform_bbox(self.get_transform(), bbox)
+ ibox = bbox.inverse_transform(self.get_transform())
 self.ibox = ibox
 
 return ibox
@@ -468,7 +465,7 @@
 
 candidates = []
 for l, b in consider:
- legendBox = lbwh_to_bbox(l, b, width, height)
+ legendBox = Bbox.from_lbwh(l, b, width, height)
 badness = 0
 badness = legendBox.count_contains(verts)
 ox, oy = l-tx, b-ty
Modified: branches/transforms/lib/matplotlib/lines.py
===================================================================
--- branches/transforms/lib/matplotlib/lines.py	2007年09月10日 06:55:10 UTC (rev 3821)
+++ branches/transforms/lib/matplotlib/lines.py	2007年09月10日 17:39:37 UTC (rev 3822)
@@ -18,7 +18,7 @@
 from cbook import iterable, is_string_like, is_numlike
 from colors import colorConverter
 
-from transforms import lbwh_to_bbox, LOG10
+from bbox import lbwh_to_bbox
 from matplotlib import rcParams
 
 # special-purpose marker identifiers:
@@ -378,7 +378,7 @@
 bottom -= ms/2
 width += ms
 height += ms
- return lbwh_to_bbox( left, bottom, width, height)
+ return lbwh_to_bbox(left, bottom, width, height)
 
 
 def set_axes(self, ax):
@@ -447,13 +447,15 @@
 
 x, y = self._x, self._y
 
- try: logx = self.get_transform().get_funcx().get_type()==LOG10
- except RuntimeError: logx = False # non-separable
+	# MGDTODO: Deal with the log scale here
+	
+# try: logx = self.get_transform().get_funcx().get_type()==LOG10
+# except RuntimeError: logx = False # non-separable
 
- try: logy = self.get_transform().get_funcy().get_type()==LOG10
- except RuntimeError: logy = False # non-separable
+# try: logy = self.get_transform().get_funcy().get_type()==LOG10
+# except RuntimeError: logy = False # non-separable
 
- if not logx and not logy:
+ if True:
 return x, y
 
 if self._logcache is not None:
Modified: branches/transforms/lib/matplotlib/pylab.py
===================================================================
--- branches/transforms/lib/matplotlib/pylab.py	2007年09月10日 06:55:10 UTC (rev 3821)
+++ branches/transforms/lib/matplotlib/pylab.py	2007年09月10日 17:39:37 UTC (rev 3822)
@@ -234,7 +234,6 @@
 from lines import Line2D
 from text import Text, Annotation
 from patches import Polygon, Rectangle, Circle, Arrow
-from transforms import blend_xy_sep_transform
 from widgets import SubplotTool, Button, Slider, Widget
 
 import numerix as nx
Modified: branches/transforms/lib/matplotlib/table.py
===================================================================
--- branches/transforms/lib/matplotlib/table.py	2007年09月10日 06:55:10 UTC (rev 3821)
+++ branches/transforms/lib/matplotlib/table.py	2007年09月10日 17:39:37 UTC (rev 3822)
@@ -29,12 +29,10 @@
 from patches import Rectangle
 from cbook import enumerate, is_string_like, flatten
 from text import Text
-from transforms import Bbox, inverse_transform_bbox, bbox_all, unit_bbox, \
- get_bbox_transform
+from bbox import Bbox, bbox_union
 
 
 
-
 class Cell(Rectangle):
 """
 A cell is a Rectangle with some associated text.
@@ -132,7 +130,7 @@
 def get_text_bounds(self, renderer):
 """ Get text bounds in axes co-ordinates. """
 bbox = self._text.get_window_extent(renderer)
- bboxa = inverse_transform_bbox(self.get_transform(), bbox)
+	bbox.inverse_transform(self.get_transform())
 return bboxa.get_bounds()
 
 def get_required_width(self, renderer):
Modified: branches/transforms/lib/matplotlib/text.py
===================================================================
--- branches/transforms/lib/matplotlib/text.py	2007年09月10日 06:55:10 UTC (rev 3821)
+++ branches/transforms/lib/matplotlib/text.py	2007年09月10日 17:39:37 UTC (rev 3822)
@@ -15,7 +15,7 @@
 from cbook import enumerate, is_string_like, maxdict, is_numlike
 from font_manager import FontProperties
 from patches import bbox_artist, YAArrow
-from transforms import lbwh_to_bbox, bbox_all, identity_transform
+from bbox import lbwh_to_bbox, bbox_union
 from lines import Line2D
 
 import matplotlib.nxutils as nxutils
Modified: branches/transforms/lib/matplotlib/transforms.py
===================================================================
--- branches/transforms/lib/matplotlib/transforms.py	2007年09月10日 06:55:10 UTC (rev 3821)
+++ branches/transforms/lib/matplotlib/transforms.py	2007年09月10日 17:39:37 UTC (rev 3822)
@@ -1,652 +1,652 @@
-"""
-The transforms module is broken into two parts, a collection of
-classes written in the extension module _transforms to handle
-efficient transformation of data, and some helper functions in
-transforms to make it easy to instantiate and use those objects.
-Hence the core of this module lives in _transforms.
+# """
+# The transforms module is broken into two parts, a collection of
+# classes written in the extension module _transforms to handle
+# efficient transformation of data, and some helper functions in
+# transforms to make it easy to instantiate and use those objects.
+# Hence the core of this module lives in _transforms.
 
-The transforms class is built around the idea of a LazyValue. A
-LazyValue is a base class that defines a method get that returns the
-value. The concrete derived class Value wraps a float, and simply
-returns the value of that float. The concrete derived class BinOp
-allows binary operations on LazyValues, so you can add them, multiply
-them, etc. When you do something like
+# The transforms class is built around the idea of a LazyValue. A
+# LazyValue is a base class that defines a method get that returns the
+# value. The concrete derived class Value wraps a float, and simply
+# returns the value of that float. The concrete derived class BinOp
+# allows binary operations on LazyValues, so you can add them, multiply
+# them, etc. When you do something like
 
- inches = Value(8)
- dpi = Value(72)
- width = inches * dpi
+# inches = Value(8)
+# dpi = Value(72)
+# width = inches * dpi
 
-width is a BinOp instance (that tells you the width of the figure in
-pixels). Later, if the figure size in changed, ie we call
+# width is a BinOp instance (that tells you the width of the figure in
+# pixels). Later, if the figure size in changed, ie we call
 
- inches.set(10)
+# inches.set(10)
 
-The width variable is automatically updated because it stores a
-pointer to the inches variable, not the value. Since a BinOp is also
-a lazy value, you can define binary operations on BinOps as well, such
-as
+# The width variable is automatically updated because it stores a
+# pointer to the inches variable, not the value. Since a BinOp is also
+# a lazy value, you can define binary operations on BinOps as well, such
+# as
 
- middle = Value(0.5) * width
+# middle = Value(0.5) * width
 
-Pairs of LazyValue instances can occur as instances of two classes:
+# Pairs of LazyValue instances can occur as instances of two classes:
 
- pt = Point( Value(x), Value(y)) # where x, y are numbers
- pt.x(), pt.y() return Value(x), Value(y))
+# pt = Point( Value(x), Value(y)) # where x, y are numbers
+# pt.x(), pt.y() return Value(x), Value(y))
 
- iv = Interval( Value(x), Value(y))
- iv.contains(z) returns True if z is in the closed interval
- iv.contains_open(z): same for open interval
- iv.span() returns y-x as a float
- iv.get_bounds() returns (x,y) as a tuple of floats
- iv.set_bounds(x, y) allows input of new floats
- iv.update(seq) updates the bounds to include all elements
- in a sequence of floats
- iv.shift(s) shifts the interval by s, a float
+# iv = Interval( Value(x), Value(y))
+# iv.contains(z) returns True if z is in the closed interval
+# iv.contains_open(z): same for open interval
+# iv.span() returns y-x as a float
+# iv.get_bounds() returns (x,y) as a tuple of floats
+# iv.set_bounds(x, y) allows input of new floats
+# iv.update(seq) updates the bounds to include all elements
+# in a sequence of floats
+# iv.shift(s) shifts the interval by s, a float
 
-The bounding box class Bbox is also heavily used, and is defined by a
-lower left point ll and an upper right point ur. The points ll and ur
-are given by Point(x, y) instances, where x and y are LazyValues. So
-you can represent a point such as
+# The bounding box class Bbox is also heavily used, and is defined by a
+# lower left point ll and an upper right point ur. The points ll and ur
+# are given by Point(x, y) instances, where x and y are LazyValues. So
+# you can represent a point such as
 
- ll = Point( Value(0), Value(0) ) # the origin
- ur = Point( width, height ) # the upper right of the figure
+# ll = Point( Value(0), Value(0) ) # the origin
+# ur = Point( width, height ) # the upper right of the figure
 
-where width and height are defined as above, using the product of the
-figure width in inches and the dpi. This is, in face, how the Figure
-bbox is defined
+# where width and height are defined as above, using the product of the
+# figure width in inches and the dpi. This is, in face, how the Figure
+# bbox is defined
 
- bbox = Bbox(ll, ur)
+# bbox = Bbox(ll, ur)
 
-A bbox basically defines an x,y coordinate system, with ll giving the
-lower left of the coordinate system and ur giving the upper right.
+# A bbox basically defines an x,y coordinate system, with ll giving the
+# lower left of the coordinate system and ur giving the upper right.
 
-The bbox methods are
+# The bbox methods are
 
- ll() - return the lower left Point
- ur() - return the upper right Point
- contains(x,y) - return True if self contains point
- overlaps(bbox) - return True if self overlaps bbox
- overlapsx(bbox) - return True if self overlaps bbox in the x interval
- overlapsy(bbox) - return True if self overlaps bbox in the y interval
- intervalx() - return the x Interval instance
- intervaly() - return the y interval instance
- get_bounds() - get the left, bottom, width, height bounding tuple
- update(xys, ignore) - update the bbox to bound all the xy tuples in
- xys; if ignore is true ignore the current contents of bbox and
- just bound the tuples. If ignore is false, bound self + tuples
- width() - return the width of the bbox
- height() - return the height of the bbox
- xmax() - return the x coord of upper right
- ymax() - return the y coord of upper right
- xmin() - return the x coord of lower left
- ymin() - return the y coord of lower left
- scale(sx,sy) - scale the bbox by sx, sy
- deepcopy() - return a deep copy of self (pointers are lost)
+# ll() - return the lower left Point
+# ur() - return the upper right Point
+# contains(x,y) - return True if self contains point
+# overlaps(bbox) - return True if self overlaps bbox
+# overlapsx(bbox) - return True if self overlaps bbox in the x interval
+# overlapsy(bbox) - return True if self overlaps bbox in the y interval
+# intervalx() - return the x Interval instance
+# intervaly() - return the y interval instance
+# get_bounds() - get the left, bottom, width, height bounding tuple
+# update(xys, ignore) - update the bbox to bound all the xy tuples in
+# xys; if ignore is true ignore the current contents of bbox and
+# just bound the tuples. If ignore is false, bound self + tuples
+# width() - return the width of the bbox
+# height() - return the height of the bbox
+# xmax() - return the x coord of upper right
+# ymax() - return the y coord of upper right
+# xmin() - return the x coord of lower left
+# ymin() - return the y coord of lower left
+# scale(sx,sy) - scale the bbox by sx, sy
+# deepcopy() - return a deep copy of self (pointers are lost)
 
 
-The basic transformation maps one bbox to another, with an optional
-nonlinear transformation of one of coordinates (eg log scaling).
+# The basic transformation maps one bbox to another, with an optional
+# nonlinear transformation of one of coordinates (eg log scaling).
 
-The base class for transformations is Transformation, and the concrete
-derived classes are SeparableTransformation and Affine. Earlier
-versions of matplotlib handled transformation of x and y separately
-(ie we assumed all transformations were separable) but this makes it
-difficult to do rotations or polar transformations, for example. All
-artists contain their own transformation, defaulting to the identity
-transform.
+# The base class for transformations is Transformation, and the concrete
+# derived classes are SeparableTransformation and Affine. Earlier
+# versions of matplotlib handled transformation of x and y separately
+# (ie we assumed all transformations were separable) but this makes it
+# difficult to do rotations or polar transformations, for example. All
+# artists contain their own transformation, defaulting to the identity
+# transform.
 
-The signature of a separable transformation instance is
+# The signature of a separable transformation instance is
 
- trans = SeparableTransformation(bbox1, bbox2, funcx, funcy)
+# trans = SeparableTransformation(bbox1, bbox2, funcx, funcy)
 
-where funcx and funcy operate on x and y. The typical linear
-coordinate transformation maps one bounding box to another, with funcx
-and funcy both identity. Eg,
+# where funcx and funcy operate on x and y. The typical linear
+# coordinate transformation maps one bounding box to another, with funcx
+# and funcy both identity. Eg,
 
- transData = Transformation(viewLim, displayLim,
- Func(IDENTITY), Func(IDENTITY))
+# transData = Transformation(viewLim, displayLim,
+# Func(IDENTITY), Func(IDENTITY))
 
-maps the axes view limits to display limits. If the xaxis scaling is
-changed to log, one simply calls
+# maps the axes view limits to display limits. If the xaxis scaling is
+# changed to log, one simply calls
 
- transData.get_funcx().set_type(LOG10)
+# transData.get_funcx().set_type(LOG10)
 
-For more general transformations including rotation, the Affine class
-is provided, which is constructed with 6 LazyValue instances:
-a, b, c, d, tx, ty. These give the values of the matrix transformation
+# For more general transformations including rotation, the Affine class
+# is provided, which is constructed with 6 LazyValue instances:
+# a, b, c, d, tx, ty. These give the values of the matrix transformation
 
- [xo = |a c| [xi + [tx
- yo] |b d| yi] ty]
+# [xo = |a c| [xi + [tx
+# yo] |b d| yi] ty]
 
-where if sx, sy are the scaling components, tx, y are the translation
-components, and alpha is the rotation
+# where if sx, sy are the scaling components, tx, y are the translation
+# components, and alpha is the rotation
 
- a = sx*cos(alpha);
- b = -sx*sin(alpha);
- c = sy*sin(alpha);
- d = sy*cos(alpha);
+# a = sx*cos(alpha);
+# b = -sx*sin(alpha);
+# c = sy*sin(alpha);
+# d = sy*cos(alpha);
 
-The affine transformation can be accomplished for row vectors with a
-single matrix multiplication
- X_new = X_old * M
-where
- M = [ a b 0
- c d 0
- tx ty 1]
-and each X is the row vector [x, y, 1]. Hence M is
-the transpose of the matrix representation given in
-http://en.wikipedia.org/wiki/Affine_transformation,
-which is for the more usual column-vector representation
-of the position.)
+# The affine transformation can be accomplished for row vectors with a
+# single matrix multiplication
+# X_new = X_old * M
+# where
+# M = [ a b 0
+# c d 0
+# tx ty 1]
+# and each X is the row vector [x, y, 1]. Hence M is
+# the transpose of the matrix representation given in
+# http://en.wikipedia.org/wiki/Affine_transformation,
+# which is for the more usual column-vector representation
+# of the position.)
 
 
 
-From a user perspective, the most important Tranformation methods are
+# From a user perspective, the most important Tranformation methods are
 
-All transformations
--------------------
- freeze() - eval and freeze the lazy objects
- thaw() - release the lazy objects
+# All transformations
+# -------------------
+# freeze() - eval and freeze the lazy objects
+# thaw() - release the lazy objects
 
- xy_tup(xy) - transform the tuple (x,y)
- seq_x_y(x, y) - transform the python sequences x and y
- numerix_x_y(x, y) - x and y are numerix 1D arrays
- numerix_xy(xy) - xy is a numerix array of shape (N,2)
- inverse_numerix_xy(xy)- inverse of the above
- seq_xy_tups(seq) - seq is a sequence of xy tuples or a (N,2) array
- inverse_xy_tup(xy) - apply the inverse transformation to tuple xy
+# xy_tup(xy) - transform the tuple (x,y)
+# seq_x_y(x, y) - transform the python sequences x and y
+# numerix_x_y(x, y) - x and y are numerix 1D arrays
+# numerix_xy(xy) - xy is a numerix array of shape (N,2)
+# inverse_numerix_xy(xy)- inverse of the above
+# seq_xy_tups(seq) - seq is a sequence of xy tuples or a (N,2) array
+# inverse_xy_tup(xy) - apply the inverse transformation to tuple xy
 
- set_offset(xy, trans) - xy is an x,y tuple and trans is a
- Transformation instance. This will apply a post transformational
- offset of all future transformations by xt,yt = trans.xy_tup(xy[0], xy[1])
+# set_offset(xy, trans) - xy is an x,y tuple and trans is a
+# Transformation instance. This will apply a post transformational
+# offset of all future transformations by xt,yt = trans.xy_tup(xy[0], xy[1])
 
- deepcopy() - returns a deep copy; references are lost
- shallowcopy() - returns a shallow copy excluding the offset
+# deepcopy() - returns a deep copy; references are lost
+# shallowcopy() - returns a shallow copy excluding the offset
 
-Separable transformations
--------------------------
+# Separable transformations
+# -------------------------
 
- get_bbox1() - return the input bbox
- get_bbox2() - return the output bbox
- set_bbox1() - set the input bbox
- set_bbox2() - set the output bbox
- get_funcx() - return the Func instance on x
- get_funcy() - return the Func instance on y
- set_funcx() - set the Func instance on x
- set_funcy() - set the Func instance on y
+# get_bbox1() - return the input bbox
+# get_bbox2() - return the output bbox
+# set_bbox1() - set the input bbox
+# set_bbox2() - set the output bbox
+# get_funcx() - return the Func instance on x
+# get_funcy() - return the Func instance on y
+# set_funcx() - set the Func instance on x
+# set_funcy() - set the Func instance on y
 
 
-Affine transformations
-----------------------
+# Affine transformations
+# ----------------------
 
- as_vec6() - return the affine as length 6 list of Values
+# as_vec6() - return the affine as length 6 list of Values
 
 
-In general, you shouldn't need to construct your own transformations,
-but should use the helper functions defined in this module.
+# In general, you shouldn't need to construct your own transformations,
+# but should use the helper functions defined in this module.
 
 
- zero - return Value(0)
- one - return Value(1)
- origin - return Point(zero(), zero())
- unit_bbox - return the 0,0 to 1,1 bounding box
- identity_affine - An affine identity transformation
- identity_transform - An identity separable transformation
- translation_transform - a pure translational affine
- scale_transform - a pure scale affine
- scale_sep_transform - a pure scale separable transformation
- scale_translation_transform - a scale and translate affine
- bound_vertices - return the bbox that bounds all the xy tuples
- bbox_all - return the bbox that bounds all the bboxes
- lbwh_to_bbox - build a bbox from tuple
- left, bottom, width, height tuple
+# zero - return Value(0)
+# one - return Value(1)
+# origin - return Point(zero(), zero())
+# unit_bbox - return the 0,0 to 1,1 bounding box
+# identity_affine - An affine identity transformation
+# identity_transform - An identity separable transformation
+# translation_transform - a pure translational affine
+# scale_transform - a pure scale affine
+# scale_sep_transform - a pure scale separable transformation
+# scale_translation_transform - a scale and translate affine
+# bound_vertices - return the bbox that bounds all the xy tuples
+# bbox_all - return the bbox that bounds all the bboxes
+# lbwh_to_bbox - build a bbox from tuple
+# left, bottom, width, height tuple
 
- multiply_affines - return the affine that is the matrix product of
- the two affines
+# multiply_affines - return the affine that is the matrix product of
+# the two affines
 
- get_bbox_transform - return a SeparableTransformation instance that
- transforms one bbox to another
+# get_bbox_transform - return a SeparableTransformation instance that
+# transforms one bbox to another
 
- blend_xy_sep_transform - mix the x and y components of two separable
- transformations into a new transformation.
- This allows you to specify x and y in
- different coordinate systems
+# blend_xy_sep_transform - mix the x and y components of two separable
+# transformations into a new transformation.
+# This allows you to specify x and y in
+# different coordinate systems
 
- transform_bbox - apply a transformation to a bbox and return the
- transformed bbox
+# transform_bbox - apply a transformation to a bbox and return the
+# transformed bbox
 
- inverse_transform_bbox - apply the inverse transformation of a bbox
- and return the inverse transformed bbox
+# inverse_transform_bbox - apply the inverse transformation of a bbox
+# and return the inverse transformed bbox
 
- offset_copy - make a copy with an offset
+# offset_copy - make a copy with an offset
 
 
-The units/transform_unit.py code has many examples.
+# The units/transform_unit.py code has many examples.
 
-A related and partly overlapping class, PBox, has been added to the
-original transforms module to facilitate Axes repositioning and resizing.
-At present, the differences between Bbox and PBox include:
+# A related and partly overlapping class, PBox, has been added to the
+# original transforms module to facilitate Axes repositioning and resizing.
+# At present, the differences between Bbox and PBox include:
 
- Bbox works with the bounding box, the coordinates of the lower-left
- and upper-right corners; PBox works with the lower-left coordinates
- and the width, height pair (left, bottom, width, height, or 'lbwh').
- Obviously, these are equivalent, but lbwh is what is used by
- Axes._position, and it is the natural specification for the types of
- manipulations for which the PBox class was made.
+# Bbox works with the bounding box, the coordinates of the lower-left
+# and upper-right corners; PBox works with the lower-left coordinates
+# and the width, height pair (left, bottom, width, height, or 'lbwh').
+# Obviously, these are equivalent, but lbwh is what is used by
+# Axes._position, and it is the natural specification for the types of
+# manipulations for which the PBox class was made.
 
- Bbox uses LazyValues grouped in pairs as 'll' and 'ur' Point objects;
- PBox uses a 4-element list, subclassed from the python list.
+# Bbox uses LazyValues grouped in pairs as 'll' and 'ur' Point objects;
+# PBox uses a 4-element list, subclassed from the python list.
 
- Bbox and PBox methods are mostly quite different, reflecting their
- different original purposes. Similarly, the CXX implementation of
- Bbox is good for methods such as update and for lazy evaluation, but
- for PBox intended uses, involving very little calculation, pure
- python probably is adequate.
+# Bbox and PBox methods are mostly quite different, reflecting their
+# different original purposes. Similarly, the CXX implementation of
+# Bbox is good for methods such as update and for lazy evaluation, but
+# for PBox intended uses, involving very little calculation, pure
+# python probably is adequate.
 
-In the future we may reimplement the PBox using Bbox
-and transforms, or eliminate it entirely by adding its methods
-and attributes to Bbox and/or putting them elsewhere in this module.
-"""
-from __future__ import division
-import math
-import numpy as npy
+# In the future we may reimplement the PBox using Bbox
+# and transforms, or eliminate it entirely by adding its methods
+# and attributes to Bbox and/or putting them elsewhere in this module.
+# """
+# from __future__ import division
+# import math
+# import numpy as npy
 
-from matplotlib._transforms import Value, Point, Interval, Bbox, Affine
-from matplotlib._transforms import IDENTITY, LOG10, POLAR, Func, FuncXY
-from matplotlib._transforms import SeparableTransformation
-from matplotlib._transforms import NonseparableTransformation
+# from matplotlib._transforms import Value, Point, Interval, Bbox, Affine
+# from matplotlib._transforms import IDENTITY, LOG10, POLAR, Func, FuncXY
+# from matplotlib._transforms import SeparableTransformation
+# from matplotlib._transforms import NonseparableTransformation
 
-def nonsingular(vmin, vmax, expander=0.001, tiny=1e-15, increasing=True):
- '''
- Ensure the endpoints of a range are not too close together.
+# def nonsingular(vmin, vmax, expander=0.001, tiny=1e-15, increasing=True):
+# '''
+# Ensure the endpoints of a range are not too close together.
 
- "too close" means the interval is smaller than 'tiny' times
- the maximum absolute value.
+# "too close" means the interval is smaller than 'tiny' times
+# the maximum absolute value.
 
- If they are too close, each will be moved by the 'expander'.
- If 'increasing' is True and vmin > vmax, they will be swapped,
- regardless of whether they are too close.
- '''
- swapped = False
- if vmax < vmin:
- vmin, vmax = vmax, vmin
- swapped = True
- if vmax - vmin <= max(abs(vmin), abs(vmax)) * tiny:
- if vmin==0.0:
- vmin = -expander
- vmax = expander
- else:
- vmin -= expander*abs(vmin)
- vmax += expander*abs(vmax)
- if swapped and not increasing:
- vmin, vmax = vmax, vmin
- return vmin, vmax
+# If they are too close, each will be moved by the 'expander'.
+# If 'increasing' is True and vmin > vmax, they will be swapped,
+# regardless of whether they are too close.
+# '''
+# swapped = False
+# if vmax < vmin:
+# vmin, vmax = vmax, vmin
+# swapped = True
+# if vmax - vmin <= max(abs(vmin), abs(vmax)) * tiny:
+# if vmin==0.0:
+# vmin = -expander
+# vmax = expander
+# else:
+# vmin -= expander*abs(vmin)
+# vmax += expander*abs(vmax)
+# if swapped and not increasing:
+# vmin, vmax = vmax, vmin
+# return vmin, vmax
 
 
-def zero(): return Value(0)
+# def zero(): return Value(0)
 
-def one() : return Value(1)
+# def one() : return Value(1)
 
-def origin():
- return Point( zero(), zero() )
+# def origin():
+# return Point( zero(), zero() )
 
-def unit_bbox():
- """
- Get a 0,0 -> 1,1 Bbox instance
- """
- return Bbox( origin(), Point( one(), one() ) )
+# def unit_bbox():
+# """
+# Get a 0,0 -> 1,1 Bbox instance
+# """
+# return Bbox( origin(), Point( one(), one() ) )
 
-def identity_affine():
- """
- Get an affine transformation that maps x,y -> x,y
- """
+# def identity_affine():
+# """
+# Get an affine transformation that maps x,y -> x,y
+# """
 
- return Affine(one(), zero(), zero(), one(), zero(), zero())
+# return Affine(one(), zero(), zero(), one(), zero(), zero())
 
-def identity_transform():
- """
- Get an affine transformation that maps x,y -> x,y
- """
- return SeparableTransformation(unit_bbox(), unit_bbox(),
- Func(IDENTITY),
- Func(IDENTITY))
+# def identity_transform():
+# """
+# Get an affine transformation that maps x,y -> x,y
+# """
+# return SeparableTransformation(unit_bbox(), unit_bbox(),
+# Func(IDENTITY),
+# Func(IDENTITY))
 
-def translation_transform(tx, ty):
- """
- return a pure tranlational transformation...
 
[truncated message content]
From: <ef...@us...> - 2007年09月10日 06:55:11
Revision: 3821
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3821&view=rev
Author: efiring
Date: 2007年09月09日 23:55:10 -0700 (2007年9月09日)
Log Message:
-----------
Removed obsolete and broken methods from Axes and PolarAxes
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py	2007年09月10日 01:42:39 UTC (rev 3820)
+++ trunk/matplotlib/lib/matplotlib/axes.py	2007年09月10日 06:55:10 UTC (rev 3821)
@@ -1864,31 +1864,6 @@
 c =mcolors.colorConverter.to_rgba(c)
 self._cursorProps = lw, c
 
-
- def panx(self, numsteps):
- 'Pan the x axis numsteps (plus pan right, minus pan left)'
- self.xaxis.pan(numsteps)
- xmin, xmax = self.viewLim.intervalx().get_bounds()
- self._send_xlim_event()
-
- def pany(self, numsteps):
- 'Pan the x axis numsteps (plus pan up, minus pan down)'
- self.yaxis.pan(numsteps)
- self._send_ylim_event()
-
- def zoomx(self, numsteps):
- 'Zoom in on the x xaxis numsteps (plus for zoom in, minus for zoom out)'
- self.xaxis.zoom(numsteps)
- xmin, xmax = self.viewLim.intervalx().get_bounds()
- self._send_xlim_event()
-
- def zoomy(self, numsteps):
- 'Zoom in on the x xaxis numsteps (plus for zoom in, minus for zoom out)'
- self.yaxis.zoom(numsteps)
- self._send_ylim_event()
-
-
-
 def connect(self, s, func):
 """
 Register observers to be notified when certain events occur. Register
@@ -1910,6 +1885,7 @@
 def disconnect(self, cid):
 'disconnect from the Axes event.'
 raise DeprecationWarning('use the callbacks CallbackRegistry instance instead')
+
 def get_children(self):
 'return a list of child artists'
 children = []
@@ -5678,38 +5654,14 @@
 'ylabel not implemented'
 raise NotImplementedError('ylabel not defined for polar axes (yet)')
 
+ def set_xlim(self, xmin=None, xmax=None, emit=True, **kwargs):
+ 'xlim not implemented'
+ raise NotImplementedError('xlim not meaningful for polar axes')
 
- def set_xlim(self, xmin=None, xmax=None, emit=True):
- """
- set the xlimits
- ACCEPTS: len(2) sequence of floats
- """
- if xmax is None and iterable(xmin):
- xmin,xmax = xmin
+ def set_ylim(self, ymin=None, ymax=None, emit=True, **kwargs):
+ 'ylim not implemented'
+ raise NotImplementedError('ylim not meaningful for polar axes')
 
- old_xmin,old_xmax = self.get_xlim()
- if xmin is None: xmin = old_xmin
- if xmax is None: xmax = old_xmax
-
- self.viewLim.intervalx().set_bounds(xmin, xmax)
- if emit: self._send_xlim_event()
-
-
- def set_ylim(self, ymin=None, ymax=None, emit=True):
- """
- set the ylimits
- ACCEPTS: len(2) sequence of floats
- """
- if ymax is None and iterable(ymin):
- ymin,ymax = ymin
-
- old_ymin,old_ymax = self.get_ylim()
- if ymin is None: ymin = old_ymin
- if ymax is None: ymax = old_ymax
-
- self.viewLim.intervaly().set_bounds(ymin, ymax)
- if emit: self._send_ylim_event()
-
 def get_xscale(self):
 'return the xaxis scale string'
 return 'polar'
@@ -5760,10 +5712,9 @@
 """
 # 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 ke
-eping this around as an example for
+# cleaner way to do it, but am keeping 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
+# like this a method one day, or better yet make get_verts an Artist
 # method
 
 minx, maxx = self.get_xlim()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2007年09月10日 01:42:43
Revision: 3820
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3820&view=rev
Author: efiring
Date: 2007年09月09日 18:42:39 -0700 (2007年9月09日)
Log Message:
-----------
Numpification and cleanup of examples
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/examples/animation_blit.py
 trunk/matplotlib/examples/animation_blit_fltk.py
 trunk/matplotlib/examples/animation_blit_qt.py
 trunk/matplotlib/examples/animation_blit_qt4.py
 trunk/matplotlib/examples/animation_blit_tk.py
 trunk/matplotlib/examples/animation_blit_wx.py
 trunk/matplotlib/examples/backend_driver.py
 trunk/matplotlib/examples/clippedline.py
 trunk/matplotlib/examples/collections_demo.py
 trunk/matplotlib/examples/color_by_yvalue.py
 trunk/matplotlib/examples/contourf_demo.py
 trunk/matplotlib/examples/data_helper.py
 trunk/matplotlib/examples/dynamic_demo_wx.py
 trunk/matplotlib/examples/dynamic_image_wxagg.py
 trunk/matplotlib/examples/dynamic_image_wxagg2.py
 trunk/matplotlib/examples/embedding_in_gtk.py
 trunk/matplotlib/examples/embedding_in_gtk2.py
 trunk/matplotlib/examples/embedding_in_gtk3.py
 trunk/matplotlib/examples/embedding_in_qt.py
 trunk/matplotlib/examples/embedding_in_qt4.py
 trunk/matplotlib/examples/embedding_in_tk.py
 trunk/matplotlib/examples/embedding_in_tk2.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/gtk_spreadsheet.py
 trunk/matplotlib/examples/histogram_demo_canvasagg.py
 trunk/matplotlib/examples/image_masked.py
 trunk/matplotlib/examples/mathtext_wx.py
 trunk/matplotlib/examples/mpl_with_glade.py
 trunk/matplotlib/examples/multi_image.py
 trunk/matplotlib/examples/pcolor_nonuniform.py
 trunk/matplotlib/examples/polar_bar.py
 trunk/matplotlib/examples/polar_demo.py
 trunk/matplotlib/examples/polar_legend.py
 trunk/matplotlib/examples/poly_editor.py
 trunk/matplotlib/examples/printing_in_wx.py
 trunk/matplotlib/examples/pythonic_matplotlib.py
 trunk/matplotlib/examples/scatter_masked.py
 trunk/matplotlib/examples/strip_chart_demo.py
 trunk/matplotlib/examples/tex_demo.py
 trunk/matplotlib/examples/tex_unicode_demo.py
 trunk/matplotlib/examples/vline_demo.py
 trunk/matplotlib/examples/webapp_demo.py
 trunk/matplotlib/examples/wxcursor_demo.py
Removed Paths:
-------------
 trunk/matplotlib/examples/anim_tk.py
 trunk/matplotlib/examples/image_demo_na.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/CHANGELOG	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -5,7 +5,9 @@
 from pylab is nearly unchanged, but there is the
 new alternative of importing from pyplot to get
 the state-engine graphics without all the numeric
- functions. - EF
+ functions.
+ Numpified examples; deleted two that were obsolete;
+ modified some to use pyplot. - EF
 
 2007年09月08日 Eliminated gd and paint backends - EF
 
Deleted: trunk/matplotlib/examples/anim_tk.py
===================================================================
--- trunk/matplotlib/examples/anim_tk.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/anim_tk.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -1,49 +0,0 @@
-# deprecated - this example is no longer needed. Follow the model of
-# anim.py to use interaction = True to avoid all the cruft of timers,
-# callbacks and the likes used here
-
-#!/usr/bin/env python2.3
-
-import matplotlib
-matplotlib.use('TkAgg')
-import pylab
-
-#import Tkinter as Tk
-import matplotlib.numerix as numerix
-fig = pylab.figure(1)
-ind = numerix.arange(60)
-
-
-
-x_tmp=[]
-for i in range(100):
- x_tmp.append(numerix.sin((ind+i)*numerix.pi/15.0))
-
-X=numerix.array(x_tmp)
-
-
-lines = pylab.plot(X[:,0],'o')
-
-manager = pylab.get_current_fig_manager()
-
-def updatefig(*args):
- updatefig.count += 1
- lines[0].set_ydata(X[:,updatefig.count%60])
- manager.canvas.draw()
- return updatefig.count
-updatefig.count=-1
-
-def run(*args):
- print 'called run'
-
- import time
- tstart = time.time()
- while 1:
- cnt = updatefig()
- if cnt==100: break
- print 'elapsed', 100.0/(time.time() - tstart)
-
-import Tkinter as Tk
-manager.window.after(10, run)
-manager.show()
-Tk.mainloop()
Modified: trunk/matplotlib/examples/animation_blit.py
===================================================================
--- trunk/matplotlib/examples/animation_blit.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/animation_blit.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -10,7 +10,7 @@
 
 import matplotlib
 matplotlib.use('GTKAgg')
-import matplotlib.numerix as nx
+import numpy as npy
 import pylab as p
 
 
@@ -21,8 +21,8 @@
 p.grid() # to ensure proper background restore
 
 # create the initial line
-x = nx.arange(0,2*nx.pi,0.01)
-line, = p.plot(x, nx.sin(x), animated=True, lw=2)
+x = npy.arange(0,2*npy.pi,0.01)
+line, = p.plot(x, npy.sin(x), animated=True, lw=2)
 
 # for profiling
 tstart = time.time()
@@ -34,7 +34,7 @@
 # restore the clean slate background
 canvas.restore_region(update_line.background)
 # update the data
- line.set_ydata(nx.sin(x+update_line.cnt/10.0))
+ line.set_ydata(npy.sin(x+update_line.cnt/10.0))
 # just draw the animated artist
 try:
 ax.draw_artist(line)
Modified: trunk/matplotlib/examples/animation_blit_fltk.py
===================================================================
--- trunk/matplotlib/examples/animation_blit_fltk.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/animation_blit_fltk.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -3,7 +3,7 @@
 import matplotlib
 matplotlib.use('FltkAgg')
 import pylab as p
-import matplotlib.numerix as nx
+import numpy as nx
 import time
 
 
Modified: trunk/matplotlib/examples/animation_blit_qt.py
===================================================================
--- trunk/matplotlib/examples/animation_blit_qt.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/animation_blit_qt.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -15,7 +15,7 @@
 ITERS = 1000
 
 import pylab as p
-import matplotlib.numerix as nx
+import numpy as npy
 import time
 
 class BlitQT(QObject):
@@ -27,8 +27,8 @@
 self.cnt = 0
 
 # create the initial line
- self.x = nx.arange(0,2*nx.pi,0.01)
- self.line, = p.plot(self.x, nx.sin(self.x), animated=True, lw=2)
+ self.x = npy.arange(0,2*npy.pi,0.01)
+ self.line, = p.plot(self.x, npy.sin(self.x), animated=True, lw=2)
 
 self.background = None
 
@@ -39,7 +39,7 @@
 # restore the clean slate background
 self.canvas.restore_region(self.background)
 # update the data
- self.line.set_ydata(nx.sin(self.x+self.cnt/10.0))
+ self.line.set_ydata(npy.sin(self.x+self.cnt/10.0))
 # just draw the animated artist
 self.ax.draw_artist(self.line)
 # just redraw the axes rectangle
Modified: trunk/matplotlib/examples/animation_blit_qt4.py
===================================================================
--- trunk/matplotlib/examples/animation_blit_qt4.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/animation_blit_qt4.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -10,7 +10,7 @@
 ITERS = 1000
 
 import pylab as p
-import matplotlib.numerix as nx
+import numpy as npy
 import time
 
 class BlitQT(QtCore.QObject):
@@ -22,8 +22,8 @@
 self.cnt = 0
 
 # create the initial line
- self.x = nx.arange(0,2*nx.pi,0.01)
- self.line, = p.plot(self.x, nx.sin(self.x), animated=True, lw=2)
+ self.x = npy.arange(0,2*npy.pi,0.01)
+ self.line, = p.plot(self.x, npy.sin(self.x), animated=True, lw=2)
 
 self.background = None
 
@@ -34,7 +34,7 @@
 # restore the clean slate background
 self.canvas.restore_region(self.background)
 # update the data
- self.line.set_ydata(nx.sin(self.x+self.cnt/10.0))
+ self.line.set_ydata(npy.sin(self.x+self.cnt/10.0))
 # just draw the animated artist
 self.ax.draw_artist(self.line)
 # just redraw the axes rectangle
Modified: trunk/matplotlib/examples/animation_blit_tk.py
===================================================================
--- trunk/matplotlib/examples/animation_blit_tk.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/animation_blit_tk.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -6,7 +6,7 @@
 
 import sys
 import pylab as p
-import matplotlib.numerix as nx
+import numpy as npy
 import time
 
 ax = p.subplot(111)
@@ -14,8 +14,8 @@
 
 
 # create the initial line
-x = nx.arange(0,2*nx.pi,0.01)
-line, = p.plot(x, nx.sin(x), animated=True, lw=2)
+x = npy.arange(0,2*npy.pi,0.01)
+line, = p.plot(x, npy.sin(x), animated=True, lw=2)
 
 def run(*args):
 background = canvas.copy_from_bbox(ax.bbox)
@@ -26,7 +26,7 @@
 # restore the clean slate background
 canvas.restore_region(background)
 # update the data
- line.set_ydata(nx.sin(x+run.cnt/10.0))
+ line.set_ydata(npy.sin(x+run.cnt/10.0))
 # just draw the animated artist
 ax.draw_artist(line)
 # just redraw the axes rectangle
Modified: trunk/matplotlib/examples/animation_blit_wx.py
===================================================================
--- trunk/matplotlib/examples/animation_blit_wx.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/animation_blit_wx.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -12,7 +12,7 @@
 import wx
 import sys
 import pylab as p
-import matplotlib.numerix as nx
+import numpy as npy
 import time
 
 
@@ -30,8 +30,8 @@
 p.grid() # to ensure proper background restore
 
 # create the initial line
-x = nx.arange(0,2*nx.pi,0.01)
-line, = p.plot(x, nx.sin(x), animated=True, lw=2)
+x = npy.arange(0,2*npy.pi,0.01)
+line, = p.plot(x, npy.sin(x), animated=True, lw=2)
 
 # for profiling
 tstart = time.time()
@@ -46,7 +46,7 @@
 # restore the clean slate background
 canvas.restore_region(update_line.background)
 # update the data
- line.set_ydata(nx.sin(x+update_line.cnt/10.0))
+ line.set_ydata(npy.sin(x+update_line.cnt/10.0))
 # just draw the animated artist
 ax.draw_artist(line)
 # just redraw the axes rectangle
Modified: trunk/matplotlib/examples/backend_driver.py
===================================================================
--- trunk/matplotlib/examples/backend_driver.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/backend_driver.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -42,7 +42,6 @@
 'histogram_demo.py',
 'image_demo.py',
 'image_demo2.py',
- 'image_demo_na.py',
 'image_masked.py',
 'image_origin.py',
 'invert_axes.py',
@@ -158,7 +157,7 @@
 
 if __name__ == '__main__':
 times = {}
- default_backends = ['Agg', 'PS', 'SVG', 'Template']
+ default_backends = ['Agg', 'PS', 'SVG', 'PDF', 'Template']
 if sys.platform == 'win32':
 python = r'c:\Python24\python.exe'
 else:
Modified: trunk/matplotlib/examples/clippedline.py
===================================================================
--- trunk/matplotlib/examples/clippedline.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/clippedline.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -4,7 +4,7 @@
 """
 
 from matplotlib.lines import Line2D
-import matplotlib.numerix as nx
+import numpy as npy
 from pylab import figure, show
 
 class ClippedLine(Line2D):
@@ -19,13 +19,13 @@
 
 def set_data(self, *args, **kwargs):
 Line2D.set_data(self, *args, **kwargs)
- self.xorig = nx.array(self._x)
- self.yorig = nx.array(self._y)
+ self.xorig = npy.array(self._x)
+ self.yorig = npy.array(self._y)
 
 def draw(self, renderer):
 xlim = self.ax.get_xlim()
 
- ind0, ind1 = nx.searchsorted(self.xorig, xlim)
+ ind0, ind1 = npy.searchsorted(self.xorig, xlim)
 self._x = self.xorig[ind0:ind1]
 self._y = self.yorig[ind0:ind1]
 N = len(self._x)
@@ -43,8 +43,8 @@
 fig = figure()
 ax = fig.add_subplot(111, autoscale_on=False)
 
-t = nx.arange(0.0, 100.0, 0.01)
-s = nx.sin(2*nx.pi*t)
+t = npy.arange(0.0, 100.0, 0.01)
+s = npy.sin(2*npy.pi*t)
 line = ClippedLine(ax, t, s, color='g', ls='-', lw=2)
 ax.add_line(line)
 ax.set_xlim(10,30)
Modified: trunk/matplotlib/examples/collections_demo.py
===================================================================
--- trunk/matplotlib/examples/collections_demo.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/collections_demo.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -17,10 +17,10 @@
 
 '''
 
-import pylab as P
+import matplotlib.pyplot as P
 from matplotlib import collections, axes, transforms
 from matplotlib.colors import colorConverter
-import matplotlib.numerix as N
+import numpy as N
 
 nverts = 50
 npts = 100
@@ -33,8 +33,8 @@
 spiral = zip(xx,yy)
 
 # Make some offsets
-xo = P.randn(npts)
-yo = P.randn(npts)
+xo = N.random.randn(npts)
+yo = N.random.randn(npts)
 xyo = zip(xo, yo)
 
 # Make a list of colors cycling through the rgbcmyk series.
@@ -90,7 +90,7 @@
 a = fig.add_subplot(2,2,3)
 
 col = collections.RegularPolyCollection(fig.dpi, 7,
- sizes = P.fabs(xx)*10, offsets=xyo,
+ sizes = N.fabs(xx)*10, offsets=xyo,
 transOffset=a.transData)
 a.add_collection(col, autolim=True)
 trans = transforms.scale_transform(fig.dpi/transforms.Value(72.),
@@ -111,12 +111,12 @@
 ncurves = 20
 offs = (0.1, 0.0)
 
-yy = P.linspace(0, 2*N.pi, nverts)
-ym = P.amax(yy)
+yy = N.linspace(0, 2*N.pi, nverts)
+ym = N.amax(yy)
 xx = (0.2 + (ym-yy)/ym)**2 * N.cos(yy-0.4) * 0.5
 segs = []
 for i in range(ncurves):
- xxx = xx + 0.02*P.randn(nverts)
+ xxx = xx + 0.02*N.random.randn(nverts)
 curve = zip(xxx, yy*100)
 segs.append(curve)
 
Modified: trunk/matplotlib/examples/color_by_yvalue.py
===================================================================
--- trunk/matplotlib/examples/color_by_yvalue.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/color_by_yvalue.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -1,7 +1,7 @@
 # use masked arrays to plot a line with different colors by y-value
-import matplotlib.numerix.ma as ma
-from matplotlib.numerix import logical_or
-from pylab import plot, show, arange, sin, pi
+import matplotlib.numerix.npyma as ma
+from numpy import logical_or, arange, sin, pi
+from matplotlib.pyplot import plot, show
 
 t = arange(0.0, 2.0, 0.01)
 s = sin(2*pi*t)
Modified: trunk/matplotlib/examples/contourf_demo.py
===================================================================
--- trunk/matplotlib/examples/contourf_demo.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/contourf_demo.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 from pylab import *
-import matplotlib.numerix.ma as ma
+import matplotlib.numerix.npyma as ma
 origin = 'lower'
 #origin = 'upper'
 
Modified: trunk/matplotlib/examples/data_helper.py
===================================================================
--- trunk/matplotlib/examples/data_helper.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/data_helper.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -1,7 +1,8 @@
 #!/usr/bin/env python
 # Some functions to load a return data for the plot demos
 
-from matplotlib.numerix import fromstring, argsort, take, array, resize
+from numpy import fromstring, argsort, take, array, resize
+
 def get_two_stock_data():
 """
 load stock time and price data for two stocks The return values
Modified: trunk/matplotlib/examples/dynamic_demo_wx.py
===================================================================
--- trunk/matplotlib/examples/dynamic_demo_wx.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/dynamic_demo_wx.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -63,7 +63,7 @@
 
 from matplotlib.figure import Figure
 from matplotlib.axes import Subplot
-import matplotlib.numerix as numpy
+import numpy
 from wx import *
 
 
Modified: trunk/matplotlib/examples/dynamic_image_wxagg.py
===================================================================
--- trunk/matplotlib/examples/dynamic_image_wxagg.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/dynamic_image_wxagg.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -12,26 +12,13 @@
 import matplotlib
 matplotlib.use('WXAgg')
 
-# jdh: you need to control Numeric vs numarray with numerix, otherwise
-# matplotlib may be using numeric under the hood and while you are
-# using numarray and this isn't efficient. Also, if you use
-# 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'
-
-
-# jdh: you can import cm directly, you don't need to go via
-# pylab
 import matplotlib.cm as cm
 
 from matplotlib.backends.backend_wxagg import Toolbar, FigureCanvasWxAgg
 
-# jdh: you don't need a figure manager in the GUI - this class was
-# designed for the pylab interface
-
 from matplotlib.figure import Figure
-import matplotlib.numerix as numerix
+import numpy as npy
 import wx
 
 
@@ -75,12 +62,12 @@
 # jdh you can add a subplot directly from the fig rather than
 # the fig manager
 a = self.fig.add_subplot(111)
- self.x = numerix.arange(120.0)*2*numerix.pi/120.0
+ self.x = npy.arange(120.0)*2*npy.pi/120.0
 self.x.resize((100,120))
- self.y = numerix.arange(100.0)*2*numerix.pi/100.0
+ self.y = npy.arange(100.0)*2*npy.pi/100.0
 self.y.resize((120,100))
- self.y = numerix.transpose(self.y)
- z = numerix.sin(self.x) + numerix.cos(self.y)
+ 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')
 
 def GetToolBar(self):
@@ -89,9 +76,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
Modified: trunk/matplotlib/examples/dynamic_image_wxagg2.py
===================================================================
--- trunk/matplotlib/examples/dynamic_image_wxagg2.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/dynamic_image_wxagg2.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -12,24 +12,14 @@
 import matplotlib
 matplotlib.use('WXAgg')
 
-# jdh: you need to control Numeric vs numarray with numerix, otherwise
-# matplotlib may be using numeric under the hood and while you are
-# using numarray and this isn't efficient. Also, if you use
-# numerix=numarray, it is important to compile matplotlib for numarray
-# by setting NUMERIX = 'numarray' in setup.py before building
 from matplotlib import rcParams
 import numpy as npy
 
-# jdh: you can import cm directly, you don't need to go via
-# pylab
 import matplotlib.cm as cm
 
 from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
 from matplotlib.backends.backend_wx import NavigationToolbar2Wx
 
-# jdh: you don't need a figure manager in the GUI - this class was
-# designed for the pylab interface
-
 from matplotlib.figure import Figure
 from wx import *
 
Modified: trunk/matplotlib/examples/embedding_in_gtk.py
===================================================================
--- trunk/matplotlib/examples/embedding_in_gtk.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/embedding_in_gtk.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -8,7 +8,7 @@
 
 from matplotlib.axes import Subplot
 from matplotlib.figure import Figure
-from matplotlib.numerix import arange, sin, pi
+from numpy import arange, sin, pi
 
 # uncomment to select /GTK/GTKAgg/GTKCairo
 from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
Modified: trunk/matplotlib/examples/embedding_in_gtk2.py
===================================================================
--- trunk/matplotlib/examples/embedding_in_gtk2.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/embedding_in_gtk2.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -7,7 +7,7 @@
 
 from matplotlib.axes import Subplot
 from matplotlib.figure import Figure
-from matplotlib.numerix import arange, sin, pi
+from numpy import arange, sin, pi
 
 # uncomment to select /GTK/GTKAgg/GTKCairo
 from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
Modified: trunk/matplotlib/examples/embedding_in_gtk3.py
===================================================================
--- trunk/matplotlib/examples/embedding_in_gtk3.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/embedding_in_gtk3.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -7,7 +7,7 @@
 
 from matplotlib.axes import Subplot
 from matplotlib.figure import Figure
-from matplotlib.numerix import arange, sin, pi
+from numpy import arange, sin, pi
 
 # uncomment to select /GTK/GTKAgg/GTKCairo
 #from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
Modified: trunk/matplotlib/examples/embedding_in_qt.py
===================================================================
--- trunk/matplotlib/examples/embedding_in_qt.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/embedding_in_qt.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -11,7 +11,7 @@
 import sys, os, random
 from qt import *
 
-from matplotlib.numerix import arange, sin, pi
+from numpy import arange, sin, pi
 from matplotlib.backends.backend_qtagg import FigureCanvasQTAgg as FigureCanvas
 from matplotlib.figure import Figure
 
Modified: trunk/matplotlib/examples/embedding_in_qt4.py
===================================================================
--- trunk/matplotlib/examples/embedding_in_qt4.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/embedding_in_qt4.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -12,7 +12,7 @@
 import sys, os, random
 from PyQt4 import QtGui, QtCore
 
-from matplotlib.numerix import arange, sin, pi
+from numpy import arange, sin, pi
 from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
 from matplotlib.figure import Figure
 
Modified: trunk/matplotlib/examples/embedding_in_tk.py
===================================================================
--- trunk/matplotlib/examples/embedding_in_tk.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/embedding_in_tk.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -2,7 +2,7 @@
 import matplotlib
 matplotlib.use('TkAgg')
 
-from matplotlib.numerix import arange, sin, pi
+from numpy import arange, sin, pi
 from matplotlib.axes import Subplot
 from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
 from matplotlib.figure import Figure
Modified: trunk/matplotlib/examples/embedding_in_tk2.py
===================================================================
--- trunk/matplotlib/examples/embedding_in_tk2.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/embedding_in_tk2.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -2,7 +2,7 @@
 import matplotlib
 matplotlib.use('TkAgg')
 
-from matplotlib.numerix import arange, sin, pi
+from numpy import arange, sin, pi
 from matplotlib.axes import Subplot
 from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
 from matplotlib.figure import Figure
Modified: trunk/matplotlib/examples/embedding_in_wx.py
===================================================================
--- trunk/matplotlib/examples/embedding_in_wx.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/embedding_in_wx.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -44,7 +44,7 @@
 
 from matplotlib.figure import Figure
 from matplotlib.axes import Subplot
-import matplotlib.numerix as numpy
+import numpy
 from wx import *
 
 
Modified: trunk/matplotlib/examples/embedding_in_wx2.py
===================================================================
--- trunk/matplotlib/examples/embedding_in_wx2.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/embedding_in_wx2.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -4,7 +4,7 @@
 toolbar - comment out the setA_toolbar line for no toolbar
 """
 
-from matplotlib.numerix import arange, sin, pi
+from numpy import arange, sin, pi
 
 import matplotlib
 
Modified: trunk/matplotlib/examples/embedding_in_wx3.py
===================================================================
--- trunk/matplotlib/examples/embedding_in_wx3.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/embedding_in_wx3.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -25,8 +25,6 @@
 from matplotlib.backends.backend_wxagg import Toolbar, FigureCanvasWxAgg
 from matplotlib.figure import Figure
 import numpy as npy
-import matplotlib.numerix.mlab as mlab
-from matplotlib.mlab import meshgrid
 
 from wx import *
 from wx.xrc import *
@@ -61,11 +59,11 @@
 
 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)
+ self.x, self.y = npy.meshgrid(x, 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
+ zmax = npy.amax(z) - ERR_TOL
 ymax_i, xmax_i = npy.nonzero(z >= zmax)
 if self.im.origin == 'upper':
 ymax_i = z.shape[0]-ymax_i
@@ -84,7 +82,7 @@
 z = npy.sin(self.x) + npy.cos(self.y)
 self.im.set_array(z)
 
- zmax = mlab.max(mlab.max(z))-ERR_TOL
+ zmax = npy.amax(z) - ERR_TOL
 ymax_i, xmax_i = npy.nonzero(z >= zmax)
 if self.im.origin == 'upper':
 ymax_i = z.shape[0]-ymax_i
Modified: trunk/matplotlib/examples/embedding_in_wx4.py
===================================================================
--- trunk/matplotlib/examples/embedding_in_wx4.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/embedding_in_wx4.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -4,7 +4,7 @@
 toolbar
 """
 
-from matplotlib.numerix import arange, sin, pi
+from numpy import arange, sin, pi
 
 import matplotlib
 
@@ -19,7 +19,7 @@
 
 from matplotlib.backends.backend_wx import _load_bitmap
 from matplotlib.figure import Figure
-from matplotlib.numerix.mlab import rand
+from numpy.random import rand
 
 from wx import *
 
Modified: trunk/matplotlib/examples/gtk_spreadsheet.py
===================================================================
--- trunk/matplotlib/examples/gtk_spreadsheet.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/gtk_spreadsheet.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -14,15 +14,13 @@
 matplotlib.use('GTKAgg') # or 'GTK'
 from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
 
-#from matplotlib.numerix import rand
-from matplotlib.numerix.random_array import random
+from numpy.random import random
 from matplotlib.figure import Figure
 
 
 class DataManager(gtk.Window):
 numRows, numCols = 20,10
 
- #data = rand(numRows, numCols)
 data = random((numRows, numCols))
 
 def __init__(self):
Modified: trunk/matplotlib/examples/histogram_demo_canvasagg.py
===================================================================
--- trunk/matplotlib/examples/histogram_demo_canvasagg.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/histogram_demo_canvasagg.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -13,7 +13,8 @@
 from matplotlib.figure import Figure
 from matplotlib.axes import Subplot
 from matplotlib.mlab import normpdf
-from matplotlib.numerix.mlab import randn
+from numpy.random import randn
+import numpy
 
 fig = Figure(figsize=(5,4), dpi=100)
 ax = fig.add_subplot(111)
@@ -42,14 +43,14 @@
 
 s = canvas.tostring_rgb() # save this and convert to bitmap as needed
 
-# get the figure dimensions for creating bitmaps or numeric arrays,
+# get the figure dimensions for creating bitmaps or numpy arrays,
 # etc.
 l,b,w,h = fig.bbox.get_bounds()
 w, h = int(w), int(h)
 
 if 0:
- # convert to a Numeric array
- X = fromstring(s, UInt8)
+ # convert to a numpy array
+ X = numpy.fromstring(s, numpy.uint8)
 X.shape = h, w, 3
 
 if 0:
Deleted: trunk/matplotlib/examples/image_demo_na.py
===================================================================
--- trunk/matplotlib/examples/image_demo_na.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/image_demo_na.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -1,40 +0,0 @@
-#!/usr/bin/env python
-from matplotlib import rcParams
-rcParams['numerix'] = 'numarray'
-
-from pylab import *
-
-
-def bivariate_normal(X, Y, sigmax=1.0, sigmay=1.0,
- mux=0.0, muy=0.0, sigmaxy=0.0):
- """
- Bivariate gaussan distribution for equal shape X, Y
-
- http://mathworld.wolfram.com/BivariateNormalDistribution.html
- """
- Xmu = X-mux
- Ymu = Y-muy
-
- rho = sigmaxy/(sigmax*sigmay)
- z = (1.0/sigmax**2)*Xmu**2 + (1.0/sigmay)*Ymu**2 - (2*rho/(sigmax*sigmay))*Xmu*Ymu
- return 1.0/(2*pi*sigmax*sigmay*(1-rho**2)) * exp( -1/(2*(1-rho**2))*z)
-
-
-delta = 0.025
-x = arange(-3.0, 3.0, delta)
-y = arange(-3.0, 3.0, delta)
-X,Y = meshgrid(x, y)
-Z1 = bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
-Z2 = bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
-
-# difference of Gaussians
-im = imshow(Z2-Z1)
-
-# set the interpolation method: 'nearest', 'bilinear', 'bicubic' and much more
-im.set_interpolation('bilinear')
-
-
-axis('off')
-#savefig('test')
-show()
-
Modified: trunk/matplotlib/examples/image_masked.py
===================================================================
--- trunk/matplotlib/examples/image_masked.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/image_masked.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -4,7 +4,7 @@
 '''
 
 from pylab import *
-import matplotlib.numerix.ma as ma
+import matplotlib.numerix.npyma as ma
 import matplotlib.colors as colors
 
 delta = 0.025
Modified: trunk/matplotlib/examples/mathtext_wx.py
===================================================================
--- trunk/matplotlib/examples/mathtext_wx.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/mathtext_wx.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -5,7 +5,7 @@
 
 import matplotlib
 matplotlib.use("WxAgg")
-from matplotlib.numerix import arange, sin, pi, cos, log
+from numpy import arange, sin, pi, cos, log
 from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
 from matplotlib.backends.backend_wx import NavigationToolbar2Wx
 from matplotlib.figure import Figure
@@ -42,14 +42,14 @@
 self.figure = Figure()
 self.axes = self.figure.add_subplot(111)
 self.change_plot(0)
- 
+
 self.canvas = FigureCanvas(self, -1, self.figure)
 
 self.sizer = wx.BoxSizer(wx.VERTICAL)
 self.add_buttonbar()
 self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
 self.add_toolbar() # comment this out for no toolbar
- 
+
 menuBar = wx.MenuBar()
 
 # File Menu
@@ -104,21 +104,21 @@
 
 def OnChangePlot(self, event):
 self.change_plot(event.GetId() - 1000)
- 
+
 def change_plot(self, plot_number):
 t = arange(1.0,3.0,0.01)
 s = functions[plot_number][1](t)
 self.axes.clear()
 self.axes.plot(t, s)
 self.Refresh()
- 
+
 class MyApp(wx.App):
 def OnInit(self):
 frame = CanvasFrame(None, "wxPython mathtext demo app")
 self.SetTopWindow(frame)
 frame.Show(True)
 return True
- 
+
 app = MyApp()
 app.MainLoop()
 
Modified: trunk/matplotlib/examples/mpl_with_glade.py
===================================================================
--- trunk/matplotlib/examples/mpl_with_glade.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/mpl_with_glade.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -8,7 +8,7 @@
 from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar
 from matplotlib.widgets import SpanSelector
 
-from matplotlib.numerix import arange, sin, pi
+from numpy import arange, sin, pi
 import gtk
 import gtk.glade
 
Modified: trunk/matplotlib/examples/multi_image.py
===================================================================
--- trunk/matplotlib/examples/multi_image.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/multi_image.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -5,19 +5,20 @@
 It also illustrates colorbar tick labelling with a multiplier.
 '''
 
-import pylab
+from matplotlib.pyplot import figure, show, sci
 from matplotlib import cm, colors
 from matplotlib.font_manager import FontProperties
-from matplotlib.numerix.mlab import amin, amax
+from numpy import amin, amax, ravel
+from numpy.random import rand
 
 Nr = 3
 Nc = 2
 
-fig = pylab.gcf()
+fig = figure()
 cmap = cm.cool
 
 figtitle = 'Multiple images'
-t = pylab.gcf().text(0.5, 0.95, figtitle,
+t = fig.text(0.5, 0.95, figtitle,
 horizontalalignment='center',
 fontproperties=FontProperties(size=16))
 
@@ -37,8 +38,8 @@
 a.set_xticklabels([])
 # Make some fake data with a range that varies
 # somewhat from one plot to the next.
- data =((1+i+j)/10.0)*pylab.rand(10,20)*1e-6
- dd = pylab.ravel(data)
+ data =((1+i+j)/10.0)*rand(10,20)*1e-6
+ dd = ravel(data)
 # Manually find the min and max of all colors for
 # use in setting the color scale.
 vmin = min(vmin, amin(dd))
@@ -60,12 +61,13 @@
 
 # We need the following only if we want to run this
 # script interactively and be able to change the colormap.
-pylab.sci(images[0])
 
-pylab.show()
+sci(images[0])
 
+show()
 
 
 
 
 
+
Modified: trunk/matplotlib/examples/pcolor_nonuniform.py
===================================================================
--- trunk/matplotlib/examples/pcolor_nonuniform.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/pcolor_nonuniform.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -1,11 +1,11 @@
-from pylab import figure, show
-import matplotlib.numerix as nx
+from matplotlib.pyplot import figure, show
+import numpy as npy
 from matplotlib.image import NonUniformImage
 
-x = nx.arange(-4, 4, 0.005)
-y = nx.arange(-4, 4, 0.005)
+x = npy.arange(-4, 4, 0.005)
+y = npy.arange(-4, 4, 0.005)
 print 'Size %d points' % (len(x) * len(y))
-z = nx.sqrt(x[nx.NewAxis,:]**2 + y[:,nx.NewAxis]**2)
+z = npy.sqrt(x[npy.newaxis,:]**2 + y[:,npy.newaxis]**2)
 
 fig = figure()
 ax = fig.add_subplot(111)
Modified: trunk/matplotlib/examples/polar_bar.py
===================================================================
--- trunk/matplotlib/examples/polar_bar.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/polar_bar.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -1,9 +1,8 @@
 #!/usr/bin/env python
 
-import matplotlib.numerix as nx
-from matplotlib.mlab import linspace
+import numpy as npy
 import matplotlib.cm as cm
-from pylab import figure, show, rc
+from matplotlib.pyplot import figure, show, rc
 
 
 # force square figure and square axes looks better for polar, IMO
@@ -11,9 +10,9 @@
 ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True)
 
 N = 20
-theta = nx.arange(0.0, 2*nx.pi, 2*nx.pi/N)
-radii = 10*nx.mlab.rand(N)
-width = nx.pi/4*nx.mlab.rand(N)
+theta = npy.arange(0.0, 2*npy.pi, 2*npy.pi/N)
+radii = 10*npy.random.rand(N)
+width = npy.pi/4*npy.random.rand(N)
 bars = ax.bar(theta, radii, width=width, bottom=0.1)
 for r,bar in zip(radii, bars):
 bar.set_facecolor( cm.jet(r/10.))
Modified: trunk/matplotlib/examples/polar_demo.py
===================================================================
--- trunk/matplotlib/examples/polar_demo.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/polar_demo.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -39,8 +39,8 @@
 # See the pylab rgrids and thetagrids functions for
 # information on how to customize the grid locations and labels
 
-import matplotlib.numerix as nx
-from pylab import figure, show, rc
+import numpy as npy
+from matplotlib.pyplot import figure, show, rc
 
 # radar green, solid grid lines
 rc('grid', color='#316931', linewidth=1, linestyle='-')
@@ -51,8 +51,8 @@
 fig = figure(figsize=(8,8))
 ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True, axisbg='#d5de9c')
 
-r = nx.arange(0, 3.0, 0.01)
-theta = 2*nx.pi*r
+r = npy.arange(0, 3.0, 0.01)
+theta = 2*npy.pi*r
 ax.plot(theta, r, color='#ee8d18', lw=3)
 ax.set_rmax(2.0)
 
Modified: trunk/matplotlib/examples/polar_legend.py
===================================================================
--- trunk/matplotlib/examples/polar_legend.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/polar_legend.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 
-import matplotlib.numerix as nx
-from pylab import figure, show, rc
+import numpy as npy
+from matplotlib.pyplot import figure, show, rc
 
 # radar green, solid grid lines
 rc('grid', color='#316931', linewidth=1, linestyle='-')
@@ -12,8 +12,8 @@
 fig = figure(figsize=(8,8))
 ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True, axisbg='#d5de9c')
 
-r = nx.arange(0, 3.0, 0.01)
-theta = 2*nx.pi*r
+r = npy.arange(0, 3.0, 0.01)
+theta = 2*npy.pi*r
 ax.plot(theta, r, color='#ee8d18', lw=3, label='a line')
 ax.plot(0.5*theta, r, color='blue', ls='--', lw=3, label='another line')
 ax.legend()
Modified: trunk/matplotlib/examples/poly_editor.py
===================================================================
--- trunk/matplotlib/examples/poly_editor.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/poly_editor.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -5,8 +5,7 @@
 """
 from matplotlib.artist import Artist
 from matplotlib.patches import Polygon, CirclePolygon
-from matplotlib.numerix import sqrt, nonzero, equal, asarray, dot, Float
-from matplotlib.numerix.mlab import amin
+from numpy import sqrt, nonzero, equal, asarray, dot, amin
 from matplotlib.mlab import dist_point_to_segment
 
 
Modified: trunk/matplotlib/examples/printing_in_wx.py
===================================================================
--- trunk/matplotlib/examples/printing_in_wx.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/printing_in_wx.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -39,7 +39,7 @@
 from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigCanvas
 
 from matplotlib.figure import Figure
-import matplotlib.numerix as numpy
+import numpy
 
 class PlotFrame(wx.Frame):
 help_msg=""" Menus for
Modified: trunk/matplotlib/examples/pythonic_matplotlib.py
===================================================================
--- trunk/matplotlib/examples/pythonic_matplotlib.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/pythonic_matplotlib.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -54,7 +54,7 @@
 
 
 from pylab import figure, close, axes, subplot, show
-from matplotlib.numerix import arange, sin, pi
+from numpy import arange, sin, pi
 
 t = arange(0.0, 1.0, 0.01)
 
Modified: trunk/matplotlib/examples/scatter_masked.py
===================================================================
--- trunk/matplotlib/examples/scatter_masked.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/scatter_masked.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 from pylab import *
-import matplotlib.numerix.ma as ma
+import matplotlib.numerix.npyma as ma
 
 N = 100
 r0 = 0.6
Modified: trunk/matplotlib/examples/strip_chart_demo.py
===================================================================
--- trunk/matplotlib/examples/strip_chart_demo.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/strip_chart_demo.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -12,7 +12,7 @@
 import gobject, gtk
 import matplotlib
 matplotlib.use('GTKAgg')
-import matplotlib.numerix as nx
+import numpy as npy
 from matplotlib.lines import Line2D
 
 
@@ -36,9 +36,9 @@
 
 def emitter(self, p=0.01):
 'return a random value with probability p, else 0'
- v = nx.mlab.rand(1)
+ v = npy.random.rand(1)
 if v>p: return 0.
- else: return nx.mlab.rand(1)
+ else: return npy.random.rand(1)
 
 def update(self, *args):
 if self.background is None: return True
Modified: trunk/matplotlib/examples/tex_demo.py
===================================================================
--- trunk/matplotlib/examples/tex_demo.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/tex_demo.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -11,8 +11,8 @@
 
 """
 from matplotlib import rc
-from matplotlib.numerix import arange, cos, pi
-from pylab import figure, axes, plot, xlabel, ylabel, title, \
+from numpy import arange, cos, pi
+from matplotlib.pyplot import figure, axes, plot, xlabel, ylabel, title, \
 grid, savefig, show
 
 
Modified: trunk/matplotlib/examples/tex_unicode_demo.py
===================================================================
--- trunk/matplotlib/examples/tex_unicode_demo.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/tex_unicode_demo.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -7,8 +7,8 @@
 from matplotlib import rcParams
 rcParams['text.usetex']=True
 rcParams['text.latex.unicode']=True
-from matplotlib.numerix import arange, cos, pi
-from pylab import figure, axes, plot, xlabel, ylabel, title, \
+from numpy import arange, cos, pi
+from matplotlib.pyplot import figure, axes, plot, xlabel, ylabel, title, \
 grid, savefig, show
 
 figure(1)
Modified: trunk/matplotlib/examples/vline_demo.py
===================================================================
--- trunk/matplotlib/examples/vline_demo.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/vline_demo.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -1,17 +1,17 @@
 #!/usr/bin/env python
-from pylab import *
-from matplotlib.numerix import sin, exp, multiply, absolute, pi
-from matplotlib.numerix.random_array import normal
+from matplotlib.pyplot import *
+from numpy import sin, exp, absolute, pi, arange
+from numpy.random import normal
 
 def f(t):
 s1 = sin(2*pi*t)
 e1 = exp(-t)
- return absolute(multiply(s1,e1))+.05
+ return absolute((s1*e1))+.05
 
 
 t = arange(0.0, 5.0, 0.1)
 s = f(t)
-nse = multiply(normal(0.0, 0.3, t.shape), s)
+nse = normal(0.0, 0.3, t.shape) * s
 
 plot(t, s+nse, 'b^')
 vlines(t, [0], s)
Modified: trunk/matplotlib/examples/webapp_demo.py
===================================================================
--- trunk/matplotlib/examples/webapp_demo.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/webapp_demo.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -21,7 +21,7 @@
 from matplotlib.backends.backend_agg import FigureCanvasAgg
 from matplotlib.figure import Figure
 from matplotlib.cbook import iterable
-import matplotlib.numerix as nx
+import numpy as npy
 
 def make_fig():
 """
@@ -40,9 +40,9 @@
 line, = ax.plot([1,2,3], 'ro--', markersize=12, markerfacecolor='g')
 
 # make a translucent scatter collection
- x = nx.mlab.rand(100)
- y = nx.mlab.rand(100)
- area = nx.pi*(10 * nx.mlab.rand(100))**2 # 0 to 10 point radiuses
+ x = npy.random.rand(100)
+ y = npy.random.rand(100)
+ area = npy.pi*(10 * npy.random.rand(100))**2 # 0 to 10 point radiuses
 c = ax.scatter(x,y,area)
 c.set_alpha(0.5)
 
Modified: trunk/matplotlib/examples/wxcursor_demo.py
===================================================================
--- trunk/matplotlib/examples/wxcursor_demo.py	2007年09月09日 22:41:36 UTC (rev 3819)
+++ trunk/matplotlib/examples/wxcursor_demo.py	2007年09月10日 01:42:39 UTC (rev 3820)
@@ -6,7 +6,7 @@
 from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
 from matplotlib.backends.backend_wx import NavigationToolbar2Wx
 from matplotlib.figure import Figure
-from matplotlib.numerix import arange, sin, pi
+from numpy import arange, sin, pi
 
 import wx
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2007年09月09日 22:41:38
Revision: 3819
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3819&view=rev
Author: efiring
Date: 2007年09月09日 15:41:36 -0700 (2007年9月09日)
Log Message:
-----------
Factored plotting part of pylab.py into pyplot.py
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/boilerplate.py
 trunk/matplotlib/examples/rc_traits.py
 trunk/matplotlib/lib/matplotlib/__init__.py
 trunk/matplotlib/lib/matplotlib/config/mplconfig.py
 trunk/matplotlib/lib/matplotlib/config/rcsetup.py
 trunk/matplotlib/lib/matplotlib/mlab.py
 trunk/matplotlib/lib/matplotlib/mpl-data/matplotlib.conf
 trunk/matplotlib/lib/matplotlib/pylab.py
Added Paths:
-----------
 trunk/matplotlib/lib/matplotlib/pyplot.py
Removed Paths:
-------------
 trunk/matplotlib/examples/gdtest.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2007年09月09日 00:41:17 UTC (rev 3818)
+++ trunk/matplotlib/CHANGELOG	2007年09月09日 22:41:36 UTC (rev 3819)
@@ -1,3 +1,12 @@
+2007年09月09日 Split out the plotting part of pylab and put it in
+ pyplot.py; removed numerix from the remaining pylab.py,
+ which imports everything from pyplot.py. The intention
+ is that apart from cleanups, the result of importing
+ from pylab is nearly unchanged, but there is the
+ new alternative of importing from pyplot to get
+ the state-engine graphics without all the numeric
+ functions. - EF
+
 2007年09月08日 Eliminated gd and paint backends - EF
 
 2007年09月06日 .bmp file format is now longer an alias for .raw
@@ -8,12 +17,12 @@
 Now it doesn't crash Preview.app. - JKS
 
 2007年09月06日 Refactored image saving code so that all GUI backends can
-	 save most image types. See FILETYPES for a matrix of
-	 backends and their supported file types.
-	 Backend canvases should no longer write their own print_figure()
-	 method -- instead they should write a print_xxx method for
-	 each filetype they can output and add an entry to their
-	 class-scoped filetypes dictionary. - MGD
+ save most image types. See FILETYPES for a matrix of
+ backends and their supported file types.
+ Backend canvases should no longer write their own print_figure()
+ method -- instead they should write a print_xxx method for
+ each filetype they can output and add an entry to their
+ class-scoped filetypes dictionary. - MGD
 
 2007年09月05日 Fixed Qt version reporting in setupext.py - DSD
 
Modified: trunk/matplotlib/boilerplate.py
===================================================================
--- trunk/matplotlib/boilerplate.py	2007年09月09日 00:41:17 UTC (rev 3818)
+++ trunk/matplotlib/boilerplate.py	2007年09月09日 22:41:36 UTC (rev 3819)
@@ -29,7 +29,7 @@
 return ret
 if Axes.%(func)s.__doc__ is not None:
 %(func)s.__doc__ = dedent(Axes.%(func)s.__doc__) + \"\"\"
-Addition kwargs: hold = [True|False] overrides default hold state\"\"\"
+Additional kwargs: hold = [True|False] overrides default hold state\"\"\"
 """
 
 _fmtmisc = """\
@@ -74,6 +74,8 @@
 'plot',
 'plot_date',
 'psd',
+ 'quiver',
+ 'quiverkey',
 'scatter',
 'semilogx',
 'semilogy',
@@ -82,8 +84,6 @@
 'stem',
 'step',
 'vlines',
- 'quiver',
- 'quiverkey',
 'xcorr',
 )
 
@@ -104,7 +104,6 @@
 'pcolormesh' : 'gci._current = ret',
 'imshow' : 'gci._current = ret',
 'spy' : 'gci._current = ret',
- 'quiver2' : 'gci._current = ret',
 'quiver' : 'gci._current = ret',
 'specgram' : 'gci._current = ret[-1]',
 
@@ -129,11 +128,13 @@
 # This function was autogenerated by boilerplate.py. Do not edit as
 # changes will be lost
 def %(name)s():
- 'set the default colormap to %(name)s and apply to current image if any. See help(colormaps) for more information'
+ '''
+ set the default colormap to %(name)s and apply to current image if any.
+ See help(colormaps) for more information
+ '''
 rc('image', cmap='%(name)s')
 im = gci()
 
-
 if im is not None:
 im.set_cmap(cm.%(name)s)
 draw_if_interactive()
Deleted: trunk/matplotlib/examples/gdtest.py
===================================================================
--- trunk/matplotlib/examples/gdtest.py	2007年09月09日 00:41:17 UTC (rev 3818)
+++ trunk/matplotlib/examples/gdtest.py	2007年09月09日 22:41:36 UTC (rev 3819)
@@ -1,34 +0,0 @@
-#!/usr/bin/env python
-import matplotlib
-matplotlib.use('GD')
-from pylab import *
-
-def f(t):
- s1 = cos(2*pi*t)
- e1 = exp(-t)
- return multiply(s1,e1)
-
-t1 = arange(0.0, 5.0, .1)
-t2 = arange(0.0, 5.0, 0.02)
-t3 = arange(0.0, 2.0, 0.01)
-
-
-if 1:
- subplot(211)
- l = plot(t1, f(t1), 'k-^')
- setp(l, 'markerfacecolor', 'r')
- xlim(0,5)
- title('A tale of 2 subplots', fontsize=12)
- ylabel('Signal 1', fontsize=10)
-
- subplot(212)
- l = plot(t1, f(t1), 'k->')
- xlim(0,5)
- ylabel('Signal 2', fontsize=10)
- xlabel('time (s)', fontsize=10, fontname='Courier')
-
-ax = gca()
-
-
-#savefig('gdtest', dpi=150)
-show()
Modified: trunk/matplotlib/examples/rc_traits.py
===================================================================
--- trunk/matplotlib/examples/rc_traits.py	2007年09月09日 00:41:17 UTC (rev 3818)
+++ trunk/matplotlib/examples/rc_traits.py	2007年09月09日 22:41:36 UTC (rev 3819)
@@ -128,8 +128,8 @@
 antialiased = flexible_true_trait
 
 timezones = 'UTC', 'US/Central', 'ES/Eastern' # fixme: and many more
-backends = ('GTKAgg', 'Cairo', 'FltkAgg', 'GD', 'GDK', 'GTK', 'Agg',
- 'GTKCairo', 'Paint', 'PS', 'SVG', 'Template', 'TkAgg',
+backends = ('GTKAgg', 'Cairo', 'FltkAgg', 'GDK', 'GTK', 'Agg',
+ 'GTKCairo', 'PS', 'SVG', 'Template', 'TkAgg',
 'WX')
 
 class RC(traits.HasTraits):
Modified: trunk/matplotlib/lib/matplotlib/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/__init__.py	2007年09月09日 00:41:17 UTC (rev 3818)
+++ trunk/matplotlib/lib/matplotlib/__init__.py	2007年09月09日 22:41:36 UTC (rev 3819)
@@ -530,16 +530,16 @@
 
 
 class RcParams(dict):
- 
+
 """A dictionary object including validation
- 
+
 validating functions are defined and associated with rc parameters in
 rcsetup.py
 """
- 
+
 validate = dict([ (key, converter) for key, (default, converter) in \
 defaultParams.iteritems() ])
- 
+
 def __setitem__(self, key, val):
 try:
 if key in _deprecated_map.keys():
@@ -620,7 +620,7 @@
 ret['datapath'] = get_data_path()
 
 verbose.report('loaded rc file %s'%fname)
- 
+
 return ret
 
 
Modified: trunk/matplotlib/lib/matplotlib/config/mplconfig.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/mplconfig.py	2007年09月09日 00:41:17 UTC (rev 3818)
+++ trunk/matplotlib/lib/matplotlib/config/mplconfig.py	2007年09月09日 22:41:36 UTC (rev 3819)
@@ -39,7 +39,7 @@
 key = val optional comment
 
 val should be valid python syntax, just as you would use when setting
- properties using rcParams. This should become more obvious by inspecting 
+ properties using rcParams. This should become more obvious by inspecting
 the default values listed herein.
 
 Colors: for the color values below, you can either use
@@ -50,7 +50,7 @@
 - a legal html color name, eg red, blue, darkslategray
 
 Interactivity: see http://matplotlib.sourceforge.net/interactive.html.
- 
+
 ### CONFIGURATION BEGINS HERE ###
 """
 
@@ -61,15 +61,15 @@
 numerix = T.Trait('numpy', 'numpy', 'numeric', 'numarray')
 maskedarray = T.false
 units = T.false
- 
+
 class backend(TConfig):
 """Valid backends are: 'GTKAgg', 'GTKCairo', 'QtAgg', 'Qt4Agg',
 'TkAgg', 'Agg', 'Cairo', 'PS', 'PDF', 'SVG'"""
 use = T.Trait('TkAgg', mplT.BackendHandler())
- 
+
 class cairo(TConfig):
 format = T.Trait('png', 'png', 'ps', 'pdf', 'svg')
- 
+
 class tk(TConfig):
 """
 window_focus : Maintain shell focus for TkAgg
@@ -78,7 +78,7 @@
 
 window_focus = T.false
 pythoninspect = T.false
- 
+
 class ps(TConfig):
 papersize = T.Trait('letter', 'auto', 'letter', 'legal', 'ledger',
 'A0', 'A1', 'A2', 'A3', 'A4', 'A5', 'A6', 'A7',
@@ -87,22 +87,22 @@
 'B8', 'B9', 'B10')
 useafm = T.false
 fonttype = T.Trait(3, 42)
- 
+
 class distiller(TConfig):
 use = T.Trait(None, None, 'ghostscript', 'xpdf', False)
 resolution = T.Float(6000)
- 
+
 class pdf(TConfig):
 compression = T.Range(0, 9, 6)
 fonttype = T.Trait(3, 42)
 inheritcolor = T.false
 use14corefonts = T.false
- 
+
 class svg(TConfig):
 image_inline = T.true
 image_noscale = T.false
 embed_chars = T.true
- 
+
 class lines(TConfig):
 linewidth = T.Float(1.0)
 linestyle = T.Trait('-','--','-.', ':', 'steps', '', ' ', None)
@@ -122,10 +122,10 @@
 linewidth = T.Float(1.0)
 facecolor = T.Trait('blue', mplT.ColorHandler())
 edgecolor = T.Trait('black', mplT.ColorHandler())
- antialiased = T.true 
+ antialiased = T.true
 
 class font(TConfig):
- family = T.Trait('sans-serif', 'sans-serif', 'serif', 'cursive', 
+ family = T.Trait('sans-serif', 'sans-serif', 'serif', 'cursive',
 'fantasy', 'monospace')
 style = T.Trait('normal', 'normal', 'italic', 'oblique')
 variant = T.Trait('normal', 'normal', 'small-caps')
@@ -136,16 +136,16 @@
 'expanded', 'extra-expanded', 'ultra-expanded',
 'wider', 'narrower')
 size = T.Float(12.0)
- serif = T.ListStr(["Bitstream Vera Serif", "New Century Schoolbook", 
- "Century Schoolbook L", "Utopia", "ITC Bookman", "Bookman", 
- "Nimbus Roman No9 L", "Times New Roman", "Times", "Palatino", 
+ serif = T.ListStr(["Bitstream Vera Serif", "New Century Schoolbook",
+ "Century Schoolbook L", "Utopia", "ITC Bookman", "Bookman",
+ "Nimbus Roman No9 L", "Times New Roman", "Times", "Palatino",
 "Charter", "serif"])
- sans_serif = T.ListStr(["Bitstream Vera Sans", "Lucida Grande", "Verdana", 
- "Geneva", "Lucid", "Arial", "Helvetica", "Avant Garde", 
+ sans_serif = T.ListStr(["Bitstream Vera Sans", "Lucida Grande", "Verdana",
+ "Geneva", "Lucid", "Arial", "Helvetica", "Avant Garde",
 "sans-serif"])
- cursive = T.ListStr(["Apple Chancery", "Textile", "Zapf Chancery", "Sand", 
+ cursive = T.ListStr(["Apple Chancery", "Textile", "Zapf Chancery", "Sand",
 "cursive"])
- fantasy = T.ListStr(["Comic Sans MS", "Chicago", "Charcoal", "Impact", "Western", 
+ fantasy = T.ListStr(["Comic Sans MS", "Chicago", "Charcoal", "Impact", "Western",
 "fantasy"])
 monospace = T.ListStr(["Bitstream Vera Sans Mono", "Andale Mono", "Nimbus Mono L",
 "Courier New", "Courier", "Fixed", "Terminal", "monospace"])
@@ -153,12 +153,12 @@
 class text(TConfig):
 color = T.Trait('black',mplT.ColorHandler())
 usetex = T.false
- 
+
 class latex(TConfig):
 unicode = T.false
 preamble = T.ListStr([])
 dvipnghack = T.false
- 
+
 class mathtext(TConfig):
 cal = T.Trait('cursive' , mplT.FontconfigPatternHandler())
 rm = T.Trait('serif' , mplT.FontconfigPatternHandler())
@@ -182,16 +182,16 @@
 'large', 'x-large', 'xx-large', T.Float)
 labelcolor = T.Trait('black', mplT.ColorHandler())
 axisbelow = T.false
- 
+
 class formatter(TConfig):
 limits = T.List(T.Float, [-7, 7], minlen=2, maxlen=2)
- 
+
 class xticks(TConfig):
 color = T.Trait('black', mplT.ColorHandler())
 labelsize = T.Trait('small', 'xx-small', 'x-small', 'small', 'medium',
 'large', 'x-large', 'xx-large', T.Float)
 direction = T.Trait('in', 'out')
- 
+
 class major(TConfig):
 size = T.Float(4)
 pad = T.Float(4)
@@ -205,7 +205,7 @@
 labelsize = T.Trait('small', 'xx-small', 'x-small', 'small', 'medium',
 'large', 'x-large', 'xx-large', T.Float)
 direction = T.Trait('in', 'out')
- 
+
 class major(TConfig):
 size = T.Float(4)
 pad = T.Float(4)
@@ -220,8 +220,8 @@
 linewidth = T.Float(0.5)
 
 class legend(TConfig):
- loc = T.Trait('upper right', 'best', 'upper right', 'upper left', 
- 'lower left', 'lower right', 'right', 'center left', 
+ loc = T.Trait('upper right', 'best', 'upper right', 'upper left',
+ 'lower left', 'lower right', 'right', 'center left',
 'center right', 'lower center', 'upper center', 'center')
 isaxes = T.true
 numpoints = T.Int(3)
@@ -264,26 +264,26 @@
 
 class contour(TConfig):
 negative_linestyle = T.Trait('dashed', 'dashed', 'solid')
- 
+
 class savefig(TConfig):
 dpi = T.Float(100)
 facecolor = T.Trait('white', mplT.ColorHandler())
 edgecolor = T.Trait('white', mplT.ColorHandler())
 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)
 
 
 class RcParamsWrapper(dict):
- 
+
 """A backwards-compatible interface to a traited config object
 """
- 
+
 def __init__(self, tconfig):
 self.tconfig = tconfig
- 
+
 self.tconfig_map = {
 'backend' : (self.tconfig.backend, 'use'),
 'numerix' : (self.tconfig, 'numerix'),
@@ -337,7 +337,7 @@
 'text.latex.unicode' : (self.tconfig.text.latex, 'unicode'),
 'text.latex.preamble' : (self.tconfig.text.latex, 'preamble'),
 'text.dvipnghack' : (self.tconfig.text.latex, 'dvipnghack'),
- 
+
 'mathtext.cal' : (self.tconfig.mathtext, 'cal'),
 'mathtext.rm' : (self.tconfig.mathtext, 'rm'),
 'mathtext.tt' : (self.tconfig.mathtext, 'tt'),
@@ -455,7 +455,7 @@
 
 def keys(self):
 return self.tconfig_map.keys()
- 
+
 def has_key(self, val):
 return self.tconfig_map.has_key(val)
 
@@ -466,7 +466,7 @@
 except AttributeError:
 for key, val in arg:
 self[key] = val
- 
+
 for key in kwargs:
 self[key] = kwargs[key]
 
Modified: trunk/matplotlib/lib/matplotlib/config/rcsetup.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/rcsetup.py	2007年09月09日 00:41:17 UTC (rev 3818)
+++ trunk/matplotlib/lib/matplotlib/config/rcsetup.py	2007年09月09日 22:41:36 UTC (rev 3819)
@@ -70,8 +70,8 @@
 return fonttype
 
 validate_backend = ValidateInStrings('backend',[
- 'Agg2', 'Agg', 'Aqt', 'Cairo', 'CocoaAgg', 'EMF', 'GD', 'GDK',
- 'GTK', 'GTKAgg', 'GTKCairo', 'FltkAgg', 'Paint', 'Pdf', 'PS',
+ 'Agg2', 'Agg', 'Aqt', 'Cairo', 'CocoaAgg', 'EMF', 'GDK',
+ 'GTK', 'GTKAgg', 'GTKCairo', 'FltkAgg', 'Pdf', 'PS',
 'QtAgg', 'Qt4Agg', 'SVG', 'Template', 'TkAgg', 'WX', 'WXAgg',
 ], ignorecase=True)
 
@@ -143,7 +143,7 @@
 
 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
 
@@ -198,11 +198,11 @@
 return float(s)
 except ValueError:
 raise ValueError('not a valid font size')
- 
+
 def validate_font_properties(s):
 parse_fontconfig_pattern(s)
 return s
- 
+
 validate_verbose = ValidateInStrings('verbose',[
 'silent', 'helpful', 'debug', 'debug-annoying',
 ])
@@ -367,7 +367,7 @@
 'mathtext.sf' : ['sans\-serif', validate_font_properties],
 'mathtext.use_cm' : [True, validate_bool],
 'mathtext.fallback_to_cm' : [True, validate_bool],
- 
+
 'image.aspect' : ['equal', validate_aspect], # equal, auto, a number
 'image.interpolation' : ['bilinear', str],
 'image.cmap' : ['jet', str], # one of gray, jet, etc
Modified: trunk/matplotlib/lib/matplotlib/mlab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mlab.py	2007年09月09日 00:41:17 UTC (rev 3818)
+++ trunk/matplotlib/lib/matplotlib/mlab.py	2007年09月09日 22:41:36 UTC (rev 3819)
@@ -1937,7 +1937,7 @@
 return npy.max(npy.sum(npy.absolute((npy.transpose(x))), axis=0))
 elif y=='fro':
 xx = npy.dot(x.transpose(), x)
- return npy.sqrt(asum(npy.diag(xx), axis=0))
+ return npy.sqrt(npy.sum(npy.diag(xx), axis=0))
 else:
 raise ValueError('Second argument not permitted for matrices')
 
Modified: trunk/matplotlib/lib/matplotlib/mpl-data/matplotlib.conf
===================================================================
--- trunk/matplotlib/lib/matplotlib/mpl-data/matplotlib.conf	2007年09月09日 00:41:17 UTC (rev 3818)
+++ trunk/matplotlib/lib/matplotlib/mpl-data/matplotlib.conf	2007年09月09日 22:41:36 UTC (rev 3819)
@@ -3,32 +3,32 @@
 # This is a sample matplotlib configuration file. It should be placed
 # in HOME/.matplotlib/matplotlibrc (unix/linux like systems) and
 # C:\Documents and Settings\yourname\.matplotlib (win32 systems)
-# 
+#
 # By default, the installer will overwrite the existing file in the install
 # path, so if you want to preserve yours, please move it to your HOME dir and
 # set the environment variable if necessary.
-# 
+#
 # This file is best viewed in a editor which supports ini or conf mode syntax
 # highlighting.
-# 
+#
 # Blank lines, or lines starting with a comment symbol, are ignored,
 # as are trailing comments. Other lines must have the format
-# 
+#
 # key = val optional comment
-# 
+#
 # val should be valid python syntax, just as you would use when setting
-# properties using rcParams. This should become more obvious by inspecting 
+# properties using rcParams. This should become more obvious by inspecting
 # the default values listed herein.
-# 
+#
 # Colors: for the color values below, you can either use
 # - a matplotlib color string, such as r, k, or b
 # - an rgb tuple, such as (1.0, 0.5, 0.0)
 # - a hex string, such as #ff00ff or ff00ff
 # - a scalar grayscale intensity such as 0.75
 # - a legal html color name, eg red, blue, darkslategray
-# 
+#
 # Interactivity: see http://matplotlib.sourceforge.net/interactive.html.
-# 
+#
 # ### CONFIGURATION BEGINS HERE ###
 
 # a value of type 'str'
@@ -42,7 +42,7 @@
 # 'Africa/Abidjan' or 'Africa/Accra' or 'Africa/Addis_Ababa' or 'Africa/Algiers'
 # or 'Africa/Asmara' or 'Africa/Asmera' or 'Africa/Bamako' or 'Africa/Bangui' o
 # r 'Africa/Banjul' or 'Africa/Bissau' or 'Africa/Blantyre' or 'Africa/Brazzavil
-# <...snipped 10590 chars...> 
+# <...snipped 10590 chars...>
 # or 'Turkey' or 'UCT' or 'US/Alaska' or 'US/Aleutian' or 'US/Arizona' or 'US/Ce
 # ntral' or 'US/East-Indiana' or 'US/Eastern' or 'US/Hawaii' or 'US/Indiana-Star
 # ke' or 'US/Michigan' or 'US/Mountain' or 'US/Pacific' or 'US/Pacific-New' or '
@@ -72,14 +72,14 @@
 # name like 'orange', a hex color like '#efefef', a grayscale intensity
 # like '0.5', or an RGBA tuple (1,0,0,1)
 labelcolor = 'black'
- # a value of type 'float' or 'xx-small' or 'x-small' or 'small' or 'medium' 
+ # a value of type 'float' or 'xx-small' or 'x-small' or 'small' or 'medium'
 # or 'large' or 'x-large' or 'xx-large'
 labelsize = 'medium'
 # a value of type 'float'
 linewidth = 1.0
 # one of 0, on, false, 1, no, n, y, off, yes, true
 polargrid = True
- # a value of type 'float' or 'xx-small' or 'x-small' or 'small' or 'medium' 
+ # a value of type 'float' or 'xx-small' or 'x-small' or 'small' or 'medium'
 # or 'large' or 'x-large' or 'xx-large'
 titlesize = 'large'
 
@@ -191,7 +191,7 @@
 serif = ['Bitstream Vera Serif', 'New Century Schoolbook', 'Century Schoolbook L', 'Utopia', 'ITC Bookman', 'Bookman', 'Nimbus Roman No9 L', 'Times New Roman', 'Times', 'Palatino', 'Charter', 'serif']
 # a value of type 'float'
 size = 12.0
- # 'ultra-condensed' or 'extra-condensed' or 'condensed' or 'semi-condensed' 
+ # 'ultra-condensed' or 'extra-condensed' or 'condensed' or 'semi-condensed'
 # or 'normal' or 'semi-expanded' or 'expanded' or 'extra-expanded' or 'ultra
 # -expanded' or 'wider' or 'narrower'
 stretch = 'normal'
@@ -218,11 +218,11 @@
 aspect = 'equal'
 # 'Accent' or 'Accent_r' or 'Blues' or 'Blues_r' or 'BrBG' or 'BrBG_r' or 'B
 # uGn' or 'BuGn_r' or 'BuPu' or 'BuPu_r' or 'Dark2' or 'Dark2_r' or 'GnBu' o
- # r 'GnBu_r' or 'Greens' or 'Greens_r' or 'Greys' or 'Greys_r' or 'OrRd' or 
- # <...snipped 1010 chars...> 
- # ist_stern' or 'gist_stern_r' or 'gist_yarg' or 'gist_yarg_r' or 'gray' or 
+ # r 'GnBu_r' or 'Greens' or 'Greens_r' or 'Greys' or 'Greys_r' or 'OrRd' or
+ # <...snipped 1010 chars...>
+ # ist_stern' or 'gist_stern_r' or 'gist_yarg' or 'gist_yarg_r' or 'gray' or
 # 'gray_r' or 'hot' or 'hot_r' or 'hsv' or 'hsv_r' or 'jet' or 'jet_r' or 'p
- # ink' or 'pink_r' or 'prism' or 'prism_r' or 'spectral' or 'spectral_r' or 
+ # ink' or 'pink_r' or 'prism' or 'prism_r' or 'spectral' or 'spectral_r' or
 # 'spring' or 'spring_r' or 'summer' or 'summer_r' or 'winter' or 'winter_r'
 cmap = 'jet'
 # 'bilinear' or 'nearest' or 'bicubic' or 'spline16' or 'spline36' or 'hanni
@@ -237,7 +237,7 @@
 [legend]
 # a value of type 'float'
 axespad = 0.02
- # a value of type 'float' or 'xx-small' or 'x-small' or 'small' or 'medium' 
+ # a value of type 'float' or 'xx-small' or 'x-small' or 'small' or 'medium'
 # or 'large' or 'x-large' or 'xx-large'
 fontsize = 'medium'
 # a value of type 'float'
@@ -362,7 +362,7 @@
 color = 'black'
 # 'in' or 'out'
 direction = 'in'
- # a value of type 'float' or 'xx-small' or 'x-small' or 'small' or 'medium' 
+ # a value of type 'float' or 'xx-small' or 'x-small' or 'small' or 'medium'
 # or 'large' or 'x-large' or 'xx-large'
 labelsize = 'small'
 
@@ -385,7 +385,7 @@
 color = 'black'
 # 'in' or 'out'
 direction = 'in'
- # a value of type 'float' or 'xx-small' or 'x-small' or 'small' or 'medium' 
+ # a value of type 'float' or 'xx-small' or 'x-small' or 'small' or 'medium'
 # or 'large' or 'x-large' or 'xx-large'
 labelsize = 'small'
 
@@ -399,4 +399,4 @@
 # a value of type 'float'
 pad = 4.0
 # a value of type 'float'
- size = 2.0
\ No newline at end of file
+ size = 2.0
Modified: trunk/matplotlib/lib/matplotlib/pylab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/pylab.py	2007年09月09日 00:41:17 UTC (rev 3818)
+++ trunk/matplotlib/lib/matplotlib/pylab.py	2007年09月09日 22:41:36 UTC (rev 3819)
@@ -124,7 +124,7 @@
 fliplr - flip the rows of a matrix up/down
 flipud - flip the columns of a matrix left/right
 linspace - a linear spaced vector of N values from min to max inclusive
- logspace - a log spaced vector of N values from min to max inclusive 
+ logspace - a log spaced vector of N values from min to max inclusive
 meshgrid - repeat x and y to make regular matrices
 ones - an array of ones
 rand - an array from the uniform distribution [0,1]
@@ -198,54 +198,21 @@
 exception of those in mlab.py provided by matplotlib.
 """
 import sys, warnings
-import cm
-import _pylab_helpers
-import mlab #so I can override hist, psd, etc...
 
-from axes import Axes, PolarAxes
-import backends
 from cbook import flatten, is_string_like, exception_to_str, popd, \
 silent_list, iterable, enumerate, dedent
-from colors import Normalize, normalize # latter for backwards compat.
-from cm import get_cmap
-from figure import Figure, figaspect
-import image
-from matplotlib import rcParams, rcParamsDefault, get_backend
-from backend_bases import FigureCanvasBase
-from artist import getp, get
-from artist import setp as _setp
 
+import matplotlib.numerix as nx
+import numpy as npy
 
+from matplotlib import mpl # pulls in most modules
 
-import matplotlib.cbook as cbook
-from matplotlib.mlab import csv2rec
-
-# a hack to keep old versions of ipython working with mpl after bug
-# fix #1209354
-if 'IPython.Shell' in sys.modules:
- from backends import new_figure_manager, draw_if_interactive, show
-else:
- from backends import pylab_setup
- new_figure_manager, draw_if_interactive, show = pylab_setup()
-
-
-
-from image import imread as _imread
-from lines import Line2D
-from text import Text, Annotation
-from patches import Polygon, Rectangle, Circle, Arrow
-from transforms import blend_xy_sep_transform
-from widgets import SubplotTool, Button, Slider, Widget
-
-import numerix as nx
-
-import numpy as npy
-from matplotlib import mpl
 # catch more than an import error here, since the src could fail too,
 # eg a bad pytz install. I don't want to break all of matplotlib for
 # date support
 try:
- from dates import date2num, num2date, datestr2num, strpdate2num, drange,\
+ from matplotlib.dates import date2num, num2date,\
+ datestr2num, strpdate2num, drange,\
 epoch2num, num2epoch, mx2num,\
 DateFormatter, IndexDateFormatter, DateLocator,\
 RRuleLocator, YearLocator, MonthLocator, WeekdayLocator,\
@@ -256,24 +223,16 @@
 __dates_all__ = []
 pass
 else:
- import dates
- __dates_all__ = dates.__all__
+ import matplotlib.dates
+ __dates_all__ = matplotlib.dates.__all__
 
-from ticker import TickHelper, Formatter, FixedFormatter, NullFormatter,\
- FuncFormatter, FormatStrFormatter, ScalarFormatter,\
- LogFormatter, LogFormatterExponent, LogFormatterMathtext,\
- Locator, IndexLocator, FixedLocator, NullLocator,\
- LinearLocator, LogLocator, AutoLocator, MultipleLocator,\
- MaxNLocator
-import ticker
-import matplotlib
 
 # bring all the symbols in so folks can import them from
 # pylab in one fell swoop
 
-from numerix import array, zeros, shape, rank, size, fromstring,\
+from numpy.oldnumeric import array, zeros, shape, rank, size, fromstring,\
 take, put, putmask, reshape, repeat, choose, searchsorted,\
- asum, cumsum, product, cumproduct, alltrue, sometrue, allclose,\
+ cumsum, product, cumproduct, alltrue, sometrue, allclose,\
 arrayrange, arange, asarray, convolve, swapaxes, concatenate,\
 transpose, sort, argsort, argmax, argmin, innerproduct, dot,\
 outerproduct, resize, indices, fromfunction, diagonal, trace,\
@@ -287,28 +246,32 @@
 cosh, arccosh, arcsinh, arctanh, cross_correlate,\
 pi, ArrayType, matrixmultiply
 
-from numerix import Int8, UInt8, Int16, UInt16, Int32, UInt32, Float32,\
+from numpy.oldnumeric import sum as asum
+
+from numpy.oldnumeric import Int8, UInt8, Int16, UInt16, Int32, UInt32, Float32,\
 Float64, Complex32, Complex64, Float, Int, Complex
 
-from matplotlib.numerix.fft import fft
-from matplotlib.numerix.linear_algebra import inverse, eigenvectors
+from numpy.fft import fft # Why just fft?
+from numpy.linalg import inv as inverse
+from numpy.oldnumeric.linear_algebra import eigenvectors
+ # not quite the same as linalg.eig
 
-#from matplotlib.numerix.mlab import rand,randn,eye,tri,diag,fliplr,flipud,rot90,tril,triu,ptp,mean,msort,median,std,cumsum,prod,cumprod,trapz,diff,cov,corrcoef,squeeze,kaiser,blackman,bartlett,hanning,hamming,sinc,eig,svd,angle,roots,amin, amax
 
 pymin, pymax = min, max
-from matplotlib.numerix.mlab import *
+from numpy.oldnumeric.mlab import *
 min, max = pymin, pymax
+from numpy import amin, amax
 
 from matplotlib.mlab import window_hanning, window_none,\
 conv, detrend, detrend_mean, detrend_none, detrend_linear,\
- corrcoef, polyfit, polyval, vander, entropy, normpdf,\
+ polyfit, polyval, entropy, normpdf,\
 levypdf, find, trapz, prepca, fix, rem, norm, orth, rank,\
 sqrtm, prctile, center_matrix, rk4, exp_safe, amap,\
 sum_flat, mean_flat, rms_flat, l1norm, l2norm, norm, frange,\
 diagonal_matrix, base_repr, binary_repr, log2, ispower2,\
 bivariate_normal, load, save, stineman_interp
 
-from numpy import meshgrid, linspace, logspace
+from numpy import meshgrid, linspace, logspace, corrcoef, vander
 
 """
 problem syms
@@ -326,2283 +289,7 @@
 sign
 """
 
+from matplotlib.pyplot import *
 
-from colorbar import colorbar_doc
-def colorbar(mappable = None, cax=None,**kw):
- if mappable is None:
- mappable = gci()
- ret = gcf().colorbar(mappable, cax = cax, **kw)
- draw_if_interactive()
- return ret
-colorbar.__doc__ = colorbar_doc
 
 
-def colors():
- """
- This is a do nothing function to provide you with help on how
- matplotlib handles colors.
-
- Commands which take color arguments can use several formats to
- specify the colors. For the basic builtin colors, you can use a
- single letter
-
- b : blue
- g : green
- r : red
- c : cyan
- m : magenta
- y : yellow
- k : black
- w : white
-
-
- For a greater range of colors, you have two options. You can
- specify the color using an html hex string, as in
-
- color = '#eeefff'
-
- or you can pass an R,G,B tuple, where each of R,G,B are in the
- range [0,1].
-
- You can also use any legal html name for a color, like 'red',
- 'burlywood' and 'chartreuse'
-
- The example below creates a subplot with a dark
- slate gray background
-
- subplot(111, axisbg=(0.1843, 0.3098, 0.3098))
-
- Here is an example that creates a pale turqoise title
-
- title('Is this the best color?', color='#afeeee')
-
- """
- pass
-
-def plotting():
- """
- Plotting commands
- axes - Create a new axes
- axis - Set or return the current axis limits
- bar - make a bar chart
- boxplot - make a box and whiskers chart
- cla - clear current axes
- clabel - label a contour plot
- clf - clear a figure window
- close - close a figure window
- colorbar - add a colorbar to the current figure
- cohere - make a plot of coherence
- contour - make a contour plot
- contourf - make a filled contour plot
- csd - make a plot of cross spectral density
- draw - force a redraw of the current figure
- errorbar - make an errorbar graph
- figlegend - add a legend to the figure
- figimage - add an image to the figure, w/o resampling
- figtext - add text in figure coords
- figure - create or change active figure
- fill - make filled polygons
- gca - return the current axes
- gcf - return the current figure
- gci - get the current image, or None
- get - get a handle graphics property
- hist - make a histogram
- hold - set the hold state on current axes
- legend - add a legend to the axes
- loglog - a log log plot
- imread - load image file into array
- imshow - plot image data
- matshow - display a matrix in a new figure preserving aspect
- pcolor - make a pseudocolor plot
- plot - make a line plot
- psd - make a plot of power spectral density
- quiver - make a direction field (arrows) plot
- rc - control the default params
- savefig - save the current figure
- scatter - make a scatter plot
- set - set a handle graphics property
- semilogx - log x axis
- semilogy - log y axis
- show - show the figures
- specgram - a spectrogram plot
- stem - make a stem plot
- subplot - make a subplot (numrows, numcols, axesnum)
- table - add a table to the axes
- text - add some text at location x,y to the current axes
- title - add a title to the current axes
- xlabel - add an xlabel to the current axes
- ylabel - add a ylabel to the current axes
-
- autumn - set the default colormap to autumn
- bone - set the default colormap to bone
- cool - set the default colormap to cool
- copper - set the default colormap to copper
- flag - set the default colormap to flag
- gray - set the default colormap to gray
- hot - set the default colormap to hot
- hsv - set the default colormap to hsv
- jet - set the default colormap to jet
- pink - set the default colormap to pink
- prism - set the default colormap to prism
- spring - set the default colormap to spring
- summer - set the default colormap to summer
- winter - set the default colormap to winter
- spectral - set the default colormap to spectral
-
- """
- pass
-
-def colormaps():
- """
- matplotlib provides the following colormaps.
-
- autumn bone cool copper flag gray hot hsv jet pink prism
- spring summer winter spectral
-
- You can set the colormap for an image, pcolor, scatter, etc,
- either as a keyword argumentdef con
-
- >>> imshow(X, cmap=cm.hot)
-
- or post-hoc using the corresponding pylab interface function
-
- >>> imshow(X)
- >>> hot()
- >>> jet()
-
- In interactive mode, this will update the colormap allowing you to
- see which one works best for your data.
- """
- pass
-
-
-
-def get_current_fig_manager():
- figManager = _pylab_helpers.Gcf.get_active()
- if figManager is None:
- gcf() # creates an active figure as a side effect
- figManager = _pylab_helpers.Gcf.get_active()
- return figManager
-
-
-# note we check for __doc__ is not None since py2exe optimize removes
-# the docstrings
-def connect(s, func):
- return get_current_fig_manager().canvas.mpl_connect(s, func)
-if FigureCanvasBase.mpl_connect.__doc__ is not None:
- connect.__doc__ = dedent(FigureCanvasBase.mpl_connect.__doc__)
-
-def disconnect(cid):
- return get_current_fig_manager().canvas.mpl_disconnect(cid)
-if FigureCanvasBase.mpl_disconnect.__doc__ is not None:
- disconnect.__doc__ = dedent(FigureCanvasBase.mpl_disconnect.__doc__)
-
-def get_plot_commands(): return ( 'axes', 'axis', 'bar', 'boxplot', 'cla', 'clf',
- 'close', 'colorbar', 'cohere', 'csd', 'draw', 'errorbar',
- 'figlegend', 'figtext', 'figimage', 'figure', 'fill', 'gca',
- 'gcf', 'gci', 'get', 'gray', 'barh', 'jet', 'hist', 'hold', 'imread',
- 'imshow', 'legend', 'loglog', 'quiver', 'rc', 'pcolor', 'pcolormesh', 'plot', 'psd',
- 'savefig', 'scatter', 'set', 'semilogx', 'semilogy', 'show',
- 'specgram', 'stem', 'subplot', 'table', 'text', 'title', 'xlabel',
- 'ylabel', 'pie', 'polar')
-
-def raise_msg_to_str(msg):
- """msg is a return arg from a raise. Join with new lines"""
- if not is_string_like(msg):
- msg = '\n'.join(map(str, msg))
- return msg
-
-
-#----- Now we get started with the matlab(TM) commands ----#
-
-
-
-def axis(*v, **kwargs):
- """
- Set/Get the axis properties::
-
- v = axis() returns the current axes as v = [xmin, xmax, ymin, ymax]
-
- axis(v) where v = [xmin, xmax, ymin, ymax] sets the min and max
- of the x and y axes
-
- axis('off') turns off the axis lines and labels
-
- axis('equal') changes limits of x or y axis so that equal
- increments of x and y have the same length; a circle
- is circular.
-
- axis('scaled') achieves the same result by changing the
- dimensions of the plot box instead of the axis data
- limits.
-
- axis('tight') changes x and y axis limits such that all data is
- shown. If all data is already shown, it will move it to the center
- of the figure without modifying (xmax-xmin) or (ymax-ymin). Note
- this is slightly different than in matlab.
-
- axis('image') is 'scaled' with the axis limits equal to the
- data limits.
-
- axis('auto') or 'normal' (deprecated) restores default behavior;
- axis limits are automatically scaled to make the data fit
- comfortably within the plot box.
-
- if len(*v)==0, you can pass in xmin, xmax, ymin, ymax as kwargs
- selectively to alter just those limits w/o changing the others.
- See help(xlim) and help(ylim) for more information
-
- The xmin, xmax, ymin, ymax tuple is returned
-
- """
- ax = gca()
- v = ax.axis(*v, **kwargs)
- draw_if_interactive()
- return v
-
-
-def axes(*args, **kwargs):
- """
- Add an axes at positon rect specified by::
-
- axes() by itself creates a default full subplot(111) window axis
-
- axes(rect, axisbg='w') where rect=[left, bottom, width, height] in
- normalized (0,1) units. axisbg is the background color for the
- axis, default white
-
- axes(h) where h is an axes instance makes h the
- current axis An Axes instance is returned
-
- kwargs:
-
- axisbg=color : the axes background color
- frameon=False : don't display the frame
- sharex=otherax : the current axes shares xaxis attribute with otherax
- sharey=otherax : the current axes shares yaxis attribute with otherax
- polar=True|False : use a polar axes or not
-
- Examples
-
- examples/axes_demo.py places custom axes.
- examples/shared_axis_demo.py uses sharex and sharey
-
-
- """
-
- nargs = len(args)
- if len(args)==0: return subplot(111, **kwargs)
- if nargs>1:
- raise TypeError('Only one non keyword arg to axes allowed')
- arg = args[0]
-
- if isinstance(arg, Axes):
- a = gcf().sca(arg)
- else:
- rect = arg
- a = gcf().add_axes(rect, **kwargs)
- draw_if_interactive()
- return a
-
-def delaxes(*args):
- """
- delaxes(ax) - remove ax from the current figure. If ax doesn't
- exist an error will be raised.
-
- delaxes(): delete the current axes
- """
- if not len(args):
- ax = gca()
- else:
- ax = args[0]
- ret = gcf().delaxes(ax)
- draw_if_interactive()
- return ret
-
-
-def _get_target_images(target=None):
- if target is None:
- ax = gca()
- all = ax.get_images()
-
- if not len(all):
- raise RuntimeError('You must first define an image, eg with imshow')
-
- images = [all[-1]]
- else:
- if iterable(target): images = target
- else: images = [target]
-
- return images
-
-def clim(vmin=None, vmax=None):
- """
- Set the color limits of the current image
-
- To apply clim to all axes images do
-
- clim(0, 0.5)
-
- If either vmin or vmax is None, the image min/max respectively
- will be used for color scaling.
-
- If you want to set the clim of multiple images,
- use, for example for im in gca().get_images(): im.set_clim(0,
- 0.05)
-
- """
- im = gci()
- if im is None:
- raise RuntimeError('You must first define an image, eg with imshow')
-
- im.set_clim(vmin, vmax)
- draw_if_interactive()
-
-def close(*args):
- """
- Close a figure window
-
- close() by itself closes the current figure
-
- close(num) closes figure number num
-
- close(h) where h is a figure handle(instance) closes that figure
-
- close('all') closes all the figure windows
- """
-
- if len(args)==0:
- figManager = _pylab_helpers.Gcf.get_active()
- if figManager is None: return
- else: _pylab_helpers.Gcf.destroy(figManager.num)
- elif len(args)==1:
- arg = args[0]
- if arg=='all':
- for manager in _pylab_helpers.Gcf.get_all_fig_managers():
- _pylab_helpers.Gcf.destroy(manager.num)
- elif isinstance(arg, int):
- _pylab_helpers.Gcf.destroy(arg)
- elif isinstance(arg, Figure):
- for manager in _pylab_helpers.Gcf.get_all_fig_managers():
- if manager.canvas.figure==arg:
- _pylab_helpers.Gcf.destroy(manager.num)
- else:
- raise TypeError('Unrecognized argument type %s to close'%type(arg))
- else:
- raise TypeError('close takes 0 or 1 arguments')
-
-
-def clf():
- """
- Clear the current figure
- """
- gcf().clf()
- draw_if_interactive()
-
-
-
-def draw():
- 'redraw the current figure'
- get_current_fig_manager().canvas.draw()
-
-def figtext(*args, **kwargs):
-
- ret = gcf().text(*args, **kwargs)
- draw_if_interactive()
- return ret
-if Figure.text.__doc__ is not None:
- figtext.__doc__ = dedent(Figure.text.__doc__)
-
-def figimage(*args, **kwargs):
- # allow callers to override the hold state by passing hold=True|False
- ret = gcf().figimage(*args, **kwargs)
- draw_if_interactive()
- gci._current = ret
- return ret
-if Figure.figimage.__doc__ is not None:
- figimage.__doc__ = dedent(Figure.figimage.__doc__) + """
-Addition kwargs: hold = [True|False] overrides default hold state"""
-
-def figlegend(handles, labels, loc, **kwargs):
- """
- Place a legend in the figure. Labels are a sequence of
- strings, handles is a sequence of line or patch instances, and
- loc can be a string r an integer specifying the legend
- location
-
- USAGE:
- legend( (line1, line2, line3),
- ('label1', 'label2', 'label3'),
- 'upper right')
-
- See help(legend) for information about the location codes
-
- A matplotlib.legend.Legend instance is returned
- """
- l= gcf().legend(handles, labels, loc, **kwargs)
- draw_if_interactive()
- return l
-
-def savefig(*args, **kwargs):
- fig = gcf()
- return fig.savefig(*args, **kwargs)
-if Figure.savefig.__doc__ is not None:
- savefig.__doc__ = dedent(Figure.savefig.__doc__)
-
-
-def figure(num=None, # autoincrement if None, else integer from 1-N
- figsize = None, # defaults to rc figure.figsize
- dpi = None, # defaults to rc figure.dpi
- facecolor = None, # defaults to rc figure.facecolor
- edgecolor = None, # defaults to rc figure.edgecolor
- frameon = True,
- FigureClass = Figure,
- **kwargs
- ):
- """
- figure(num = None, figsize=(8, 6), dpi=80, facecolor='w', edgecolor='k')
-
-
- Create a new figure and return a handle to it. If num=None, the figure
- number will be incremented and a new figure will be created. The returned
- figure objects have a .number attribute holding this number.
-
- If num is an integer, and figure(num) already exists, make it
- active and return the handle to it. If figure(num) does not exist
- it will be created. Numbering starts at 1, matlab style
-
- figure(1)
-
- If you are creating many figures, make sure you explicitly call "close"
- on the figures you are not using, because this will enable pylab
- to properly clean up the memory.
-
- kwargs:
-
- figsize - width x height in inches; defaults to rc figure.figsize
- dpi - resolution; defaults to rc figure.dpi
- facecolor - the background color; defaults to rc figure.facecolor
- edgecolor - the border color; defaults to rc figure.edgecolor
-
- rcParams gives the default values from the matplotlibrc file
-
- FigureClass is a Figure or derived class that will be passed on to
- new_figure_manager in the backends which allows you to hook custom
- Figureclasses into the pylab interface. Additional kwargs will be
- passed on to your figure init function
- """
-
- if figsize is None : figsize = rcParams['figure.figsize']
- if dpi is None : dpi = rcParams['figure.dpi']
- if facecolor is None : facecolor = rcParams['figure.facecolor']
- if edgecolor is None : edgecolor = rcParams['figure.edgecolor']
-
- if num is None:
- allnums = [f.num for f in _pylab_helpers.Gcf.get_all_fig_managers()]
- if allnums:
- num = max(allnums) + 1
- else:
- num = 1
-
- figManager = _pylab_helpers.Gcf.get_fig_manager(num)
- if figManager is None:
- if get_backend()=='PS': dpi = 72
-
- figManager = new_figure_manager(num, figsize=figsize, dpi=dpi, facecolor=facecolor, edgecolor=edgecolor, frameon=frameon, FigureClass=FigureClass, **kwargs)
- _pylab_helpers.Gcf.set_active(figManager)
- figManager.canvas.figure.number = num
-
- draw_if_interactive()
- return figManager.canvas.figure
-
-def gca(**kwargs):
- """
- Return the current axis instance. This can be used to control
- axis properties either using set or the Axes methods.
-
- Example:
-
- plot(t,s)
- set(gca(), 'xlim', [0,10]) # set the x axis limits
-
- or
-
- plot(t,s)
- a = gca()
- a.set_xlim([0,10]) # does the same
- """
-
- ax = gcf().gca(**kwargs)
- return ax
-
-def gcf():
- "Return a handle to the current figure"
-
- figManager = _pylab_helpers.Gcf.get_active()
- if figManager is not None:
- return figManager.canvas.figure
- else:
- return figure()
-
-def gci():
- """
- get the current ScalarMappable instance (image or patch
- collection), or None if no images or patch collections have been
- defined. The commands imshow and figimage create images
- instances, and the commands pcolor and scatter create patch
- collection instances
- """
- return gci._current
-gci._current = None
-
-
-def sci(im):
- """
- Set the current image (the target of colormap commands like jet, hot or clim)
- """
- gci._current = im
-
-
-def hold(b=None):
- """
- Set the hold state. If hold is None (default), toggle the
- hold state. Else set the hold state to boolean value b.
-
- Eg
- hold() # toggle hold
- hold(True) # hold is on
- hold(False) # hold is off
-
- When hold is True, subsequent plot commands will be added to the
- current axes. When hold is False, the current axes and figure
- will be cleared on the next plot command
- """
-
- gcf().hold(b)
- gca().hold(b)
- rc('axes', hold=b)
-
-def ishold():
- """
- Return the hold status of the current axes
- """
- return gca().ishold()
-
-def isinteractive():
- """
- Return the interactive status
- """
- return matplotlib.is_interactive()
-
-def imread(*args, **kwargs):
- return _imread(*args, **kwargs)
-if _imread.__doc__ is not None:
- imread.__doc__ = dedent(_imread.__doc__)
-
-
-
-
-def rc(*args, **kwargs):
- matplotlib.rc(*args, **kwargs)
-if matplotlib.rc.__doc__ is not None:
- rc.__doc__ = dedent(matplotlib.rc.__doc__)
-
-def rcdefaults():
- matplotlib.rcdefaults()
- draw_if_interactive()
-if matplotlib.rcdefaults.__doc__ is not None:
- rcdefaults.__doc__ = dedent(matplotlib.rcdefaults.__doc__)
-
-
-def subplot(*args, **kwargs):
- """
- Create a subplot command, creating axes with
-
- subplot(numRows, numCols, plotNum)
-
- where plotNum=1 is the first plot number and increasing plotNums
- fill rows first. max(plotNum)==numRows*numCols
-
- You can leave out the commas if numRows<=numCols<=plotNum<10, as
- in
-
- subplot(211) # 2 rows, 1 column, first (upper) plot
-
- subplot(111) is the default axis
-
- The background color of the subplot can be specified via keyword
- argument 'axisbg', which takes a color string or gdk.Color as value, as in
-
- subplot(211, axisbg='y')
-
- See help(axes) for additional information on axes and subplot
- keyword arguments.
-
- New subplots that overlap old will delete the old axes. If you do
- not want this behavior, use fig.add_subplot or the axes command. Eg
-
- from pylab import *
- plot([1,2,3]) # implicitly creates subplot(111)
- subplot(211) # overlaps, subplot(111) is killed
- plot(rand(12), rand(12))
-
- """
-
-
- fig = gcf()
- a = fig.add_subplot(*args, **kwargs)
- bbox = a.bbox
- byebye = []
- for other in fig.axes:
- if other==a: continue
- if bbox.overlaps(other.bbox, ignoreend=True):
- byebye.append(other)
- for ax in byebye: delaxes(ax)
-
- draw_if_interactive()
- return a
-
-
-def twinx(ax=None):
- """
- Make a second axes overlay ax (or the current axes if ax is None)
- sharing the xaxis. The ticks for ax2 will be placed on the right,
- and the ax2 instance is returned. See examples/two_scales.py
- """
- if ax is None:
- ax=gca()
-
-
- ax2 = gcf().add_axes(ax.get_position(), sharex=ax, frameon=False)
- ax2.yaxis.tick_right()
- ax2.yaxis.set_label_position('right')
- ax.yaxis.tick_left()
- draw_if_interactive()
- return ax2
-
-
-def twiny(ax=None):
- """
- Make a second axes overlay ax (or the current axes if ax is None)
- sharing the yaxis. The ticks for ax2 will be placed on the top,
- and the ax2 instance is returned.
- """
- if ax is None:
- ax=gca()
-
-
- ax2 = gcf().add_axes(ax.get_position(), sharey=ax, frameon=False)
- ax2.xaxis.tick_top()
- ax2.xaxis.set_label_position('top')
- ax.xaxis.tick_bottom()
- draw_if_interactive()
- return ax2
-
-def title(s, *args, **kwargs):
- """
- Set the title of the current axis to s
-
- Default font override is:
- override = {
- 'fontsize' : 'medium',
- 'verticalalignment' : 'bottom',
- 'horizontalalignment' : 'center'
- }
-
- See the text docstring for information of how override and the
- optional args work
-
- """
- l = gca().set_title(s, *args, **kwargs)
- draw_if_interactive()
- return l
-
-
-
-def xlabel(s, *args, **kwargs):
- """
- Set the x axis label of the current axis to s
-
- Default override is
-
- override = {
- 'fontsize' : 'small',
- 'verticalalignment' : 'top',
- 'horizontalalignment' : 'center'
- }
-
- See the text docstring for information of how override and
- the optional args work
-
- """
- l = gca().set_xlabel(s, *args, **kwargs)
- draw_if_interactive()
- return l
-
-def ylabel(s, *args, **kwargs):
- """
- Set the y axis label of the current axis to s
-
- Defaults override is
-
- override = {
- 'fontsize' : 'small',
- 'verticalalignment' : 'center',
- 'horizontalalignment' : 'right',
- 'rotation'='vertical' : }
-
- See the text docstring for information of how override and the
- optional args work
-
- """
- l = gca().set_ylabel(s, *args, **kwargs)
- draw_if_interactive()
- return l
-
-
-
-
-
-def xlim(*args, **kwargs):
- """
- Set/Get the xlimits of the current axes
-
- xmin, xmax = xlim() : return the current xlim
- xlim( (xmin, xmax) ) : set the xlim to xmin, xmax
- xlim( xmin, xmax ) : set the xlim to xmin, xmax
-
- If you do not specify args, you can pass the xmin and xmax as
- kwargs, eg
-
- xlim(xmax=3) # adjust the max leaving min unchanged
- xlim(xmin=1) # adjust the min leaving max unchanged
-
- The new axis limits are returned as a length 2 tuple
-
- """
- ax = gca()
- ret = ax.set_xlim(*args, **kwargs)
- draw_if_interactive()
- return ret
-
-
-def ylim(*args, **kwargs):
- """
- Set/Get the ylimits of the current axes
-
- ymin, ymax = ylim() : return the current ylim
- ylim( (ymin, ymax) ) : set the ylim to ymin, ymax
- ylim( ymin, ymax ) : set the ylim to ymin, ymax
-
- If you do not specify args, you can pass the ymin and ymax as
- kwargs, eg
-
- ylim(ymax=3) # adjust the max leaving min unchanged
- ylim(ymin=1) # adjust the min leaving max unchanged
-
- The new axis limits are returned as a length 2 tuple
-
- """
- ax = gca()
- ret = ax.set_ylim(*args, **kwargs)
- draw_if_interactive()
- return ret
-
-
-
-
-def xticks(*args, **kwargs):
- """
- Set/Get the xlimits of the current ticklocs, labels
-
- # return locs, labels where locs is an array of tick locations and
- # labels is an array of tick labels.
- locs, labels = xticks()
-
- # set the locations of the xticks
- xticks( arange(6) )
-
- # set the locations and labels of the xticks
- xticks( arange(5), ('Tom', 'Dick', 'Harry', 'Sally', 'Sue') )
-
- The keyword args, if any, are text properties; see text for more
- information on text properties.
- """
- ax = gca()
-
- if len(args)==0:
- locs = ax.get_xticks()
- labels = ax.get_xticklabels()
- elif len(args)==1:
- locs = ax.set_xticks(args[0])
- labels = ax.get_xticklabels()
- elif len(args)==2:
- locs = ax.set_xticks(args[0])
- labels = ax.set_xticklabels(args[1], **kwargs)
- else: raise TypeError('Illegal number of arguments to xticks')
- if len(kwargs):
- for l in labels:
- l.update(kwargs)
-
- draw_if_interactive()
- return locs, silent_list('Text xticklabel', labels)
-
-
-
-def rgrids(*args, **kwargs):
- """
- Set/Get the radial locations of the gridlines and ticklabels
-
- With no args, simply return lines, labels where lines is an
- array of radial gridlines (Line2D instances) and labels is an
- array of tick labels (Text instances).
-
- lines, labels = rgrids()
-
- With arguments, the syntax is
-
- lines, labels = RGRIDS(radii, labels=None, angle=22.5, **kwargs)
-
- The labels will appear at radial distances radii at angle
-
- labels, if not None, is a len(radii) list of strings of the
- labels to use at each angle.
-
- if labels is None, the self.rformatter will be used
-
- Return value is a list of lines, labels where the lines are
- matplotlib.Line2D instances and the labels are matplotlib.Text
- instances. Note that on input the labels argument is a list of
- strings, and on output it is a list of Text instances
-
- Examples
- # set the locations of the radial gridlines and labels
- lines, labels = rgrids( (0.25, 0.5, 1.0) )
-
- # set the locations and labels of the radial gridlines and labels
- lines, labels = rgrids( (0.25, 0.5, 1.0), ('Tom', 'Dick', 'Harry' )
-
- """
- ax = gca()
- if not isinstance(ax, PolarAxes):
- raise RuntimeError('rgrids only defined for polar axes')
- if len(args)==0:
- lines = ax.rgridlines()
- labels = ax.rgridlabels()
- else:
- lines, labels = ax.set_rgrids(*args, **kwargs)
-
- draw_if_interactive()
- return ( silent_list('Line2D rgridline', lines),
- silent_list('Text rgridlabel', labels) )
-
-def thetagrids(*args, **kwargs):
- """
- Set/Get the theta locations of the gridlines and ticklabels
-
- If no arguments are passed, return lines, labels where lines is an
- array of radial gridlines (Line2D instances) and labels is an
- array of tick labels (Text instances).
-
- lines, labels = thetagrids()
-
- Otherwise the syntax is
-
- lines, labels = THETAGRIDS(angles, labels=None, fmt='%d', frac = 1.1)
-
- set the angles at which to place the theta grids (these gridlines
- are equal along the theta dimension). angles is in degrees
-
- labels, if not None, is a len(angles) list of strings of the
- labels to use at each angle.
-
- if labels is None, the labels with be fmt%angle
-
- frac is the fraction of the polar axes radius at which to place
- the label (1 is the edge).Eg 1.05 isd outside the axes and 0.95
- is inside the axes
-
- Return value is a list of lines, labels where the lines are
- matplotlib.Line2D instances and the labels are matplotlib.Text
- instances. Note that on input the labels argument is a list of
- strings, and on output it is a list of Text instances
-
- Examples:
-
- # set the locations of the radial gridlines and labels
- lines, labels = thetagrids( range(45,360,90) )
-
- # set the locations and labels of the radial gridlines and labels
- lines, labels = thetagrids( range(45,360,90), ('NE', 'NW', 'SW','SE') )
- """
- ax = gca()
- if not isinstance(ax, PolarAxes):
- raise RuntimeError('rgrids only defined for polar axes')
- if len(args)==0:
- lines = ax.thetagridlines()
- labels = ax.thetagridlabels()
- else:
- lines, labels = ax.set_thetagrids(*args, **kwargs)
-
- draw_if_interactive()
- return (silent_list('Line2D thetagridline', lines),
- silent_list('Text thetagridlabel', labels)
- )
-
-def yticks(*args, **kwargs):
- """
- Set/Get the ylimits of the current ticklocs, labels
-
- # return locs, labels where locs is an array of tick locations and
- # labels is an array of tick labels.
- locs, labels = yticks()
-
- # set the locations of the yticks
- yticks( arange(6) )
-
- # set the locations and labels of the yticks
- yticks( arange(5), ('Tom', 'Dick', 'Harry', 'Sally', 'Sue') )
-
- The keyword args, if any, are text properties; see text for more
- information on text properties.
- """
- ax = gca()
-
- if len(args)==0:
- locs = ax.get_yticks()
- labels = ax.get_yticklabels()
- elif len(args)==1:
- locs = ax.set_yticks(args[0])
- labels = ax.get_yticklabels()
- elif len(args)==2:
- locs = ax.set_yticks(args[0])
- labels = ax.set_yticklabels(args[1], **kwargs)
- else: raise TypeError('Illegal number of arguments to yticks')
- if len(kwargs):
- for l in labels:
- l.update(kwargs)
-
- draw_if_interactive()
-
- return ( locs,
- silent_list('Text yticklabel', labels)
- )
-
-def polar(*args, **kwargs):
- """
- POLAR(theta, r)
-
- Make a polar plot. Multiple theta, r arguments are supported,
- with format strings, as in plot.
- """
- ax = gca(polar=True)
- ret = ax.plot(*args, **kwargs)
- draw_if_interactive()
- return ret
-
-def over(func, *args, **kwargs):
- """
- Call func(*args, **kwargs) with hold(True) and then restore the hold state
- """
- h = ishold()
- hold(True)
- func(*args, **kwargs)
- hold(h)
-
-def ioff():
- 'turn interactive mode off'
- matplotlib.interactive(False)
-
-def ion():
- 'turn interactive mode on'
- matplotlib.interactive(True)
-
-def switch_backend(newbackend):
- """
- Swtich the default backend to newbackend. This feature is
- EXPERIMENTAL, and is only expected to work switching to an image
- backend. Eg, if you have a bunch of PS scripts that you want to
- run from an interactive ipython session, yuo may want to switch to
- the PS backend before running them to avoid having a bunch of GUI
- windows popup. If you try to interactively switch from one GUI
- backend to another, you will explode.
-
- Calling this command will close all open windows.
- """
- close('all')
- global new_figure_manager, draw_if_interactive, show
- matplotlib.use(newbackend)
- reload(backends)
- from backends import new_figure_manager, draw_if_interactive, show
-
-def matshow(A, fignum=None, **kw):
- """Display an array as a matrix in a new figure window.
-
- The origin is set at the upper left hand corner and rows (first dimension
- of the array) are displayed horizontally. The aspect ratio of the figure
- window is that of the array, unless this would make an excessively
- short or narrow figure.
-
- Tick labels for the xaxis are placed on top.
-
- With one exception, keyword arguments are passed to
- imshow().
-
- Special keyword argument which is NOT passed to imshow():
-
- - fignum(None): by default, matshow() creates a new figure window with
- automatic numbering. If ...
 
[truncated message content]
Revision: 3818
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3818&view=rev
Author: efiring
Date: 2007年09月08日 17:41:17 -0700 (2007年9月08日)
Log Message:
-----------
Removed matplotlibrc; it is generated by setup.py.
Removed Paths:
-------------
 trunk/matplotlib/lib/matplotlib/mpl-data/matplotlibrc
Deleted: trunk/matplotlib/lib/matplotlib/mpl-data/matplotlibrc
===================================================================
--- trunk/matplotlib/lib/matplotlib/mpl-data/matplotlibrc	2007年09月08日 23:53:06 UTC (rev 3817)
+++ trunk/matplotlib/lib/matplotlib/mpl-data/matplotlibrc	2007年09月09日 00:41:17 UTC (rev 3818)
@@ -1,315 +0,0 @@
-### MATPLOTLIBRC FORMAT
-
-# This is a sample matplotlib configuration file. It should be placed
-# in HOME/.matplotlib/matplotlibrc (unix/linux like systems) and
-# C:\Documents and Settings\yourname\.matplotlib (win32 systems)
-#
-# By default, the installer will overwrite the existing file in the
-# install path, so if you want to preserve your's, please move it to
-# your HOME dir and set the environment variable if necessary.
-#
-# This file is best viewed in a editor which supports python mode
-# syntax highlighting
-#
-# Blank lines, or lines starting with a comment symbol, are ignored,
-# as are trailing comments. Other lines must have the format
-#
-# key : val # optional comment
-#
-# Colors: for the color values below, you can either use
-# - a matplotlib color string, such as r, k, or b
-# - an rgb tuple, such as (1.0, 0.5, 0.0)
-# - a hex string, such as ff00ff (no '#' symbol)
-# - a scalar grayscale intensity such as 0.75
-# - a legal html color name, eg red, blue, darkslategray
-
-#### CONFIGURATION BEGINS HERE
-# the default backend; one of GTK GTKAgg GTKCairo FltkAgg QtAgg TkAgg
-# Agg Cairo GD GDK Paint PS PDF SVG Template
-backend : TkAgg
-numerix : numpy # numpy, Numeric or numarray
-#maskedarray : False # True to use external maskedarray module
- # instead of numpy.ma; this is a temporary
- # setting for testing maskedarray.
-#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
-
-# Where your matplotlib data lives if you installed to a non-default
-# location. This is where the matplotlib fonts, bitmaps, etc reside
-#datapath : /home/jdhunter/mpldata
-
-
-### LINES
-# See http://matplotlib.sourceforge.net/matplotlib.lines.html for more
-# information on line properties.
-#lines.linewidth : 1.0 # line width in points
-#lines.linestyle : - # solid line
-#lines.color : blue
-#lines.marker : None # the default marker
-#lines.markeredgewidth : 0.5 # the line width around the marker symbol
-#lines.markersize : 6 # markersize, in points
-#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.antialiased : True # render lines in antialised (no jaggies)
-
-### PATCHES
-# Patches are graphical objects that fill 2D space, like polygons or
-# circles. See
-# http://matplotlib.sourceforge.net/matplotlib.patches.html for more
-# information on patch properties
-#patch.linewidth 	: 1.0 # edge width in points
-#patch.facecolor 	: blue
-#patch.edgecolor 	: black
-#patch.antialiased 	: True # render patches in antialised (no jaggies)
-
-### FONT
-#
-# font properties used by text.Text. See
-# http://matplotlib.sourceforge.net/matplotlib.font_manager.html for more
-# information on font properties. The 6 font properties used for font
-# matching are given below with their default values.
-#
-# The font.family property has five values: 'serif' (e.g. Times),
-# 'sans-serif' (e.g. Helvetica), 'cursive' (e.g. Zapf-Chancery),
-# 'fantasy' (e.g. Western), and 'monospace' (e.g. Courier). Each of
-# these font families has a default list of font names in decreasing
-# order of priority associated with them.
-#
-# The font.style property has three values: normal (or roman), italic
-# or oblique. The oblique style will be used for italic, if it is not
-# present.
-#
-# The font.variant property has two values: normal or small-caps. For
-# TrueType fonts, which are scalable fonts, small-caps is equivalent
-# to using a font size of 'smaller', or about 83% of the current font
-# size.
-#
-# The font.weight property has effectively 13 values: normal, bold,
-# bolder, lighter, 100, 200, 300, ..., 900. Normal is the same as
-# 400, and bold is 700. bolder and lighter are relative values with
-# respect to the current weight.
-#
-# The font.stretch property has 11 values: ultra-condensed,
-# extra-condensed, condensed, semi-condensed, normal, semi-expanded,
-# expanded, extra-expanded, ultra-expanded, wider, and narrower. This
-# property is not currently implemented.
-#
-# The font.size property is the default font size for text, given in pts.
-# 12pt is the standard value.
-#
-#font.family : sans-serif
-#font.style : normal
-#font.variant : normal
-#font.weight : medium
-#font.stretch : normal
-# note that font.size controls default text sizes. To configure
-# special text sizes tick labels, axes, labels, title, etc, see the rc
-# settings for axes and ticks. Special text sizes can be defined
-# relative to font.size, using the following values: xx-small, x-small,
-# small, medium, large, x-large, xx-large, larger, or smaller
-#font.size : 12.0
-#font.serif : Bitstream Vera Serif, New Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman, Bookman, Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif
-#font.sans-serif : Bitstream Vera Sans, Lucida Grande, Verdana, Geneva, Lucid, Arial, Helvetica, Avant Garde, sans-serif
-#font.cursive : Apple Chancery, Textile, Zapf Chancery, Sand, cursive
-#font.fantasy : Comic Sans MS, Chicago, Charcoal, Impact, Western, fantasy
-#font.monospace : Bitstream Vera Sans Mono, Andale Mono, Nimbus Mono L, Courier New, Courier, Fixed, Terminal, monospace
-
-### TEXT
-# text properties used by text.Text. See
-# http://matplotlib.sourceforge.net/matplotlib.text.html for more
-# information on text properties
-
-#text.color : black
-
-### LaTeX customizations. See http://www.scipy.org/Wiki/Cookbook/Matplotlib/UsingTex
-#text.usetex : False # use latex for all text handling. The following fonts
- # are supported through the usual rc parameter settings:
- # new century schoolbook, bookman, times, palatino,
- # zapf chancery, charter, serif, sans-serif, helvetica,
- # avant garde, courier, monospace, computer modern roman,
- # computer modern sans serif, computer modern typewriter
- # If another font is desired which can loaded using the
- # LaTeX \usepackage command, please inquire at the
- # matplotlib mailing list
-#text.latex.unicode : False # use "ucs" and "inputenc" LaTeX packages for handling
- # unicode strings.
-#text.latex.preamble : # IMPROPER USE OF THIS FEATURE WILL LEAD TO LATEX FAILURES
- # AND IS THEREFORE UNSUPPORTED. PLEASE DO NOT ASK FOR HELP
- # IF THIS FEATURE DOES NOT DO WHAT YOU EXPECT IT TO.
- # preamble is a comma separated list of LaTeX statements
- # that are included in the LaTeX document preamble.
- # An example:
- # text.latex.preamble : \usepackage{bm},\usepackage{euler}
- # The following packages are always loaded with usetex, so
- # beware of package collisions: color, geometry, graphicx,
- # type1cm, textcomp. Adobe Postscript (PSSNFS) font packages
- # may also be loaded, depending on your font settings
-#text.dvipnghack : False # some versions of dvipng don't handle
- # alpha channel properly. Use True to correct and flush
- # ~/.matplotlib/tex.cache before testing
-#text.markup : 'plain' # Affects how text, such as titles and labels, are
- # interpreted by default.
- # 'plain': As plain, unformatted text
-				# 'tex': As TeX-like text. Text between $'s will be
-				# formatted as a TeX math expression.
-				# This setting has no effect when text.usetex is True.
-				# In that case, all text will be sent to TeX for 
-				# processing.
-
-# The following settings allow you to select the fonts in math mode.
-# They map from a TeX font name to a set of arguments for the FontProperties constructor.
-# (See FontProperties for more details).
-# These settings are only used if mathtext.use_cm is False, otherwise, the
-# Bakoma TeX Computer Modern fonts are used.
-#mathtext.cal : cursive
-#mathtext.rm : serif
-#mathtext.tt : monospace
-#mathtext.it : serif:italic
-#mathtext.bf : serif:bold
-#mathtext.sf : sans
-#mathtext.use_cm : True
-#mathtext.fallback_to_cm : True # When True, use symbols from the Computer Modern
-			 # fonts when a symbol can not be found in one of 
-				 # the user-specified math fonts.
-
-### AXES
-# default face and edge color, default tick sizes,
-# default fontsizes for ticklabels, and so on. See
-# http://matplotlib.sourceforge.net/matplotlib.axes.html#Axes
-#axes.hold : True # whether to clear the axes by default on
-#axes.facecolor : white # axes background color
-#axes.edgecolor : black # axes edge color
-#axes.linewidth : 1.0 # edge linewidth
-#axes.grid : False # display grid or not
-#axes.titlesize : 14 # fontsize of the axes title
-#axes.labelsize : 12 # fontsize of the x any y labels
-#axes.labelcolor : black
-#axes.axisbelow : False # whether axis gridlines and ticks are below
- # the axes elements (lines, text, etc)
-#axes.formatter.limits : -7, 7 # use scientific notation if log10
- # of the axis range is smaller than the
- # first or larger than the second
-
-#polaraxes.grid : True # display grid on polar axes
-
-### TICKS
-# see http://matplotlib.sourceforge.net/matplotlib.axis.html#Ticks
-#xtick.major.size : 4 # major tick size in points
-#xtick.minor.size : 2 # minor tick size in points
-#xtick.major.pad : 4 # distance to major tick label in points
-#xtick.minor.pad : 4 # distance to the minor tick label in points
-#xtick.color : k # color of the tick labels
-#xtick.labelsize : 12 # fontsize of the tick labels
-#xtick.direction : in # direction: in or out
-
-#ytick.major.size : 4 # major tick size in points
-#ytick.minor.size : 2 # minor tick size in points
-#ytick.major.pad : 4 # distance to major tick label in points
-#ytick.minor.pad : 4 # distance to the minor tick label in points
-#ytick.color : k # color of the tick labels
-#ytick.labelsize : 12 # fontsize of the tick labels
-#ytick.direction : in # direction: in or out
-
-
-### GRIDS
-#grid.color : black # grid color
-#grid.linestyle : : # dotted
-#grid.linewidth : 0.5 # in points
-
-### Legend
-#legend.isaxes : True
-#legend.numpoints : 2 # the number of points in the legend line
-#legend.fontsize : 14
-#legend.pad : 0.2 # the fractional whitespace inside the legend border
-#legend.markerscale : 1.0 # the relative size of legend markers vs. original
-# the following dimensions are in axes coords
-#legend.labelsep : 0.010 # the vertical space between the legend entries
-#legend.handlelen : 0.05 # the length of the legend lines
-#legend.handletextsep : 0.02 # the space between the legend line and legend text
-#legend.axespad : 0.02 # the border between the axes and legend edge
-#legend.shadow : False
-
-### FIGURE
-# See http://matplotlib.sourceforge.net/matplotlib.figure.html#Figure
-#figure.figsize : 8, 6 # figure size in inches
-#figure.dpi : 80 # figure dots per inch
-#figure.facecolor : 0.75 # figure facecolor; 0.75 is scalar gray
-#figure.edgecolor : white # figure edgecolor
-
-# The figure subplot parameters. All dimensions are fraction of the
-# figure width or height
-#figure.subplot.left : 0.125 # the left side of the subplots of the figure
-#figure.subplot.right : 0.9 # the right side of the subplots of the figure
-#figure.subplot.bottom : 0.1 # the bottom of the subplots of the figure
-#figure.subplot.top : 0.9 # the top of the subplots of the figure
-#figure.subplot.wspace : 0.2 # the amount of width reserved for blank space between subplots
-#figure.subplot.hspace : 0.2 # the amount of height reserved for white space between subplots
-
-
-### IMAGES
-#image.aspect : equal # equal | auto | a number
-#image.interpolation : bilinear # see help(imshow) for options
-#image.cmap : jet # gray | jet etc...
-#image.lut : 256 # the size of the colormap lookup table
-#image.origin : upper # lower | upper
-
-
-### CONTOUR PLOTS
-#contour.negative_linestyle : dashed # dashed | solid
-
-### SAVING FIGURES
-# the default savefig params can be different for the GUI backends.
-# Eg, you may want a higher resolution, or to make the figure
-# background white
-#savefig.dpi : 100 # figure dots per inch
-#savefig.facecolor : white # figure facecolor when saving
-#savefig.edgecolor : white # figure edgecolor when saving
-
-#cairo.format : png # png, ps, pdf, svg
-
-# tk backend params
-#tk.window_focus : False # Maintain shell focus for TkAgg
-#tk.pythoninspect : False # tk sets PYTHONINSEPCT
-
-# ps backend params
-#ps.papersize : letter # auto, letter, legal, ledger, A0-A10, B0-B10
-#ps.useafm : False # use of afm fonts, results in small files
-#ps.usedistiller : False # can be: None, ghostscript or xpdf
- # Experimental: may produce smaller files.
- # xpdf intended for production of publication quality files,
- # but requires ghostscript, xpdf and ps2eps
-#ps.distiller.res : 6000 # dpi
-#ps.fonttype : 3 # Output Type 3 (Type3) or Type 42 (TrueType)
-
-# pdf backend params
-#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)
-
-# svg backend params
-#svg.image_inline : True # write raster image data directly into the svg file
-#svg.image_noscale : False # suppress scaling of raster data embedded in SVG
-#svg.embed_chars : False # embed character outlines in the SVG file
-
-# Set the verbose flags. This controls how much information
-# matplotlib gives you at runtime and where it goes. The verbosity
-# levels are: silent, helpful, debug, debug-annoying. Any level is
-# inclusive of all the levels below it. If you setting is debug,
-# you'll get all the debug and helpful messages. When submitting
-# problems to the mailing-list, please set verbose to helpful or debug
-# and paste the output into your report.
-#
-# The fileo gives the destination for any calls to verbose.report.
-# These objects can a filename, or a filehandle like sys.stdout.
-#
-# You can override the rc default verbosity from the command line by
-# giving the flags --verbose-LEVEL where LEVEL is one of the legal
-# levels, eg --verbose-helpful.
-#
-# You can access the verbose instance in your code
-# from matplotlib import verbose.
-#verbose.level : silent # one of silent, helpful, debug, debug-annoying
-#verbose.fileo : sys.stdout # a log filename, sys.stdout or sys.stderr
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2007年09月08日 23:53:16
Revision: 3817
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3817&view=rev
Author: efiring
Date: 2007年09月08日 16:53:06 -0700 (2007年9月08日)
Log Message:
-----------
Delete gd and paint backends.
Modified Paths:
--------------
 trunk/matplotlib/API_CHANGES
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/lib/matplotlib/backends/__init__.py
 trunk/matplotlib/setupext.py
Removed Paths:
-------------
 trunk/matplotlib/lib/matplotlib/backends/backend_gd.py
 trunk/matplotlib/lib/matplotlib/backends/backend_paint.py
Modified: trunk/matplotlib/API_CHANGES
===================================================================
--- trunk/matplotlib/API_CHANGES	2007年09月07日 20:43:20 UTC (rev 3816)
+++ trunk/matplotlib/API_CHANGES	2007年09月08日 23:53:06 UTC (rev 3817)
@@ -1,3 +1,5 @@
+ The gd and paint backends have been deleted.
+
 The errorbar method and function now accept additional kwargs
 so that upper and lower limits can be indicated by capping the
 bar with a caret instead of a straight line segment.
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2007年09月07日 20:43:20 UTC (rev 3816)
+++ trunk/matplotlib/CHANGELOG	2007年09月08日 23:53:06 UTC (rev 3817)
@@ -1,3 +1,5 @@
+2007年09月08日 Eliminated gd and paint backends - EF
+
 2007年09月06日 .bmp file format is now longer an alias for .raw
 
 2007年09月07日 Added clip path support to pdf backend. - JKS
@@ -7,7 +9,7 @@
 
 2007年09月06日 Refactored image saving code so that all GUI backends can
 	 save most image types. See FILETYPES for a matrix of
-	 backends and their supported file types. 
+	 backends and their supported file types.
 	 Backend canvases should no longer write their own print_figure()
 	 method -- instead they should write a print_xxx method for
 	 each filetype they can output and add an entry to their
@@ -16,7 +18,7 @@
 2007年09月05日 Fixed Qt version reporting in setupext.py - DSD
 
 2007年09月04日 Embedding Type 1 fonts in PDF, and thus usetex support
- via dviread, sort of works. To test, enable it by 
+ via dviread, sort of works. To test, enable it by
 renaming _draw_tex to draw_tex. - JKS
 
 2007年09月03日 Added ability of errorbar show limits via caret or
Modified: trunk/matplotlib/lib/matplotlib/backends/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/__init__.py	2007年09月07日 20:43:20 UTC (rev 3816)
+++ trunk/matplotlib/lib/matplotlib/backends/__init__.py	2007年09月08日 23:53:06 UTC (rev 3817)
@@ -7,7 +7,7 @@
 
 interactive_bk = ['GTK', 'GTKAgg', 'GTKCairo', 'FltkAgg', 'QtAgg', 'Qt4Agg',
 'TkAgg', 'WX', 'WXAgg', 'CocoaAgg', 'Aqt']
-non_interactive_bk = ['Agg2', 'Agg', 'Cairo', 'EMF', 'GD', 'GDK', 'Paint',
+non_interactive_bk = ['Agg2', 'Agg', 'Cairo', 'EMF', 'GDK',
 'Pdf', 'PS', 'SVG', 'Template']
 all_backends = interactive_bk + non_interactive_bk
 
Deleted: trunk/matplotlib/lib/matplotlib/backends/backend_gd.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_gd.py	2007年09月07日 20:43:20 UTC (rev 3816)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_gd.py	2007年09月08日 23:53:06 UTC (rev 3817)
@@ -1,374 +0,0 @@
-"""
-A gd backend http://newcenturycomputers.net/projects/gdmodule.html
-"""
-
-
-from __future__ import division
-import sys, os, math, warnings
-
-import numpy as npy
-
-try:
- import gd
-except ImportError:
- print >>sys.stderr, 'You must first install the gd module http://newcenturycomputers.net/projects/gdmodule.html'
- sys.exit()
-
-from matplotlib.backend_bases import RendererBase, \
- GraphicsContextBase, FigureManagerBase, FigureCanvasBase
-from matplotlib import verbose
-from matplotlib._pylab_helpers import Gcf
-from matplotlib.cbook import enumerate, pieces, is_string_like
-from matplotlib.colors import colorConverter
-from matplotlib.figure import Figure
-from matplotlib.transforms import Bbox
-from matplotlib.font_manager import findfont
-# support old font names
-if (os.environ.has_key('GDFONTPATH') and not
- os.environ.has_key('TTFPATH')):
- os.environ['TTFPATH'] = os.environ['GDFONTPATH']
-
-
-
-
-PIXELS_PER_INCH = 96 # constant GD uses for screen DPI
-
-
-def round(x):
- return int(math.floor(x+0.5))
-
-
-class RendererGD(RendererBase):
- """
- The renderer handles all the drawing primitives using a graphics
- context instance that controls the colors/styles
- """
-
-
- # todo: can gd support cap and join styles?
- def __init__(self, im, dpi):
- "Initialize the renderer with a gd image instance"
- self.im = im
- self._cached = {} # a map from get_color args to colors
-
- self.width, self.height = im.size()
- self.dpi = dpi
-
-
- def get_canvas_width_height(self):
- 'return the canvas width and height in display coords'
- return self.width, self.height
-
- def get_text_width_height_descent(self, s, prop, ismath):
- """
- get the width and height in display coords of the string s
- with fontsize in points
- """
-
- size = prop.get_size_in_points()
- font = findfont(prop)
-
- scale = self.get_text_scale()
- try:
- llx, lly, lrx, lry, urx, ury, ulx, uly = \
- self.im.get_bounding_rect(
- font, scale*size, 0.0, (0,0), s)
- except ValueError:
- raise RuntimeError('Could not load font %s. Try setting TTFFONTPATH to include this font' % fontname)
-
- w = abs(lrx - llx)
- h = abs(lly - uly)
- return w, h, h
-
-
- def flipy(self):
- 'return true if y small numbers are top for renderer'
- return True
-
-
- def draw_arc(self, gc, rgbFace, x, y, width, height, angle1, angle2, rotation):
- """
- Draw an arc centered at x,y with width and height and angles
- from 0.0 to 360.0
- """
-
- center = int(x), self.height-int(y)
- wh = int(width), int(height)
- a1, a2 = int(angle1), int(angle2)
- if rgbFace is not None:
- color = self.get_gd_color( rgbFace )
- self.im.filledEllipse(
- center, wh, color)
- color = self.get_gd_color( gc.get_rgb() )
- self.im.arc(center, wh, a1, a2, color)
- self.flush_clip()
-
- def draw_line(self, gc, x1, y1, x2, y2):
- """
- Draw a single line from x1,y1 to x2,y2
- """
- self.draw_lines(gc, npy.array([x1, x2]), npy.array([y1, y2]))
-
- def draw_lines(self, gc, x, y):
- """
- x and y are equal length arrays, draw lines connecting each
- point in x, y
- """
-
- x = x.astype(npy.int16)
- y = self.height*npy.ones(y.shape, npy.int16) - y.astype(npy.int16)
- style = self._set_gd_style(gc)
- self.im.lines( zip(x,y), style)
- self.flush_clip()
-
- def draw_point(self, gc, x, y):
- """
- Draw a single point at x,y
- """
- self.im.setPixel((int(x),self.height-int(y)),
- self.get_gd_color( gc.get_rgb() ))
- self.flush_clip()
-
-
-
- def draw_polygon(self, gc, rgbFace, points):
- """
- Draw a polygon. points is a len vertices tuple, each element
- giving the x,y coords a vertex
- """
-
- edgecolor = self.get_gd_color( gc.get_rgb() )
-
- points = [(int(x), self.height-int(y)) for x,y in points]
-
-
- if rgbFace is not None:
- facecolor = self.get_gd_color( rgbFace )
- self.im.filledPolygon(points, facecolor)
- else: facecolor = None
- if edgecolor != facecolor:
- self.im.polygon(points, edgecolor)
- self.flush_clip()
-
- def draw_rectangle(self, gc, rgbFace, x, y, width, height):
- """
- Draw a rectangle at lower left x,y with width and height
- If filled=True, fill the rectangle with the gc foreground
- gc is a GraphicsContext instance
- """
-
- lb = int(x), self.height-int(y)
- ur = int(x+width), self.height-int((y+height))
- edgecolor = self.get_gd_color( gc.get_rgb() )
-
- if rgbFace is not None:
- facecolor = self.get_gd_color( rgbFace )
- self.im.filledRectangle(ur, lb, facecolor)
- else: facecolor = None
-
- if edgecolor != facecolor:
- self.im.rectangle(ur, lb, edgecolor)
- self.flush_clip()
-
- def draw_text(self, gc, x, y, s, prop, angle, ismath):
- """
- Render the text using the RendererGD instance
- """
-
- size = prop.get_size_in_points()
- font = findfont(prop)
-
- x = int(x)
- y = int(y)
-
- color = self.get_gd_color( gc.get_rgb() )
-
- angle *= math.pi/180.0
-
- scale = self.get_text_scale()
- self.im.string_ft(font, scale*size, angle,
- (x, y), s, color)
- self.flush_clip()
-
- def finish(self):
- pass
- #self.im.writePng( file('xx.png', 'w') )
-
-
- def flush_clip(self):
- imw, imh = self.im.size()
- lb = 0, 0
- ur = imw, imh
- self.im.setClip(ur, lb)
-
-
- def get_gd_color(self, rgb):
- """
- RGB is a unit RGB tuple, return a gd color
- """
-
- r,g,b = rgb
- rgbi = (int(r*255),int(g*255),int(b*255))
-
- try: return self._cached[rgbi]
- except KeyError: pass
-
- color = self.im.colorAllocate( rgbi )
-
- if color==-1:
- warnings.warn('Unable to allocate color %1.3f, %1.3f, %1.3f; using nearest neighbor' % rgb)
- color = self.im.colorClosest(rgbi)
-
- self._cached[rgbi] = color
- return color
-
-
-
-
- def get_text_scale(self):
- """
- Return the scale factor for fontsize taking screendpi and pixels per
- inch into account
- """
- return self.dpi.get()/PIXELS_PER_INCH
-
- def new_gc(self):
- """
- Return an instance of a GraphicsContextGD
- """
- return GraphicsContextGD( self.im, self )
-
- def _set_gd_style(self, gc):
- color = self.get_gd_color( gc.get_rgb() )
- offset, dashes = gc.get_dashes()
-
- if dashes is not None:
- pixels = self.points_to_pixels(dashes)
- style = []
- for on, off in pieces(pixels):
- if on<1: on = 1
- else: on = round(on)
- if off<1: off = 1
- else: off = round(off)
-
- style.extend([color]*on)
- style.extend([gd.gdTransparent]*off)
- self.im.setStyle(style)
- return gd.gdStyled
- else:
- if gc.get_antialiased():
- self.im.setAntiAliased(color)
- return gd.gdAntiAliased
- else:
- self.im.setStyle([color])
- return gd.gdStyled
-
-
- def points_to_pixels(self, points):
- """
- convert point measures to pixes using dpi and the pixels per
- inch of the display
- """
- return npy.asarray(points)*(PIXELS_PER_INCH/72.0*self.dpi.get()/72.0)
-
-
-class GraphicsContextGD(GraphicsContextBase):
- """
- The graphics context provides the color, line styles, etc... See
- the gtk and postscript backends for examples of mapping the
- graphics context attributes (cap styles, join styles, line widths,
- colors) to a particular backend. """
- def __init__(self, im, renderer):
- """
- Initialize with a gd image
- """
- GraphicsContextBase.__init__(self)
- self.im = im
- self.renderer = renderer
-
-
- def set_clip_rectangle(self, rectangle):
- GraphicsContextBase.set_clip_rectangle(self, rectangle)
- x,y,w,h = rectangle
- imw, imh = self.im.size()
- lb = int(x), imh-int(y)
- ur = int(x+w), imh-int(y+h)
- self.im.setClip(ur, lb)
-
- def set_linestyle(self, style):
- GraphicsContextBase.set_linestyle(self, style)
- offset, dashes = self.dashd[style]
- self.set_dashes(offset, dashes)
-
- def set_linewidth(self, lw):
- GraphicsContextBase.set_linewidth(self, lw)
- pixels = self.renderer.points_to_pixels(lw)
- if pixels<1: pixels = 1
- else: pixels = round(pixels)
- self.im.setThickness(pixels)
-
-########################################################################
-#
-# The following functions and classes are for matlab compatibility
-# mode (pylab) and implement figure managers, etc...
-#
-########################################################################
-
-
-def new_figure_manager(num, *args, **kwargs):
- """
- Add a new figure num (default autoincrement). For GUI
- backends, you'll need to instantiate a new window and embed
- the figure in it.
- """
- FigureClass = kwargs.pop('FigureClass', Figure)
- thisFig = FigureClass(*args, **kwargs)
- canvas = FigureCanvasGD(thisFig)
- manager = FigureManagerGD(canvas, num)
- return manager
-
-
-class FigureCanvasGD(FigureCanvasBase):
- filetypes = {'PNG': 'Portable Network Graphics'}
-
- def print_png(self, filename, *args, **kwargs):
- im = self.draw()
- im.writePng(filename)
- 
- def get_default_filetype(self):
- return 'png'
- 
- def draw(self):
- """
- Draw to a gd image and return the image instance
-
- """
-
- left, bottom, width, height = self.figure.bbox.get_bounds()
- im = gd.image((int(width), int(height)))
-
- if not hasattr(im, 'setAntiAliased'):
- raise RuntimeError('gd_requirements_failed')
- renderer = RendererGD(im, self.figure.dpi)
- self.figure.draw(renderer)
- renderer.finish()
-
- return im
-
-class FigureManagerGD(FigureManagerBase):
- """
- This class manages all the figures for matlab mode
- """
- pass
-
-
-
-########################################################################
-#
-# Now just provide the standard names that backend.__init__ is expecting
-#
-########################################################################
-
-FigureManager = FigureManagerGD
-
-
Deleted: trunk/matplotlib/lib/matplotlib/backends/backend_paint.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_paint.py	2007年09月07日 20:43:20 UTC (rev 3816)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_paint.py	2007年09月08日 23:53:06 UTC (rev 3817)
@@ -1,281 +0,0 @@
-"""
-This ia a paint (libart) backend
-
-You can select it as a backend with
-
- import matplotlib
- matplotlib.use('Paint')
-
-REQUIREMENTS
-
- backend_paint requires pypaint-0.??, which in turn requires
- libart and freetype1
-"""
-
-from __future__ import division
-import sys
-import os
-import paint
-
-import numpy as npy
-
-from matplotlib import verbose
-
-from matplotlib._pylab_helpers import Gcf
-from matplotlib.backend_bases import RendererBase,\
- GraphicsContextBase, FigureCanvasBase, FigureManagerBase
-from matplotlib.cbook import enumerate
-from matplotlib.figure import Figure
-from matplotlib.text import Text, _process_text_args
-
-from matplotlib.font_manager import findfont
-
-"""
-
- * added dpi instance to renderer so drawing could scale with dpi
-
- * added dash path - JDH
-
- * reversed the order of fill and stroke for rectangle, arc and
- polygon so edge color would be visible
-
- * adjusted circle centers
-
-"""
-
-
-
-
-
-#paint/font.c defined dpi as 96
-PIXELS_PER_INCH = 96 # a constant used to scale text with dpi
-
-
-class RendererPaint(RendererBase):
- """
- The renderer handles all the drawing primitives using a graphics
- context instance that controls the colors/styles
- """
-
- fontd = {} # cache paint font instances
-
- def __init__(self, width, height, dpi):
- """creates a new image"""
- w, h = int(width), int(height)
- self.image = paint.image(w, h)
- self.width, self.height = w, h
- self.dpi = dpi # for scaling dashes, linewidths
-
- def get_canvas_width_height(self):
- 'return the canvas width and height in display coords'
- return self.width, self.height
-
- def get_text_width_height(self, s, prop, ismath):
- """
- get the width and height in display coords of the string s
- with fontsize in points
- """
- font = self._get_paint_font(s, prop, 0.0)
- return font.textsize(s)
-
- def flipy(self):
- 'return true if y small numbers are top for renderer'
- return True
-
-
- def get_text_scale(self):
- """
- Return the scale factor for fontsize taking screendpi and pixels per
- inch into account
- """
- return self.dpi.get()/PIXELS_PER_INCH
-
-
-
- def draw_text(self, gc, x, y, s, prop, angle, ismath):
- """
- Render the text using the RendererPaint instance
- """
- font = self._get_paint_font(s, prop, angle)
-
- text_color = self.get_paint_color(gc.get_rgb())
- self.image.text(font, x, y, text_color, s)
-
- def _get_paint_font(self, s, prop, angle):
- """
- Get the paint font for text instance t, cacheing for efficiency
- """
-
- fname = findfont(prop)
- size = self.get_text_scale() * prop.get_size_in_points()
-
- props = fname, size, angle
-
- font = self.fontd.get(props)
- if font is None:
- font = paint.font(*props)
- self.fontd[props] = font
- return font
-
- def get_paint_color(self, rgb):
- """returns a paint color object based on the given rgb tuple"""
- r,g,b = rgb
- return paint.rgb(int(r*255),int(g*255),int(b*255))
-
- def draw_arc(self, gcEdge, rgbFace, x, y, width, height, angle1, angle2, rotation):
- """
- Draw an arc centered at x,y with width and height and angles
- from 0.0 to 360.0.
-
- If rgbFace is not None, fill the rectangle with it. gcEdge
- is a GraphicsContext instance
- """
- arc = paint.arc(x-0.5*width, self.height - (y-0.5*height),
- x+0.5*width, self.height - (y+0.5*height),
- angle1, angle2)
- if rgbFace:
- self.image.fill(arc, self.get_paint_color(rgbFace))
- self.image.stroke(arc, self.get_paint_color(gcEdge.get_rgb()),
- self.points_to_pixels(gcEdge.get_linewidth()))
-
-
- def draw_line(self, gc, x1, y1, x2, y2):
- """
- Draw a single line from x1,y1 to x2,y2
- """
- path = paint.line(x1, self.height - y1, x2, self.height - y2)
- path = self.dash_path(gc, path)
- self.image.stroke(path, \
- self.get_paint_color(gc.get_rgb()),
- self.points_to_pixels(gc.get_linewidth()))
-
-
- def dash_path(self, gc, path):
- """
- Add dashes to the path and return it if dashes are set
- """
- offset, dashes = gc.get_dashes()
- if dashes is not None:
-
- dashes = tuple(self.points_to_pixels(npy.asarray(dashes)))
- return path.dash(offset, dashes)
- else:
- return path
-
- def draw_lines(self, gc, x, y):
- """
- x and y are equal length arrays, draw lines connecting each
- point in x, y
- """
- assert(len(x)==len(y))
- # faster as a list comp
-
- path = [(paint.MOVETO, x[0], self.height-y[0])]
- path.extend( [ (paint.LINETO, x[i], self.height-y[i]) for i in range(1, len(x))])
-
- path = self.dash_path(gc, paint.make_path(path))
- self.image.stroke(path,
- self.get_paint_color(gc.get_rgb()),
- self.points_to_pixels(gc.get_linewidth()))
-
-
- def draw_polygon(self, gcEdge, rgbFace, points):
- """
- Draw a polygon. points is a len vertices tuple, each element
- giving the x,y coords a vertex.
-
- If rgbFace is not None, fill the rectangle with it. gcEdge
- is a GraphicsContext instance
- """
- x = [p[0] for p in points]
- y = [p[1] for p in points]
- path = [(paint.MOVETO, x[0], self.height - y[0])]
- for i in range(len(x)-1):
- path.append((paint.LINETO, x[i+1], self.height - y[i+1]))
- path.append((paint.LINETO, x[0], self.height - y[0]))
- path = paint.make_path(path)
-
- if rgbFace:
- self.image.fill(path, self.get_paint_color(rgbFace))
- self.image.stroke(path,
- self.get_paint_color(gcEdge.get_rgb()),
- self.points_to_pixels(gcEdge.get_linewidth()))
- def draw_rectangle(self, gcEdge, rgbFace, x, y, width, height):
- """
- Draw a rectangle at lower left x,y with width and height.
-
- If rgbFace is not None, fill the rectangle with it. gcEdge
- is a GraphicsContext instance
- """
- path = paint.rect(x, self.height - y, x+width, self.height - (y+height))
-
- if rgbFace:
- self.image.fill(path, self.get_paint_color(rgbFace))
- self.image.stroke(path,
- self.get_paint_color(gcEdge.get_rgb()),
- self.points_to_pixels(gcEdge.get_linewidth()))
-
- def draw_point(self, gc, x, y):
- """
- Draw a single point at x,y
- """
- self.image.stroke(
- paint.line(x, self.height - y, x, self.height - y),
- self.get_paint_color(gc.get_rgb()),
- self.points_to_pixels(gc.get_linewidth()))
-
- def points_to_pixels(self, points):
- return points*(PIXELS_PER_INCH/72.0*self.dpi.get()/72.0)
-
-
-
-class FigureCanvasPaint(FigureCanvasBase):
-
- def draw(self):
- """
- Render the figure using RendererPaint instance renderer
- """
- t1,t2,width,height = self.figure.bbox.get_bounds()
- renderer = RendererPaint(width,height, self.figure.dpi)
- self.figure.draw(renderer)
- return renderer
-
- filetypes = {'png': 'Portable Network Graphics'}
- 
- def print_png(self, filename, *args, **kwargs):
- renderer = self.draw()
- renderer.image.write_png(filename)
-
- def get_default_filetype(self):
- return 'png'
-
-########################################################################
-#
-# The following functions and classes are for matlab compatibility
-# mode (pylab) and implement window/figure managers,
-# etc...
-#
-########################################################################
-
-
-def new_figure_manager_paint(num, *args, **kwargs):
- """
- Add a new figure num (default autoincrement). For GUI
- backends, you'll need to instantiate a new window and embed
- the figure in it.
- """
- FigureClass = kwargs.pop('FigureClass', Figure)
- thisFig = FigureClass(*args, **kwargs)
- canvas = FigureCanvasPaint(thisFig)
- manager = FigureManagerBase(canvas, num)
- return manager
-
-
-########################################################################
-#
-# Now just provide the standard names that backend.__init__ is expecting
-#
-########################################################################
-new_figure_manager = new_figure_manager_paint
-
-
Modified: trunk/matplotlib/setupext.py
===================================================================
--- trunk/matplotlib/setupext.py	2007年09月07日 20:43:20 UTC (rev 3816)
+++ trunk/matplotlib/setupext.py	2007年09月08日 23:53:06 UTC (rev 3817)
@@ -130,7 +130,7 @@
 def print_line(*args, **kwargs):
 pass
 print_status = print_message = print_raw = print_line
- 
+
 class CleanUpFile:
 """CleanUpFile deletes the specified filename when self is destroyed."""
 def __init__(self, name):
@@ -174,7 +174,7 @@
 has_pkgconfig.cache = (status == 0)
 return has_pkgconfig.cache
 has_pkgconfig.cache = None
- 
+
 def get_pkgconfig(module,
 packages,
 flags="--libs --cflags",
@@ -189,7 +189,7 @@
 '-l': 'libraries',
 '-D': 'define_macros',
 '-U': 'undef_macros'}
- 
+
 status, output = commands.getstatusoutput(
 "%s %s %s" % (pkg_config_exec, flags, packages))
 if status == 0:
@@ -247,7 +247,7 @@
 ", ".join(["'%s'" % x for x in module.include_dirs]))
 
 return True
- 
+
 def check_for_libpng():
 module = Extension("test", [])
 get_pkgconfig(module, 'libpng')
@@ -260,7 +260,7 @@
 ", ".join(["'%s'" % x for x in module.include_dirs]))
 
 return True
- 
+
 def add_base_flags(module):
 incdirs = filter(os.path.exists,
 [os.path.join(p, 'include') for p in basedir[sys.platform] ])
@@ -318,7 +318,7 @@
 return False
 else:
 print_status("Cairo", cairo.version)
- 
+
 def check_for_numpy():
 gotit = False
 try:
@@ -357,16 +357,12 @@
 # put these later for correct link order
 module.libraries.extend(std_libs)
 
-def add_gd_flags(module):
- 'Add the module flags to build extensions which use gd'
- module.libraries.append('gd')
-
 def add_ft2font_flags(module):
 'Add the module flags to ft2font extension'
 if not get_pkgconfig(module, 'freetype2'):
 module.libraries.extend(['freetype', 'z'])
 add_base_flags(module)
- 
+
 basedirs = module.include_dirs[:] # copy the list to avoid inf loop!
 for d in basedirs:
 module.include_dirs.append(os.path.join(d, 'freetype2'))
@@ -381,7 +377,7 @@
 if os.path.exists(p): module.library_dirs.append(p)
 else:
 add_base_flags(module)
- 
+
 if sys.platform == 'win32' and win32_compiler == 'mingw32':
 module.libraries.append('gw32c')
 
@@ -417,7 +413,7 @@
 
 def ver2str(tup):
 return ".".join([str(x) for x in tup])
- 
+
 if gotit:
 import gobject
 if hasattr(gobject, 'pygobject_version'):
@@ -432,7 +428,7 @@
 
 if explanation is not None:
 print_message(explanation)
- 
+
 return gotit
 
 def add_pygtk_flags(module):
@@ -459,26 +455,26 @@
 ])
 
 add_base_flags(module)
- 
+
 if not os.environ.has_key('PKG_CONFIG_PATH'):
 # If Gtk+ is installed, pkg-config is required to be installed
 os.environ['PKG_CONFIG_PATH'] = 'C:\GTK\lib\pkgconfig'
- 
- pygtkIncludes = getoutput('pkg-config --cflags-only-I pygtk-2.0').split() 
- gtkIncludes = getoutput('pkg-config --cflags-only-I gtk+-2.0').split() 
- includes = pygtkIncludes + gtkIncludes 
- module.include_dirs.extend([include[2:] for include in includes]) 
- 
- pygtkLinker = getoutput('pkg-config --libs pygtk-2.0').split() 
- gtkLinker = getoutput('pkg-config --libs gtk+-2.0').split() 
+
+ pygtkIncludes = getoutput('pkg-config --cflags-only-I pygtk-2.0').split()
+ gtkIncludes = getoutput('pkg-config --cflags-only-I gtk+-2.0').split()
+ includes = pygtkIncludes + gtkIncludes
+ module.include_dirs.extend([include[2:] for include in includes])
+
+ pygtkLinker = getoutput('pkg-config --libs pygtk-2.0').split()
+ gtkLinker = getoutput('pkg-config --libs gtk+-2.0').split()
 linkerFlags = pygtkLinker + gtkLinker
- 
+
 module.libraries.extend(
 [flag[2:] for flag in linkerFlags if flag.startswith('-l')])
- 
+
 module.library_dirs.extend(
 [flag[2:] for flag in linkerFlags if flag.startswith('-L')])
- 
+
 module.extra_link_args.extend(
 [flag for flag in linkerFlags if not
 (flag.startswith('-l') or flag.startswith('-L'))])
@@ -544,7 +540,7 @@
 if explanation is not None:
 print_message(explanation)
 return gotit
- 
+
 def find_wx_config():
 """If the WX_CONFIG environment variable has been set, returns it value.
 Otherwise, search for `wx-config' in the PATH directories and return the
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jo...@us...> - 2007年09月07日 20:43:22
Revision: 3816
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3816&view=rev
Author: jouni
Date: 2007年09月07日 13:43:20 -0700 (2007年9月07日)
Log Message:
-----------
Return widths of glyphs to caller
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/dviread.py
Modified: trunk/matplotlib/lib/matplotlib/dviread.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/dviread.py	2007年09月07日 20:28:01 UTC (rev 3815)
+++ trunk/matplotlib/lib/matplotlib/dviread.py	2007年09月07日 20:43:20 UTC (rev 3816)
@@ -8,7 +8,7 @@
 dvi = Dvi(filename, 72)
 for text, boxes in dvi: # iterate over pages
 text, boxes = dvi.output(72)
- for x,y,font,glyph in text:
+ for x,y,font,glyph,width in text:
 fontname, pointsize = dvi.fontinfo(font)
 ...
 for x,y,height,width in boxes:
@@ -48,7 +48,7 @@
 Iterate through the pages of the file.
 
 Returns (text, pages) pairs, where:
- text is a list of (x, y, fontnum, glyphnum) tuples
+ text is a list of (x, y, fontnum, glyphnum, width) tuples
 boxes is a list of (x, y, height, width) tuples
 
 The coordinates are transformed into a standard Cartesian
@@ -78,13 +78,14 @@
 """
 t0 = self.text[0]
 minx, miny, maxx, maxy = t0[0], t0[1], t0[0], t0[1]
- for x,y,_,_ in self.text + self.boxes:
+ for elt in self.text + self.boxes:
+ x,y = elt[:2]
 if x < minx: minx = x
 if y < miny: miny = y
 if x > maxx: maxx = x
 if y > maxy: maxy = y
 d = self.dpi / (72.27 * 2**16) # from TeX's "scaled points" to dpi units
- text = [ ((x-minx)*d, (maxy-y)*d, f, g) for (x,y,f,g) in self.text ]
+ text = [ ((x-minx)*d, (maxy-y)*d, f, g, w*d) for (x,y,f,g,w) in self.text ]
 boxes = [ ((x-minx)*d, (maxy-y)*d, h*d, w*d) for (x,y,h,w) in self.boxes ]
 return text, boxes
 
@@ -219,14 +220,17 @@
 # I think we can assume this is constant
 self.state = _dvistate.outer
 
+ def _width_of(self, char):
+ font = self.fonts[self.f]
+ width = font.tfm.width[char]
+ width = (width * font.scale) >> 20
+ return width
+
 def _set_char(self, char):
 if self.state != _dvistate.inpage:
 raise ValueError, "misplaced set_char in dvi file"
 self._put_char(char)
- font = self.fonts[self.f]
- width = font.tfm.width[char]
- width = (width * font.scale) >> 20
- self.h += width
+ self.h += self._width_of(char)
 
 def _set_rule(self, a, b):
 if self.state != _dvistate.inpage:
@@ -237,7 +241,7 @@
 def _put_char(self, char):
 if self.state != _dvistate.inpage:
 raise ValueError, "misplaced put_char in dvi file"
- self.text.append((self.h, self.v, self.f, char))
+ self.text.append((self.h, self.v, self.f, char, self._width_of(char)))
 
 def _put_rule(self, a, b):
 if self.state != _dvistate.inpage:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年09月07日 20:28:04
Revision: 3815
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3815&view=rev
Author: mdboom
Date: 2007年09月07日 13:28:01 -0700 (2007年9月07日)
Log Message:
-----------
Support characters composed of multiple characters. Only one
supported at the moment is AA (angstrom).
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/mathtext.py
Modified: trunk/matplotlib/lib/matplotlib/mathtext.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mathtext.py	2007年09月07日 19:45:48 UTC (rev 3814)
+++ trunk/matplotlib/lib/matplotlib/mathtext.py	2007年09月07日 20:28:01 UTC (rev 3815)
@@ -153,13 +153,6 @@
 ####################
 
 
-# a character over another character
-charOverChars = {
- # The first 2 entires in the tuple are (font, char, sizescale) for
- # the two symbols under and over. The third entry is the space
- # between the two symbols in points
- r'\angstrom' : ( ('rm', 'A', 1.0), (None, '\circ', 0.5), 0.0 ),
- }
 
 ##############################################################################
 # FONTS
@@ -1771,7 +1764,7 @@
 
 def Error(msg):
 def raise_error(s, loc, toks):
- raise ParseFatalException(msg)
+ raise ParseFatalException(msg + "\n" + s)
 
 empty = Empty()
 empty.setParseAction(raise_error)
@@ -1854,8 +1847,7 @@
 
 bslash = Literal('\\')
 
- accent = oneOf("hat check dot breve acute ddot grave tilde bar "
- "vec \" ` ' ~ . ^ widehat widetilde")
+ accent = oneOf(self._accent_map.keys() + list(self._wide_accents))
 
 function = oneOf("arccos csc ker min arcsin deg lg Pr arctan det "
 "lim sec arg dim liminf sin cos exp limsup sinh "
@@ -1890,8 +1882,13 @@
 )
 ).setParseAction(self.symbol).leaveWhitespace()
 
+ c_over_c =(Suppress(bslash)
+ + oneOf(self._char_over_chars.keys())
+ ).setParseAction(self.char_over_chars)
+ 
 accent = Group(
- Combine(bslash + accent)
+ Suppress(bslash)
+ + accent
 + placeable
 ).setParseAction(self.accent).setName("accent")
 
@@ -1930,7 +1927,7 @@
 Suppress(Literal("["))
 + Group(
 OneOrMore(
- symbol
+ (c_over_c | symbol)
 ^ font
 )
 )
@@ -1942,7 +1939,7 @@
 
 placeable <<(accent
 ^ function
- ^ symbol
+ ^ (c_over_c | symbol)
 ^ group
 ^ frac
 ^ sqrt
@@ -2120,25 +2117,69 @@
 do_kern = False)]
 return [char]
 
+ _char_over_chars = {
+ # The first 2 entires in the tuple are (font, char, sizescale) for
+ # the two symbols under and over. The third element is the space
+ # (in multiples of underline height)
+ r'AA' : ( ('rm', 'A', 1.0), (None, '\circ', 0.5), 0.0),
+ }
+ 
+ def char_over_chars(self, s, loc, toks):
+ sym = toks[0]
+ state = self.get_state()
+ thickness = state.font_output.get_underline_thickness(
+ state.font, state.fontsize, state.dpi)
+
+ under_desc, over_desc, space = \
+ self._char_over_chars.get(sym, (None, None, 0.0))
+ if under_desc is None:
+ raise ParseFatalException("Error parsing symbol")
+ 
+ over_state = state.copy()
+ if over_desc[0] is not None:
+ over_state.font = over_desc[0]
+ over_state.fontsize *= over_desc[2]
+ over = Accent(over_desc[1], over_state)
+
+ under_state = state.copy()
+ if under_desc[0] is not None:
+ under_state.font = under_desc[0]
+ under_state.fontsize *= under_desc[2]
+ under = Char(under_desc[1], under_state)
+
+ width = max(over.width, under.width)
+ 
+ over_centered = HCentered([over])
+ over_centered.hpack(width, 'exactly')
+
+ under_centered = HCentered([under])
+ under_centered.hpack(width, 'exactly')
+ 
+ return Vlist([
+ over_centered,
+ Vbox(0., thickness * space),
+ under_centered
+ ])
+ 
 _accent_map = {
- r'\hat' : r'\circumflexaccent',
- r'\breve' : r'\combiningbreve',
- r'\bar' : r'\combiningoverline',
- r'\grave' : r'\combininggraveaccent',
- r'\acute' : r'\combiningacuteaccent',
- r'\ddot' : r'\combiningdiaeresis',
- r'\tilde' : r'\combiningtilde',
- r'\dot' : r'\combiningdotabove',
- r'\vec' : r'\combiningrightarrowabove',
- r'\"' : r'\combiningdiaeresis',
- r"\`" : r'\combininggraveaccent',
- r"\'" : r'\combiningacuteaccent',
- r'\~' : r'\combiningtilde',
- r'\.' : r'\combiningdotabove',
- r'\^' : r'\circumflexaccent'
+ r'hat' : r'\circumflexaccent',
+ r'breve' : r'\combiningbreve',
+ r'bar' : r'\combiningoverline',
+ r'grave' : r'\combininggraveaccent',
+ r'acute' : r'\combiningacuteaccent',
+ r'ddot' : r'\combiningdiaeresis',
+ r'tilde' : r'\combiningtilde',
+ r'dot' : r'\combiningdotabove',
+ r'vec' : r'\combiningrightarrowabove',
+ r'"' : r'\combiningdiaeresis',
+ r"`" : r'\combininggraveaccent',
+ r"'" : r'\combiningacuteaccent',
+ r'~' : r'\combiningtilde',
+ r'.' : r'\combiningdotabove',
+ r'^' : r'\circumflexaccent'
 }
 
- _wide_accents = Set(r"\widehat \widetilde".split())
+ _wide_accents = Set(r"widehat widetilde".split())
 
 def accent(self, s, loc, toks):
 assert(len(toks)==1)
@@ -2150,7 +2191,7 @@
 accent, sym = toks[0]
 if accent in self._wide_accents:
 accent = AutoWidthChar(
- accent, sym.width, state, char_class=Accent)
+ '\\' + accent, sym.width, state, char_class=Accent)
 else:
 accent = Accent(self._accent_map[accent], state)
 centered = HCentered([accent])
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 3814
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3814&view=rev
Author: jouni
Date: 2007年09月07日 12:45:48 -0700 (2007年9月07日)
Log Message:
-----------
In backend_pdf usetex, gather consecutive characters with same x
coordinate and same font into strings.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py	2007年09月07日 18:53:51 UTC (rev 3813)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py	2007年09月07日 19:45:48 UTC (rev 3814)
@@ -1435,6 +1435,7 @@
 dvifile = texmanager.make_dvi(s, fontsize)
 dvi = dviread.Dvi(dvifile, 72)
 text, boxes = iter(dvi).next()
+ dvi.close()
 
 if angle == 0: # avoid rounding errors in common case
 def mytrans(x1, y1):
@@ -1444,10 +1445,10 @@
 return x + cos(a)*x1 - sin(a)*y1, \
 y + sin(a)*x1 + cos(a)*y1
 
- self.check_gc(gc, gc._rgb)
- self.file.output(Op.begin_text)
- oldfontnum, oldx, oldy = None, 0, 0
- for x1, y1, fontnum, glyph in text:
+ # Gather font information and do some setup for combining
+ # characters into strings.
+ oldfontnum, seq = None, []
+ for x1, y1, fontnum, glyph, width in text:
 if fontnum != oldfontnum:
 texname, fontsize = dvi.fontinfo(fontnum)
 fontinfo = self.tex_font_mapping(texname)
@@ -1455,14 +1456,50 @@
 self.file.fontInfo[pdfname] = Bunch(
 encodingfile=fontinfo.encoding,
 afmfile=fontinfo.afm)
- self.file.output(pdfname, fontsize, Op.selectfont)
+ seq += [['font', pdfname, fontsize]]
 oldfontnum = fontnum
- x1, y1 = mytrans(x1, y1)
- self._setup_textpos(x1, y1, angle, oldx, oldy)
- self.file.output(chr(glyph), Op.show)
- oldx, oldy = x1, y1
+ seq += [['text', x1, y1, [chr(glyph)], x1+width]]
+ seq += [('end',)]
+
+ # Find consecutive text strings with constant x coordinate and
+ # combine into one string (if needed kern would be less than
+ # 0.1 points) or several strings interspersed with kerns.
+ i, curx = 0, 0
+ while i < len(seq)-1:
+ elt, next = seq[i:i+2]
+ if elt[0] == next[0] == 'text' and elt[2] == next[2]:
+ offset = elt[4] - next[1]
+ if abs(offset) < 0.1:
+ elt[3][-1] += next[3][0]
+ elt[4] += next[4]-next[1]
+ else:
+ elt[3] += [offset, next[3][0]]
+ elt[4] = next[4]
+ del seq[i+1]
+ continue
+ i += 1
+
+ # Now do the actual output.
+ self.check_gc(gc, gc._rgb)
+ self.file.output(Op.begin_text)
+ curx, cury, oldx, oldy = 0, 0, 0, 0
+ for elt in seq:
+ if elt[0] == 'font':
+ self.file.output(elt[1], elt[2], Op.selectfont)
+ elif elt[0] == 'text':
+ curx, cury = mytrans(elt[1], elt[2])
+ self._setup_textpos(curx, cury, angle, oldx, oldy)
+ oldx, oldy = curx, cury
+ if len(elt[3]) == 1:
+ self.file.output(elt[3][0], Op.show)
+ else:
+ self.file.output(elt[3], Op.showkern)
+ else:
+ assert elt[0] == 'end'
 self.file.output(Op.end_text)
 
+ # Finally output the boxes (used for the variable-length lines
+ # in square roots and the like).
 boxgc = self.new_gc()
 boxgc.copy_properties(gc)
 boxgc.set_linewidth(0)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年09月07日 18:53:59
Revision: 3813
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3813&view=rev
Author: mdboom
Date: 2007年09月07日 11:53:51 -0700 (2007年9月07日)
Log Message:
-----------
Merged revisions 3810-3812 via svnmerge from 
http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib
........
 r3811 | mdboom | 2007年09月07日 14:07:43 -0400 (2007年9月07日) | 2 lines
 
 Note that .bmp is no longer an alias for .raw
........
 r3812 | mdboom | 2007年09月07日 14:08:43 -0400 (2007年9月07日) | 2 lines
 
 Turn svg.embed_char_paths on by default.
........
Modified Paths:
--------------
 branches/transforms/CHANGELOG
 branches/transforms/lib/matplotlib/config/mplconfig.py
 branches/transforms/lib/matplotlib/config/rcsetup.py
 branches/transforms/lib/matplotlib/rcsetup.py
 branches/transforms/matplotlibrc.template
Property Changed:
----------------
 branches/transforms/
Property changes on: branches/transforms
___________________________________________________________________
Name: svnmerge-integrated
 - /trunk/matplotlib:1-3809
 + /trunk/matplotlib:1-3812
Modified: branches/transforms/CHANGELOG
===================================================================
--- branches/transforms/CHANGELOG	2007年09月07日 18:08:43 UTC (rev 3812)
+++ branches/transforms/CHANGELOG	2007年09月07日 18:53:51 UTC (rev 3813)
@@ -1,3 +1,5 @@
+2007年09月06日 .bmp file format is now longer an alias for .raw
+
 2007年09月07日 Added clip path support to pdf backend. - JKS
 
 2007年09月06日 Fixed a bug in the embedding of Type 1 fonts in PDF.
Modified: branches/transforms/lib/matplotlib/config/mplconfig.py
===================================================================
--- branches/transforms/lib/matplotlib/config/mplconfig.py	2007年09月07日 18:08:43 UTC (rev 3812)
+++ branches/transforms/lib/matplotlib/config/mplconfig.py	2007年09月07日 18:53:51 UTC (rev 3813)
@@ -101,7 +101,7 @@
 class svg(TConfig):
 image_inline = T.true
 image_noscale = T.false
- embed_chars = T.false
+ embed_chars = T.true
 
 class lines(TConfig):
 linewidth = T.Float(1.0)
Modified: branches/transforms/lib/matplotlib/config/rcsetup.py
===================================================================
--- branches/transforms/lib/matplotlib/config/rcsetup.py	2007年09月07日 18:08:43 UTC (rev 3812)
+++ branches/transforms/lib/matplotlib/config/rcsetup.py	2007年09月07日 18:53:51 UTC (rev 3813)
@@ -466,7 +466,7 @@
 'pdf.fonttype' : [3, validate_fonttype], # 3 (Type3) or 42 (Truetype)
 'svg.image_inline' : [True, validate_bool], # write raster image data directly into the svg file
 'svg.image_noscale' : [False, validate_bool], # suppress scaling of raster data embedded in SVG
- 'svg.embed_char_paths' : [False, validate_bool], # True to save all characters as paths in the SVG
+ 'svg.embed_char_paths' : [True, validate_bool], # True to save all characters as paths in the SVG
 'plugins.directory' : ['.matplotlib_plugins', str], # where plugin directory is locate
 
 }
Modified: branches/transforms/lib/matplotlib/rcsetup.py
===================================================================
--- branches/transforms/lib/matplotlib/rcsetup.py	2007年09月07日 18:08:43 UTC (rev 3812)
+++ branches/transforms/lib/matplotlib/rcsetup.py	2007年09月07日 18:53:51 UTC (rev 3813)
@@ -466,7 +466,7 @@
 'pdf.fonttype' : [3, validate_fonttype], # 3 (Type3) or 42 (Truetype)
 'svg.image_inline' : [True, validate_bool], # write raster image data directly into the svg file
 'svg.image_noscale' : [False, validate_bool], # suppress scaling of raster data embedded in SVG
- 'svg.embed_char_paths' : [False, validate_bool], # True to save all characters as paths in the SVG
+ 'svg.embed_char_paths' : [True, validate_bool], # True to save all characters as paths in the SVG
 'plugins.directory' : ['.matplotlib_plugins', str], # where plugin directory is locate
 
 }
Modified: branches/transforms/matplotlibrc.template
===================================================================
--- branches/transforms/matplotlibrc.template	2007年09月07日 18:08:43 UTC (rev 3812)
+++ branches/transforms/matplotlibrc.template	2007年09月07日 18:53:51 UTC (rev 3813)
@@ -292,7 +292,7 @@
 # svg backend params
 #svg.image_inline : True # write raster image data directly into the svg file
 #svg.image_noscale : False # suppress scaling of raster data embedded in SVG
-#svg.embed_chars : False # embed character outlines in the SVG file
+#svg.embed_chars : True # embed character outlines in the SVG file
 
 # Set the verbose flags. This controls how much information
 # matplotlib gives you at runtime and where it goes. The verbosity
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年09月07日 18:08:44
Revision: 3812
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3812&view=rev
Author: mdboom
Date: 2007年09月07日 11:08:43 -0700 (2007年9月07日)
Log Message:
-----------
Turn svg.embed_char_paths on by default.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/config/mplconfig.py
 trunk/matplotlib/lib/matplotlib/config/rcsetup.py
 trunk/matplotlib/lib/matplotlib/rcsetup.py
 trunk/matplotlib/matplotlibrc.template
Modified: trunk/matplotlib/lib/matplotlib/config/mplconfig.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/mplconfig.py	2007年09月07日 18:07:43 UTC (rev 3811)
+++ trunk/matplotlib/lib/matplotlib/config/mplconfig.py	2007年09月07日 18:08:43 UTC (rev 3812)
@@ -101,7 +101,7 @@
 class svg(TConfig):
 image_inline = T.true
 image_noscale = T.false
- embed_chars = T.false
+ embed_chars = T.true
 
 class lines(TConfig):
 linewidth = T.Float(1.0)
Modified: trunk/matplotlib/lib/matplotlib/config/rcsetup.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/rcsetup.py	2007年09月07日 18:07:43 UTC (rev 3811)
+++ trunk/matplotlib/lib/matplotlib/config/rcsetup.py	2007年09月07日 18:08:43 UTC (rev 3812)
@@ -466,7 +466,7 @@
 'pdf.fonttype' : [3, validate_fonttype], # 3 (Type3) or 42 (Truetype)
 'svg.image_inline' : [True, validate_bool], # write raster image data directly into the svg file
 'svg.image_noscale' : [False, validate_bool], # suppress scaling of raster data embedded in SVG
- 'svg.embed_char_paths' : [False, validate_bool], # True to save all characters as paths in the SVG
+ 'svg.embed_char_paths' : [True, validate_bool], # True to save all characters as paths in the SVG
 'plugins.directory' : ['.matplotlib_plugins', str], # where plugin directory is locate
 
 }
Modified: trunk/matplotlib/lib/matplotlib/rcsetup.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/rcsetup.py	2007年09月07日 18:07:43 UTC (rev 3811)
+++ trunk/matplotlib/lib/matplotlib/rcsetup.py	2007年09月07日 18:08:43 UTC (rev 3812)
@@ -466,7 +466,7 @@
 'pdf.fonttype' : [3, validate_fonttype], # 3 (Type3) or 42 (Truetype)
 'svg.image_inline' : [True, validate_bool], # write raster image data directly into the svg file
 'svg.image_noscale' : [False, validate_bool], # suppress scaling of raster data embedded in SVG
- 'svg.embed_char_paths' : [False, validate_bool], # True to save all characters as paths in the SVG
+ 'svg.embed_char_paths' : [True, validate_bool], # True to save all characters as paths in the SVG
 'plugins.directory' : ['.matplotlib_plugins', str], # where plugin directory is locate
 
 }
Modified: trunk/matplotlib/matplotlibrc.template
===================================================================
--- trunk/matplotlib/matplotlibrc.template	2007年09月07日 18:07:43 UTC (rev 3811)
+++ trunk/matplotlib/matplotlibrc.template	2007年09月07日 18:08:43 UTC (rev 3812)
@@ -292,7 +292,7 @@
 # svg backend params
 #svg.image_inline : True # write raster image data directly into the svg file
 #svg.image_noscale : False # suppress scaling of raster data embedded in SVG
-#svg.embed_chars : False # embed character outlines in the SVG file
+#svg.embed_chars : True # embed character outlines in the SVG file
 
 # Set the verbose flags. This controls how much information
 # matplotlib gives you at runtime and where it goes. The verbosity
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年09月07日 18:07:44
Revision: 3811
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3811&view=rev
Author: mdboom
Date: 2007年09月07日 11:07:43 -0700 (2007年9月07日)
Log Message:
-----------
Note that .bmp is no longer an alias for .raw
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2007年09月07日 15:23:32 UTC (rev 3810)
+++ trunk/matplotlib/CHANGELOG	2007年09月07日 18:07:43 UTC (rev 3811)
@@ -1,3 +1,5 @@
+2007年09月06日 .bmp file format is now longer an alias for .raw
+
 2007年09月07日 Added clip path support to pdf backend. - JKS
 
 2007年09月06日 Fixed a bug in the embedding of Type 1 fonts in PDF.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年09月07日 15:23:34
Revision: 3810
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3810&view=rev
Author: mdboom
Date: 2007年09月07日 08:23:32 -0700 (2007年9月07日)
Log Message:
-----------
Merged revisions 3806-3809 via svnmerge from 
http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib
........
 r3807 | mdboom | 2007年09月07日 10:34:51 -0400 (2007年9月07日) | 2 lines
 
 Backout stylesheet optimization. Breaks on inkscape and Adobe SVG viewer.
........
 r3808 | mdboom | 2007年09月07日 10:55:55 -0400 (2007年9月07日) | 3 lines
 
 Fix embedded glyph rendering bug revealed by Inkscape and Safari (but
 not Firefox)
........
Modified Paths:
--------------
 branches/transforms/lib/matplotlib/backends/backend_svg.py
Property Changed:
----------------
 branches/transforms/
Property changes on: branches/transforms
___________________________________________________________________
Name: svnmerge-integrated
 - /trunk/matplotlib:1-3805
 + /trunk/matplotlib:1-3809
Modified: branches/transforms/lib/matplotlib/backends/backend_svg.py
===================================================================
--- branches/transforms/lib/matplotlib/backends/backend_svg.py	2007年09月07日 15:02:52 UTC (rev 3809)
+++ branches/transforms/lib/matplotlib/backends/backend_svg.py	2007年09月07日 15:23:32 UTC (rev 3810)
@@ -41,7 +41,6 @@
 self._char_defs = {}
 self.mathtext_parser = MathTextParser('SVG')
 self.fontd = {}
- self._styles = {}
 svgwriter.write(svgProlog%(width,height,width,height))
 
 def _draw_svg_element(self, element, details, gc, rgbFace):
@@ -51,10 +50,9 @@
 else:
 clippath = 'clip-path="url(#%s)"' % clipid
 
- style = self._map_style(self._get_style(gc, rgbFace))
- self._svgwriter.write ('%s<%s class="%s" %s %s/>\n' % (
- cliprect,
- element, style, clippath, details))
+ style = self._get_style(gc, rgbFace)
+ self._svgwriter.write ('%s<%s style="%s" %s %s/>\n' % (
+ cliprect, element, style, clippath, details))
 
 def _get_font(self, prop):
 key = hash(prop)
@@ -82,13 +80,13 @@
 if seq is None:
 dashes = ''
 else:
- dashes = 'stroke-dasharray: %s; stroke-dashoffset: %f;' % (
- ','.join(['%f'%val for val in seq]), offset)
+ dashes = 'stroke-dasharray: %s; stroke-dashoffset: %s;' % (
+ ','.join(['%s'%val for val in seq]), offset)
 
 linewidth = gc.get_linewidth()
 if linewidth:
- return 'fill: %s; stroke: %s; stroke-width: %f; ' \
- 'stroke-linejoin: %s; stroke-linecap: %s; %s opacity: %f' % (
+ return 'fill: %s; stroke: %s; stroke-width: %s; ' \
+ 'stroke-linejoin: %s; stroke-linecap: %s; %s opacity: %s' % (
 fill,
 rgb2hex(gc.get_rgb()),
 linewidth,
@@ -98,16 +96,11 @@
 gc.get_alpha(),
 )
 else:
- return 'fill: %s; opacity: %f' % (\
+ return 'fill: %s; opacity: %s' % (\
 fill,
 gc.get_alpha(),
 )
 
- def _map_style(self, style):
- return self._styles.setdefault(
- style,
- "_%x" % len(self._styles))
- 
 def _get_gc_clip_svg(self, gc):
 cliprect = gc.get_clip_rectangle()
 if cliprect is None:
@@ -119,12 +112,12 @@
 self._clipd[key] = cliprect
 x, y, w, h = cliprect
 y = self.height-(y+h)
- style = self._map_style("stroke: gray; fill: none;")
+ style = "stroke: gray; fill: none;"
 box = """\
 <defs>
 <clipPath id="%(key)s">
- <rect x="%(x)f" y="%(y)f" width="%(w)f" height="%(h)f"
- class="%(style)s"/>
+ <rect x="%(x)s" y="%(y)s" width="%(w)s" height="%(h)s"
+ style="%(style)s"/>
 </clipPath>
 </defs>
 """ % locals()
@@ -144,7 +137,7 @@
 """
 Ignores angles for now
 """
- details = 'cx="%f" cy="%f" rx="%f" ry="%f" transform="rotate(%f %f %f)"' % \
+ details = 'cx="%s" cy="%s" rx="%s" ry="%s" transform="rotate(%1.1f %s %s)"' % \
 (x, self.height-y, width/2.0, height/2.0, -rotation, x, self.height-y)
 self._draw_svg_element('ellipse', details, gc, rgbFace)
 
@@ -163,7 +156,7 @@
 trans[4] += trans[0]
 trans[5] += trans[3]
 trans[5] = -trans[5]
- transstr = 'transform="matrix(%f %f %f %f %f %f)" '%tuple(trans)
+ transstr = 'transform="matrix(%s %s %s %s %s %s)" '%tuple(trans)
 assert trans[1] == 0
 assert trans[2] == 0
 numrows,numcols = im.get_size()
@@ -207,12 +200,12 @@
 hrefstr = filename
 
 self._svgwriter.write (
- '<image x="%f" y="%f" width="%f" height="%f" '
+ '<image x="%s" y="%s" width="%s" height="%s" '
 'xlink:href="%s" %s/>\n'%(x/trans[0], (self.height-y)/trans[3]-h, w, h, hrefstr, transstr)
 )
 
 def draw_line(self, gc, x1, y1, x2, y2):
- details = 'd="M %f,%f L %f,%f"' % (x1, self.height-y1,
+ details = 'd="M%s,%sL%s,%s"' % (x1, self.height-y1,
 x2, self.height-y2)
 self._draw_svg_element('path', details, gc, None)
 
@@ -222,11 +215,11 @@
 raise ValueError('x and y must be the same length')
 
 y = self.height - y
- details = ['d="M %f,%f' % (x[0], y[0])]
+ details = ['d="M%s,%s' % (x[0], y[0])]
 xys = zip(x[1:], y[1:])
- details.extend(['L %f,%f' % tup for tup in xys])
+ details.extend(['L%s,%s' % tup for tup in xys])
 details.append('"')
- details = ' '.join(details)
+ details = ''.join(details)
 self._draw_svg_element('path', details, gc, None)
 
 def draw_point(self, gc, x, y):
@@ -234,12 +227,12 @@
 self.draw_arc(gc, gc.get_rgb(), x, y, 1, 0, 0, 0, 0)
 
 def draw_polygon(self, gc, rgbFace, points):
- details = 'points = "%s"' % ' '.join(['%f,%f'%(x,self.height-y)
+ details = 'points = "%s"' % ' '.join(['%s,%s'%(x,self.height-y)
 for x, y in points])
 self._draw_svg_element('polygon', details, gc, rgbFace)
 
 def draw_rectangle(self, gc, rgbFace, x, y, width, height):
- details = 'width="%f" height="%f" x="%f" y="%f"' % (width, height, x,
+ details = 'width="%s" height="%s" x="%s" y="%s"' % (width, height, x,
 self.height-y-height)
 self._draw_svg_element('rect', details, gc, rgbFace)
 
@@ -260,12 +253,11 @@
 
 if rcParams['svg.embed_char_paths']:
 svg = ['<g transform="']
- if angle!=0:
- # Inkscape doesn't support rotate(angle x y)
- svg.append('translate(%f,%f) rotate(%1.1f) ' % (x,y,-angle))
- else:
- svg.append('translate(%f,%f)' % (x,y))
- svg.append(' scale(%f)">\n' % (fontsize / self.FONT_SCALE))
+ if angle != 0:
+ svg.append('translate(%s,%s)rotate(%1.1f)' % (x,y,-angle))
+ elif x != 0 or y != 0:
+ svg.append('translate(%s,%s)' % (x, y))
+ svg.append('scale(%s)">\n' % (fontsize / self.FONT_SCALE))
 
 cmap = font.get_charmap()
 lastgind = None
@@ -286,21 +278,24 @@
 lastgind = gind
 currx += kern/64.0
 
- svg.append('<use xlink:href="#%s" transform="translate(%s)"/>\n'
- % (charid, currx * (self.FONT_SCALE / fontsize)))
-
+ svg.append('<use xlink:href="#%s"' % charid)
+ if currx != 0:
+ svg.append(' transform="translate(%s)"' %
+ (currx * (self.FONT_SCALE / fontsize)))
+ svg.append('/>\n')
 currx += (glyph.linearHoriAdvance / 65536.0)
 svg.append('</g>\n')
 svg = ''.join(svg)
 else:
 style = 'font-size: %f; font-family: %s; font-style: %s; fill: %s;'%(fontsize, fontfamily,fontstyle, color)
- style_number = self._map_style(style)
 if angle!=0:
- transform = 'transform="translate(%f,%f) rotate(%1.1f) translate(%f,%f)"' % (x,y,-angle,-x,-y) # Inkscape doesn't support rotate(angle x y)
- else: transform = ''
+ transform = 'transform="translate(%s,%s) rotate(%1.1f) translate(%s,%s)"' % (x,y,-angle,-x,-y)
+ # Inkscape doesn't support rotate(angle x y)
+ else:
+ transform = ''
 
 svg = """\
-<text class="%(style_number)s" x="%(x)f" y="%(y)f" %(transform)s>%(thetext)s</text>
+<text style="%(style)s" x="%(x)s" y="%(y)s" %(transform)s>%(thetext)s</text>
 """ % locals()
 self._svgwriter.write (svg)
 
@@ -313,16 +308,17 @@
 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:
- return char_id
+ char_num, path = self._char_defs.get(char_id, (None, None))
+ if char_num is not None:
+ return char_num
 
 path_data = []
 glyph = font.load_char(ord(char), flags=LOAD_NO_HINTING)
 currx, curry = 0.0, 0.0
 for step in glyph.path:
 if step[0] == 0: # MOVE_TO
- path_data.append("m%s %s" %
- (step[1] - currx, -step[2] - curry))
+ path_data.append("M%s %s" %
+ (step[1], -step[2]))
 elif step[0] == 1: # LINE_TO
 path_data.append("l%s %s" %
 (step[1] - currx, -step[2] - curry))
@@ -336,15 +332,16 @@
 step[3] - currx, -step[4] - curry,
 step[5] - currx, -step[6] - curry))
 elif step[0] == 4: # ENDPOLY
- path_data.append("Z")
+ path_data.append("z")
+ currx, curry = 0.0, 0.0
 
 if step[0] != 4:
 currx, curry = step[-2], -step[-1]
- path_element = '<path id="%s" d="%s"/>\n' % (char_id, " ".join(path_data))
+ char_num = 'c_%x' % len(self._char_defs)
+ path_element = '<path id="%s" d="%s"/>\n' % (char_num, ''.join(path_data))
+ self._char_defs[char_id] = (char_num, path_element)
+ return char_num
 
- self._char_defs[char_id] = path_element
- return char_id
-
 def _draw_mathtext(self, gc, x, y, s, prop, angle):
 """
 Draw math text using matplotlib.mathtext
@@ -358,25 +355,24 @@
 self.open_group("mathtext")
 
 style = "fill: %s" % color
- style_number = self._map_style(style)
 
 if rcParams['svg.embed_char_paths']:
- svg = ['<g class="%s" transform="' % style_number]
+ svg = ['<g style="%s" transform="' % style]
 if angle != 0:
- svg.append('translate(%f,%f) rotate(%1.1f)'
+ svg.append('translate(%s,%s)rotate(%1.1f)'
 % (x,y,-angle) )
 else:
- svg.append('translate(%f,%f)' % (x, y))
+ svg.append('translate(%s,%s)' % (x, y))
 svg.append('">\n')
 
 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' %
+ 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')
 else: # not rcParams['svg.embed_char_paths']
- svg = ['<text class="%s" x="%f" y="%f"' % (style_number, x, y)]
+ svg = ['<text style="%s" x="%f" y="%f"' % (style, x, y)]
 
 if angle != 0:
 svg.append(' transform="translate(%f,%f) rotate(%1.1f) translate(%f,%f)"'
@@ -388,19 +384,18 @@
 for font, fontsize, thetext, new_x, new_y_mtc, metrics in svg_glyphs:
 new_y = - new_y_mtc
 style = "font-size: %f; font-family: %s" % (fontsize, font.family_name)
- style_number = self._map_style(style)
 
- svg.append('<tspan class="%s"' % style_number)
+ svg.append('<tspan style="%s"' % style)
 xadvance = metrics.advance
- svg.append(' textLength="%f"' % xadvance)
+ svg.append(' textLength="%s"' % xadvance)
 
 dx = new_x - curr_x
 if dx != 0.0:
- svg.append(' dx="%f"' % dx)
+ svg.append(' dx="%s"' % dx)
 
 dy = new_y - curr_y
 if dy != 0.0:
- svg.append(' dy="%f"' % dy)
+ svg.append(' dy="%s"' % dy)
 
 thetext = escape_xml_text(thetext)
 
@@ -412,13 +407,13 @@
 svg.append('</text>\n')
 
 if len(svg_rects):
- style_number = self._map_style("fill: black; stroke: none")
- svg.append('<g class="%s" transform="' % style_number)
+ style = "fill: black; stroke: none"
+ svg.append('<g style="%s" transform="' % style)
 if angle != 0:
- svg.append('translate(%f,%f) rotate(%1.1f)'
+ svg.append('translate(%s,%s) rotate(%1.1f)'
 % (x,y,-angle) )
 else:
- svg.append('translate(%f,%f)' % (x, y))
+ svg.append('translate(%s,%s)' % (x, y))
 svg.append('">\n')
 
 for x, y, width, height in svg_rects:
@@ -432,16 +427,9 @@
 write = self._svgwriter.write
 if len(self._char_defs):
 write('<defs id="fontpaths">\n')
- for path in self._char_defs.values():
+ for char_num, path in self._char_defs.values():
 write(path)
 write('</defs>\n')
- if len(self._styles):
- write('<style type="text/css">\n')
- styles = self._styles.items()
- styles.sort()
- for style, number in styles:
- write('.%s { %s }\n' % (number, style))
- write('</style>\n')
 write('</svg>\n')
 
 def flipy(self):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年09月07日 15:02:56
Revision: 3809
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3809&view=rev
Author: mdboom
Date: 2007年09月07日 08:02:52 -0700 (2007年9月07日)
Log Message:
-----------
Initialized merge tracking via "svnmerge" with revisions "1-3805" from 
http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib
Property Changed:
----------------
 branches/transforms/
Property changes on: branches/transforms
___________________________________________________________________
Name: svnmerge-integrated
 + /trunk/matplotlib:1-3805
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 3808
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3808&view=rev
Author: mdboom
Date: 2007年09月07日 07:55:55 -0700 (2007年9月07日)
Log Message:
-----------
Fix embedded glyph rendering bug revealed by Inkscape and Safari (but
not Firefox)
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/backends/backend_svg.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_svg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_svg.py	2007年09月07日 14:34:51 UTC (rev 3807)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_svg.py	2007年09月07日 14:55:55 UTC (rev 3808)
@@ -317,8 +317,8 @@
 currx, curry = 0.0, 0.0
 for step in glyph.path:
 if step[0] == 0: # MOVE_TO
- path_data.append("m%s %s" %
- (step[1] - currx, -step[2] - curry))
+ path_data.append("M%s %s" %
+ (step[1], -step[2]))
 elif step[0] == 1: # LINE_TO
 path_data.append("l%s %s" %
 (step[1] - currx, -step[2] - curry))
@@ -332,7 +332,8 @@
 step[3] - currx, -step[4] - curry,
 step[5] - currx, -step[6] - curry))
 elif step[0] == 4: # ENDPOLY
- path_data.append("Z")
+ path_data.append("z")
+ currx, curry = 0.0, 0.0
 
 if step[0] != 4:
 currx, curry = step[-2], -step[-1]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 3807
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3807&view=rev
Author: mdboom
Date: 2007年09月07日 07:34:51 -0700 (2007年9月07日)
Log Message:
-----------
Backout stylesheet optimization. Breaks on inkscape and Adobe SVG viewer.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/backends/backend_svg.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_svg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_svg.py	2007年09月07日 14:04:36 UTC (rev 3806)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_svg.py	2007年09月07日 14:34:51 UTC (rev 3807)
@@ -41,7 +41,6 @@
 self._char_defs = {}
 self.mathtext_parser = MathTextParser('SVG')
 self.fontd = {}
- self._styles = {}
 svgwriter.write(svgProlog%(width,height,width,height))
 
 def _draw_svg_element(self, element, details, gc, rgbFace):
@@ -51,10 +50,9 @@
 else:
 clippath = 'clip-path="url(#%s)"' % clipid
 
- style = self._map_style(self._get_style(gc, rgbFace))
- self._svgwriter.write ('%s<%s class="%s" %s %s/>\n' % (
- cliprect,
- element, style, clippath, details))
+ style = self._get_style(gc, rgbFace)
+ self._svgwriter.write ('%s<%s style="%s" %s %s/>\n' % (
+ cliprect, element, style, clippath, details))
 
 def _get_font(self, prop):
 key = hash(prop)
@@ -82,13 +80,13 @@
 if seq is None:
 dashes = ''
 else:
- dashes = 'stroke-dasharray: %s; stroke-dashoffset: %f;' % (
- ','.join(['%f'%val for val in seq]), offset)
+ dashes = 'stroke-dasharray: %s; stroke-dashoffset: %s;' % (
+ ','.join(['%s'%val for val in seq]), offset)
 
 linewidth = gc.get_linewidth()
 if linewidth:
- return 'fill: %s; stroke: %s; stroke-width: %f; ' \
- 'stroke-linejoin: %s; stroke-linecap: %s; %s opacity: %f' % (
+ return 'fill: %s; stroke: %s; stroke-width: %s; ' \
+ 'stroke-linejoin: %s; stroke-linecap: %s; %s opacity: %s' % (
 fill,
 rgb2hex(gc.get_rgb()),
 linewidth,
@@ -98,16 +96,11 @@
 gc.get_alpha(),
 )
 else:
- return 'fill: %s; opacity: %f' % (\
+ return 'fill: %s; opacity: %s' % (\
 fill,
 gc.get_alpha(),
 )
 
- def _map_style(self, style):
- return self._styles.setdefault(
- style,
- "_%x" % len(self._styles))
- 
 def _get_gc_clip_svg(self, gc):
 cliprect = gc.get_clip_rectangle()
 if cliprect is None:
@@ -119,12 +112,12 @@
 self._clipd[key] = cliprect
 x, y, w, h = cliprect
 y = self.height-(y+h)
- style = self._map_style("stroke: gray; fill: none;")
+ style = "stroke: gray; fill: none;"
 box = """\
 <defs>
 <clipPath id="%(key)s">
- <rect x="%(x)f" y="%(y)f" width="%(w)f" height="%(h)f"
- class="%(style)s"/>
+ <rect x="%(x)s" y="%(y)s" width="%(w)s" height="%(h)s"
+ style="%(style)s"/>
 </clipPath>
 </defs>
 """ % locals()
@@ -144,7 +137,7 @@
 """
 Ignores angles for now
 """
- details = 'cx="%f" cy="%f" rx="%f" ry="%f" transform="rotate(%f %f %f)"' % \
+ details = 'cx="%s" cy="%s" rx="%s" ry="%s" transform="rotate(%1.1f %s %s)"' % \
 (x, self.height-y, width/2.0, height/2.0, -rotation, x, self.height-y)
 self._draw_svg_element('ellipse', details, gc, rgbFace)
 
@@ -163,7 +156,7 @@
 trans[4] += trans[0]
 trans[5] += trans[3]
 trans[5] = -trans[5]
- transstr = 'transform="matrix(%f %f %f %f %f %f)" '%tuple(trans)
+ transstr = 'transform="matrix(%s %s %s %s %s %s)" '%tuple(trans)
 assert trans[1] == 0
 assert trans[2] == 0
 numrows,numcols = im.get_size()
@@ -207,12 +200,12 @@
 hrefstr = filename
 
 self._svgwriter.write (
- '<image x="%f" y="%f" width="%f" height="%f" '
+ '<image x="%s" y="%s" width="%s" height="%s" '
 'xlink:href="%s" %s/>\n'%(x/trans[0], (self.height-y)/trans[3]-h, w, h, hrefstr, transstr)
 )
 
 def draw_line(self, gc, x1, y1, x2, y2):
- details = 'd="M %f,%f L %f,%f"' % (x1, self.height-y1,
+ details = 'd="M%s,%sL%s,%s"' % (x1, self.height-y1,
 x2, self.height-y2)
 self._draw_svg_element('path', details, gc, None)
 
@@ -222,11 +215,11 @@
 raise ValueError('x and y must be the same length')
 
 y = self.height - y
- details = ['d="M %f,%f' % (x[0], y[0])]
+ details = ['d="M%s,%s' % (x[0], y[0])]
 xys = zip(x[1:], y[1:])
- details.extend(['L %f,%f' % tup for tup in xys])
+ details.extend(['L%s,%s' % tup for tup in xys])
 details.append('"')
- details = ' '.join(details)
+ details = ''.join(details)
 self._draw_svg_element('path', details, gc, None)
 
 def draw_point(self, gc, x, y):
@@ -234,12 +227,12 @@
 self.draw_arc(gc, gc.get_rgb(), x, y, 1, 0, 0, 0, 0)
 
 def draw_polygon(self, gc, rgbFace, points):
- details = 'points = "%s"' % ' '.join(['%f,%f'%(x,self.height-y)
+ details = 'points = "%s"' % ' '.join(['%s,%s'%(x,self.height-y)
 for x, y in points])
 self._draw_svg_element('polygon', details, gc, rgbFace)
 
 def draw_rectangle(self, gc, rgbFace, x, y, width, height):
- details = 'width="%f" height="%f" x="%f" y="%f"' % (width, height, x,
+ details = 'width="%s" height="%s" x="%s" y="%s"' % (width, height, x,
 self.height-y-height)
 self._draw_svg_element('rect', details, gc, rgbFace)
 
@@ -260,12 +253,11 @@
 
 if rcParams['svg.embed_char_paths']:
 svg = ['<g transform="']
- if angle!=0:
- # Inkscape doesn't support rotate(angle x y)
- svg.append('translate(%f,%f) rotate(%1.1f) ' % (x,y,-angle))
- else:
- svg.append('translate(%f,%f)' % (x,y))
- svg.append(' scale(%f)">\n' % (fontsize / self.FONT_SCALE))
+ if angle != 0:
+ svg.append('translate(%s,%s)rotate(%1.1f)' % (x,y,-angle))
+ elif x != 0 or y != 0:
+ svg.append('translate(%s,%s)' % (x, y))
+ svg.append('scale(%s)">\n' % (fontsize / self.FONT_SCALE))
 
 cmap = font.get_charmap()
 lastgind = None
@@ -286,21 +278,24 @@
 lastgind = gind
 currx += kern/64.0
 
- svg.append('<use xlink:href="#%s" transform="translate(%s)"/>\n'
- % (charid, currx * (self.FONT_SCALE / fontsize)))
-
+ svg.append('<use xlink:href="#%s"' % charid)
+ if currx != 0:
+ svg.append(' transform="translate(%s)"' %
+ (currx * (self.FONT_SCALE / fontsize)))
+ svg.append('/>\n')
 currx += (glyph.linearHoriAdvance / 65536.0)
 svg.append('</g>\n')
 svg = ''.join(svg)
 else:
 style = 'font-size: %f; font-family: %s; font-style: %s; fill: %s;'%(fontsize, fontfamily,fontstyle, color)
- style_number = self._map_style(style)
 if angle!=0:
- transform = 'transform="translate(%f,%f) rotate(%1.1f) translate(%f,%f)"' % (x,y,-angle,-x,-y) # Inkscape doesn't support rotate(angle x y)
- else: transform = ''
+ transform = 'transform="translate(%s,%s) rotate(%1.1f) translate(%s,%s)"' % (x,y,-angle,-x,-y)
+ # Inkscape doesn't support rotate(angle x y)
+ else:
+ transform = ''
 
 svg = """\
-<text class="%(style_number)s" x="%(x)f" y="%(y)f" %(transform)s>%(thetext)s</text>
+<text style="%(style)s" x="%(x)s" y="%(y)s" %(transform)s>%(thetext)s</text>
 """ % locals()
 self._svgwriter.write (svg)
 
@@ -313,8 +308,9 @@
 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:
- return char_id
+ char_num, path = self._char_defs.get(char_id, (None, None))
+ if char_num is not None:
+ return char_num
 
 path_data = []
 glyph = font.load_char(ord(char), flags=LOAD_NO_HINTING)
@@ -340,11 +336,11 @@
 
 if step[0] != 4:
 currx, curry = step[-2], -step[-1]
- path_element = '<path id="%s" d="%s"/>\n' % (char_id, " ".join(path_data))
+ char_num = 'c_%x' % len(self._char_defs)
+ path_element = '<path id="%s" d="%s"/>\n' % (char_num, ''.join(path_data))
+ self._char_defs[char_id] = (char_num, path_element)
+ return char_num
 
- self._char_defs[char_id] = path_element
- return char_id
-
 def _draw_mathtext(self, gc, x, y, s, prop, angle):
 """
 Draw math text using matplotlib.mathtext
@@ -358,25 +354,24 @@
 self.open_group("mathtext")
 
 style = "fill: %s" % color
- style_number = self._map_style(style)
 
 if rcParams['svg.embed_char_paths']:
- svg = ['<g class="%s" transform="' % style_number]
+ svg = ['<g style="%s" transform="' % style]
 if angle != 0:
- svg.append('translate(%f,%f) rotate(%1.1f)'
+ svg.append('translate(%s,%s)rotate(%1.1f)'
 % (x,y,-angle) )
 else:
- svg.append('translate(%f,%f)' % (x, y))
+ svg.append('translate(%s,%s)' % (x, y))
 svg.append('">\n')
 
 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' %
+ 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')
 else: # not rcParams['svg.embed_char_paths']
- svg = ['<text class="%s" x="%f" y="%f"' % (style_number, x, y)]
+ svg = ['<text style="%s" x="%f" y="%f"' % (style, x, y)]
 
 if angle != 0:
 svg.append(' transform="translate(%f,%f) rotate(%1.1f) translate(%f,%f)"'
@@ -388,19 +383,18 @@
 for font, fontsize, thetext, new_x, new_y_mtc, metrics in svg_glyphs:
 new_y = - new_y_mtc
 style = "font-size: %f; font-family: %s" % (fontsize, font.family_name)
- style_number = self._map_style(style)
 
- svg.append('<tspan class="%s"' % style_number)
+ svg.append('<tspan style="%s"' % style)
 xadvance = metrics.advance
- svg.append(' textLength="%f"' % xadvance)
+ svg.append(' textLength="%s"' % xadvance)
 
 dx = new_x - curr_x
 if dx != 0.0:
- svg.append(' dx="%f"' % dx)
+ svg.append(' dx="%s"' % dx)
 
 dy = new_y - curr_y
 if dy != 0.0:
- svg.append(' dy="%f"' % dy)
+ svg.append(' dy="%s"' % dy)
 
 thetext = escape_xml_text(thetext)
 
@@ -412,13 +406,13 @@
 svg.append('</text>\n')
 
 if len(svg_rects):
- style_number = self._map_style("fill: black; stroke: none")
- svg.append('<g class="%s" transform="' % style_number)
+ style = "fill: black; stroke: none"
+ svg.append('<g style="%s" transform="' % style)
 if angle != 0:
- svg.append('translate(%f,%f) rotate(%1.1f)'
+ svg.append('translate(%s,%s) rotate(%1.1f)'
 % (x,y,-angle) )
 else:
- svg.append('translate(%f,%f)' % (x, y))
+ svg.append('translate(%s,%s)' % (x, y))
 svg.append('">\n')
 
 for x, y, width, height in svg_rects:
@@ -432,16 +426,9 @@
 write = self._svgwriter.write
 if len(self._char_defs):
 write('<defs id="fontpaths">\n')
- for path in self._char_defs.values():
+ for char_num, path in self._char_defs.values():
 write(path)
 write('</defs>\n')
- if len(self._styles):
- write('<style type="text/css">\n')
- styles = self._styles.items()
- styles.sort()
- for style, number in styles:
- write('.%s { %s }\n' % (number, style))
- write('</style>\n')
 write('</svg>\n')
 
 def flipy(self):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年09月07日 14:04:37
Revision: 3806
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3806&view=rev
Author: mdboom
Date: 2007年09月07日 07:04:36 -0700 (2007年9月07日)
Log Message:
-----------
Creating branch to work on transforms/projections refactoring.
Added Paths:
-----------
 branches/transforms/
Copied: branches/transforms (from rev 3805, trunk/matplotlib)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年09月07日 13:55:46
Revision: 3805
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3805&view=rev
Author: mdboom
Date: 2007年09月07日 06:55:45 -0700 (2007年9月07日)
Log Message:
-----------
Removing obsolete branch for mathtext improvements (merged to trunk a long time ago
Removed Paths:
-------------
 branches/mathtext_mgd/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 3804
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3804&view=rev
Author: mdboom
Date: 2007年09月07日 05:25:37 -0700 (2007年9月07日)
Log Message:
-----------
Fix a couple of backend_svg buglets.
1. Dashed lines did not render properly
2. Resulting SVG was scaled wrong (width and height should be
specified in points, not pixels.)
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/backends/backend_svg.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_svg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_svg.py	2007年09月07日 06:58:00 UTC (rev 3803)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_svg.py	2007年09月07日 12:25:37 UTC (rev 3804)
@@ -83,7 +83,7 @@
 dashes = ''
 else:
 dashes = 'stroke-dasharray: %s; stroke-dashoffset: %f;' % (
- ' '.join(['%f'%val for val in seq]), offset)
+ ','.join(['%f'%val for val in seq]), offset)
 
 linewidth = gc.get_linewidth()
 if linewidth:
@@ -501,7 +501,7 @@
 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
 "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
 <!-- Created with matplotlib (http://matplotlib.sourceforge.net/) -->
-<svg width="%i" height="%i" viewBox="0 0 %i %i"
+<svg width="%ipt" height="%ipt" viewBox="0 0 %i %i"
 xmlns="http://www.w3.org/2000/svg"
 xmlns:xlink="http://www.w3.org/1999/xlink"
 version="1.1"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

Showing results of 137

<< < 1 2 3 4 5 6 > >> (Page 4 of 6)
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





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

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

More information about our ad policies

Ad destination/click URL:

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