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
(20) |
2
(5) |
3
(2) |
4
(4) |
5
(14) |
6
(19) |
7
(17) |
8
(14) |
9
(34) |
10
(16) |
11
(1) |
12
(22) |
13
(21) |
14
(36) |
15
(28) |
16
(20) |
17
(23) |
18
(10) |
19
(4) |
20
(16) |
21
(17) |
22
(7) |
23
(6) |
24
(3) |
25
(1) |
26
(27) |
27
(13) |
28
(26) |
29
(10) |
30
(25) |
|
Revision: 4509 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4509&view=rev Author: jdh2358 Date: 2007年11月29日 14:19:26 -0800 (2007年11月29日) Log Message: ----------- commited ludwigs axes3d patch Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes3d.py trunk/matplotlib/lib/matplotlib/mlab.py Modified: trunk/matplotlib/lib/matplotlib/axes3d.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes3d.py 2007年11月29日 21:15:23 UTC (rev 4508) +++ trunk/matplotlib/lib/matplotlib/axes3d.py 2007年11月29日 22:19:26 UTC (rev 4509) @@ -315,9 +315,10 @@ def mouse_init(self): self.button_pressed = None - self.figure.canvas.mpl_connect('motion_notify_event', self.on_move) - self.figure.canvas.mpl_connect('button_press_event', self.button_press) - self.figure.canvas.mpl_connect('button_release_event', self.button_release) + if self.figure.canvas != None: + self.figure.canvas.mpl_connect('motion_notify_event', self.on_move) + self.figure.canvas.mpl_connect('button_press_event', self.button_press) + self.figure.canvas.mpl_connect('button_release_event', self.button_release) def button_press(self, event): self.button_pressed = event.button Modified: trunk/matplotlib/lib/matplotlib/mlab.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mlab.py 2007年11月29日 21:15:23 UTC (rev 4508) +++ trunk/matplotlib/lib/matplotlib/mlab.py 2007年11月29日 22:19:26 UTC (rev 4509) @@ -2441,9 +2441,9 @@ pass except RuntimeError: pass -else: + def gtkformat_factory(format, colnum): """ copy the format, perform any overrides, and attach an gtk style attrs This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4508 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4508&view=rev Author: jswhit Date: 2007年11月29日 13:15:23 -0800 (2007年11月29日) Log Message: ----------- include NetCDFFile in basemap.py, so docstring is included for web page. Modified Paths: -------------- trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/__init__.py trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py Modified: trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/__init__.py =================================================================== --- trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/__init__.py 2007年11月29日 20:16:48 UTC (rev 4507) +++ trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/__init__.py 2007年11月29日 21:15:23 UTC (rev 4508) @@ -1,3 +1,2 @@ from basemap import __doc__, __version__ from basemap import * -from pupynere import NetCDFFile Modified: trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py =================================================================== --- trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py 2007年11月29日 20:16:48 UTC (rev 4507) +++ trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py 2007年11月29日 21:15:23 UTC (rev 4508) @@ -14,7 +14,7 @@ from numpy import linspace, squeeze, ma from matplotlib.cbook import is_scalar, dedent from shapelib import ShapeFile -import _geos +import _geos, pupynere # basemap data files now installed in lib/matplotlib/toolkits/basemap/data basemap_datadir = os.sep.join([os.path.dirname(__file__), 'data']) @@ -2762,3 +2762,47 @@ raise ValueError, 'width and/or height too large for this projection, try smaller values' else: return corners + +has_pynio = True +try: + from PyNGL import nio +except ImportError: + has_pynio = False + +def NetCDFFile(file, maskandscale=True): + """NetCDF File reader. API is the same as Scientific.IO.NetCDF. + If 'file' is a URL that starts with 'http', it is assumed + to be a remote OPenDAP dataset, and the python dap client is used + to retrieve the data. Only the OPenDAP Array and Grid data + types are recognized. If file does not start with 'http', it + is assumed to be a local file. If possible, the file will be read + with a pure python NetCDF reader, otherwise PyNIO + (http://www.pyngl.ucar.edu/Nio.shtml) will be used (if it is installed). + PyNIO supports NetCDF version 4, GRIB1, GRIB2, HDF4 and HDFEOS2 files. + Data read from OPenDAP and NetCDF version 3 datasets will + automatically be converted to masked arrays if the variable has either + a 'missing_value' or '_FillValue' attribute, and some data points + are equal to the value specified by that attribute. In addition, + variables stored as integers that have the 'scale_factor' and + 'add_offset' attribute will automatically be rescaled to floats when + read. If PyNIO is used, neither of the automatic conversions will + be performed. To suppress these automatic conversions, set the + maskandscale keyword to False. + """ + if file.startswith('http'): + return pupynere._RemoteFile(file,maskandscale) + else: + # use pynio if it is installed and the file cannot + # be read with the pure python netCDF reader. This allows + # netCDF version 4, GRIB1, GRIB2, HDF4 and HDFEOS files + # to be read. + if has_pynio: + try: + f = pupynere._LocalFile(file,maskandscale) + except: + f = nio.open_file(file) + # otherwise, use the pupynere netCDF 3 pure python reader. + # (will fail if file is not a netCDF version 3 file). + else: + f = pupynere._LocalFile(file,maskandscale) + return f This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4507 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4507&view=rev Author: jdh2358 Date: 2007年11月29日 12:16:48 -0800 (2007年11月29日) Log Message: ----------- Applied Ludwigs build tkagg w/o x11 server patch Modified Paths: -------------- trunk/matplotlib/CODING_GUIDE trunk/matplotlib/examples/loadrec.py trunk/matplotlib/setupext.py Modified: trunk/matplotlib/CODING_GUIDE =================================================================== --- trunk/matplotlib/CODING_GUIDE 2007年11月29日 19:56:10 UTC (rev 4506) +++ trunk/matplotlib/CODING_GUIDE 2007年11月29日 20:16:48 UTC (rev 4507) @@ -117,7 +117,7 @@ -for older versions of emacs (emacs<22) you may need to do +for older versions of emacs (emacs<22) you need to do (add-hook 'python-mode-hook (lambda () Modified: trunk/matplotlib/examples/loadrec.py =================================================================== --- trunk/matplotlib/examples/loadrec.py 2007年11月29日 19:56:10 UTC (rev 4506) +++ trunk/matplotlib/examples/loadrec.py 2007年11月29日 20:16:48 UTC (rev 4507) @@ -2,6 +2,7 @@ from pylab import figure, show a = mlab.csv2rec('data/msft.csv') +a.sort() print a.dtype fig = figure() Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2007年11月29日 19:56:10 UTC (rev 4506) +++ trunk/matplotlib/setupext.py 2007年11月29日 20:16:48 UTC (rev 4507) @@ -92,6 +92,8 @@ BUILT_CONTOUR = False BUILT_GDK = False +TCL_TK_CACHE = None + AGG_VERSION = 'agg23' # for nonstandard installation/build with --prefix variable @@ -797,51 +799,6 @@ # or else you'll build for a wrong version of the Tcl # interpreter (leading to nasty segfaults). -class FoundTclTk: - pass - -def find_tcltk(): - """Finds Tcl/Tk includes/libraries/version by interrogating Tkinter.""" - # By this point, we already know that Tkinter imports correctly - import Tkinter - o = FoundTclTk() - try: - tk=Tkinter.Tk() - except Tkinter.TclError: - o.tcl_lib = "/usr/local/lib" - o.tcl_inc = "/usr/local/include" - o.tk_lib = "/usr/local/lib" - o.tk_inc = "/usr/local/include" - o.tkv = "" - else: - tk.withdraw() - o.tcl_lib = os.path.normpath(os.path.join(str(tk.getvar('tcl_library')), '../')) - o.tk_lib = os.path.normpath(os.path.join(str(tk.getvar('tk_library')), '../')) - o.tkv = str(Tkinter.TkVersion)[:3] - o.tcl_inc = os.path.normpath(os.path.join(str(tk.getvar('tcl_library')), - '../../include/tcl'+o.tkv)) - if not os.path.exists(o.tcl_inc): - o.tcl_inc = os.path.normpath(os.path.join(str(tk.getvar('tcl_library')), - '../../include')) - o.tk_inc = os.path.normpath(os.path.join(str(tk.getvar('tk_library')), - '../../include/tk'+o.tkv)) - if not os.path.exists(o.tk_inc): - o.tk_inc = os.path.normpath(os.path.join(str(tk.getvar('tk_library')), - '../../include')) - - if ((not os.path.exists(os.path.join(o.tk_inc,'tk.h'))) and - os.path.exists(os.path.join(o.tcl_inc,'tk.h'))): - o.tk_inc = o.tcl_inc - - if not os.path.exists(o.tcl_inc): - # this is a hack for suse linux, which is broken - if (sys.platform.startswith('linux') and - os.path.exists('/usr/include/tcl.h') and - os.path.exists('/usr/include/tk.h')): - o.tcl_inc = '/usr/include/' - o.tk_inc = '/usr/include/' - return o - def check_for_tk(): gotit = False explanation = None @@ -853,29 +810,27 @@ explanation = 'Tkinter present but import failed' else: if Tkinter.TkVersion < 8.3: - explanation = "Tcl/Tk v8.3 or later required\n" - sys.exit(1) + explanation = "Tcl/Tk v8.3 or later required" else: - try: - tk = Tkinter.Tk() - tk.withdraw() - except Tkinter.TclError: - explanation = """\ -Using default library and include directories for Tcl and Tk because a -Tk window failed to open. You may need to define DISPLAY for Tk to work -so that setup can determine where your libraries are located.""" gotit = True - + if gotit: module = Extension('test', []) try: - add_tk_flags(module) + explanation = add_tk_flags(module) except RuntimeError, e: explanation = str(e) gotit = False - if not find_include_file(module.include_dirs, "tk.h"): - explanation = 'Tkinter present, but header files are not installed. You may need to install development packages.' - + else: + if not find_include_file(module.include_dirs, "tk.h"): + message = 'Tkinter present, but header files are not found. ' + \ + 'You may need to install development packages.' + if explanation is not None: + explanation += '\n' + message + else: + explanation = message + gotit = False + if gotit: print_status("Tkinter", "Tkinter: %s, Tk: %s, Tcl: %s" % (Tkinter.__version__.split()[-2], Tkinter.TkVersion, Tkinter.TclVersion)) @@ -885,25 +840,65 @@ print_message(explanation) return gotit +def query_tcltk(): + """Tries to open a Tk window in order to query the Tk object about its library paths. + This should never be called more than once by the same process, as Tk intricacies + may cause the Python interpreter to hang. The function also has a workaround if + no X server is running (useful for autobuild systems).""" + global TCL_TK_CACHE + # Use cached values if they exist, which ensures this function only executes once + if TCL_TK_CACHE is not None: + return TCL_TK_CACHE + + # By this point, we already know that Tkinter imports correctly + import Tkinter + tcl_lib_dir = '' + tk_lib_dir = '' + # First try to open a Tk window (requires a running X server) + try: + tk = Tkinter.Tk() + except Tkinter.TclError: + # Next, start Tcl interpreter without opening a Tk window (no need for X server) + # This feature is available in python version 2.4 and up + try: + tcl = Tkinter.Tcl() + except AttributeError: # Python version not high enough + pass + except Tkinter.TclError: # Something went wrong while opening Tcl + pass + else: + tcl_lib_dir = str(tcl.getvar('tcl_library')) + # Guess Tk location based on Tcl location + tk_lib_dir = tcl_lib_dir.replace('Tcl', 'Tk').replace('tcl', 'tk') + else: + # Obtain Tcl and Tk locations from Tk widget + tk.withdraw() + tcl_lib_dir = str(tk.getvar('tcl_library')) + tk_lib_dir = str(tk.getvar('tk_library')) + + # Save directories and version string to cache + TCL_TK_CACHE = tcl_lib_dir, tk_lib_dir, str(Tkinter.TkVersion)[:3] + return TCL_TK_CACHE + def add_tk_flags(module): 'Add the module flags to build extensions which use tk' - if sys.platform=='win32': + message = None + if sys.platform == 'win32': major, minor1, minor2, s, tmp = sys.version_info - if major==2 and minor1 in [3, 4, 5]: + if major == 2 and minor1 in [3, 4, 5]: module.include_dirs.extend(['win32_static/include/tcl8.4']) module.libraries.extend(['tk84', 'tcl84']) - elif major==2 and minor1==2: + elif major == 2 and minor1 == 2: module.include_dirs.extend(['win32_static/include/tcl8.3']) module.libraries.extend(['tk83', 'tcl83']) else: raise RuntimeError('No tk/win32 support for this python version yet') module.library_dirs.extend([os.path.join(sys.prefix, 'dlls')]) - return - - elif sys.platform == 'darwin' : + + elif sys.platform == 'darwin': # this config section lifted directly from Imaging - thanks to # the effbot! - + # First test for a MacOSX/darwin framework install from os.path import join, exists framework_dirs = [ @@ -911,8 +906,8 @@ '/Library/Frameworks', join(os.getenv('HOME'), '/Library/Frameworks') ] - - # Find the directory that contains the Tcl.framwork and Tk.framework + + # Find the directory that contains the Tcl.framework and Tk.framework # bundles. # XXX distutils should support -F! tk_framework_found = 0 @@ -936,7 +931,7 @@ for fw in 'Tcl', 'Tk' for H in 'Headers', 'Versions/Current/PrivateHeaders' ] - + # For 8.4a2, the X11 headers are not included. Rather than include a # complicated search, this is a hard-coded path. It could bail out # if X11 libs are not found... @@ -945,15 +940,55 @@ module.include_dirs.extend(tk_include_dirs) module.extra_link_args.extend(frameworks) module.extra_compile_args.extend(frameworks) - return + + # you're still here? ok we'll try it this way... + else: + # Query Tcl/Tk system for library paths and version string + tcl_lib_dir, tk_lib_dir, tk_ver = query_tcltk() # todo: try/except + + # Process base directories to obtain include + lib dirs + if tcl_lib_dir != '' and tk_lib_dir != '': + tcl_lib = os.path.normpath(os.path.join(tcl_lib_dir, '../')) + tk_lib = os.path.normpath(os.path.join(tk_lib_dir, '../')) + tcl_inc = os.path.normpath(os.path.join(tcl_lib_dir, + '../../include/tcl' + tk_ver)) + if not os.path.exists(tcl_inc): + tcl_inc = os.path.normpath(os.path.join(tcl_lib_dir, + '../../include')) + tk_inc = os.path.normpath(os.path.join(tk_lib_dir, + '../../include/tk' + tk_ver)) + if not os.path.exists(tk_inc): + tk_inc = os.path.normpath(os.path.join(tk_lib_dir, + '../../include')) + + if ((not os.path.exists(os.path.join(tk_inc,'tk.h'))) and + os.path.exists(os.path.join(tcl_inc,'tk.h'))): + tk_inc = tcl_inc + + if not os.path.exists(tcl_inc): + # this is a hack for suse linux, which is broken + if (sys.platform.startswith('linux') and + os.path.exists('/usr/include/tcl.h') and + os.path.exists('/usr/include/tk.h')): + tcl_inc = '/usr/include' + tk_inc = '/usr/include' + else: + message = """\ +Using default library and include directories for Tcl and Tk because a +Tk window failed to open. You may need to define DISPLAY for Tk to work +so that setup can determine where your libraries are located.""" + tcl_inc = "/usr/local/include" + tk_inc = "/usr/local/include" + tcl_lib = "/usr/local/lib" + tk_lib = "/usr/local/lib" + tk_ver = "" + # Add final versions of directories and libraries to module lists + module.include_dirs.extend([tcl_inc, tk_inc]) + module.library_dirs.extend([tcl_lib, tk_lib]) + module.libraries.extend(['tk' + tk_ver, 'tcl' + tk_ver]) + + return message - # you're still here? ok we'll try it this way - o = find_tcltk() # todo: try/except - module.include_dirs.extend([o.tcl_inc, o.tk_inc]) - module.library_dirs.extend([o.tcl_lib, o.tk_lib]) - module.libraries.extend(['tk'+o.tkv, 'tcl'+o.tkv]) - - def add_windowing_flags(module): 'Add the module flags to build extensions using windowing api' module.include_dirs.extend(['C:/include']) @@ -1031,9 +1066,6 @@ deps, ) - # add agg flags before pygtk because agg only supports freetype1 - # and pygtk includes freetype2. This is a bit fragile. - add_tk_flags(module) # do this first add_agg_flags(module) add_ft2font_flags(module) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4506 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4506&view=rev Author: mdboom Date: 2007年11月29日 11:56:10 -0800 (2007年11月29日) Log Message: ----------- Merged revisions 4499-4505 via svnmerge from http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib ........ r4504 | jdh2358 | 2007年11月29日 14:43:20 -0500 (2007年11月29日) | 1 line minor changes for htdocs ........ r4505 | jdh2358 | 2007年11月29日 14:44:49 -0500 (2007年11月29日) | 1 line minor changes for htdocs ........ Modified Paths: -------------- branches/transforms/lib/matplotlib/mathtext.py Property Changed: ---------------- branches/transforms/ Property changes on: branches/transforms ___________________________________________________________________ Name: svnmerge-integrated - /trunk/matplotlib:1-4498 + /trunk/matplotlib:1-4505 Modified: branches/transforms/lib/matplotlib/mathtext.py =================================================================== --- branches/transforms/lib/matplotlib/mathtext.py 2007年11月29日 19:44:49 UTC (rev 4505) +++ branches/transforms/lib/matplotlib/mathtext.py 2007年11月29日 19:56:10 UTC (rev 4506) @@ -1090,7 +1090,7 @@ # Typesetting math formulas # # Many of the docstrings below refer to a numbered "node" in that -# book, e.g. @123 +# book, e.g. node123 # # Note that (as TeX) y increases downward, unlike many other parts of # matplotlib. @@ -1118,7 +1118,7 @@ class Node(object): """A node in the TeX box model - @133 + node133 """ def __init__(self): self.size = 0 @@ -1147,7 +1147,7 @@ class Box(Node): """Represents any node with a physical location. - @135""" + node135""" def __init__(self, width, height, depth): Node.__init__(self) self.width = width @@ -1193,7 +1193,7 @@ The metrics must be converted to the TeX way, and the advance (if different from width) must be converted into a Kern node when the Char is added to its parent Hlist. - @134""" + node134""" def __init__(self, c, state): Node.__init__(self) self.c = c @@ -1284,7 +1284,7 @@ class List(Box): """A list of nodes (either horizontal or vertical). - @135""" + node135""" def __init__(self, elements): Box.__init__(self, 0., 0., 0.) self.shift_amount = 0. # An arbitrary offset @@ -1342,7 +1342,7 @@ class Hlist(List): """A horizontal list of boxes. - @135""" + node135""" def __init__(self, elements, w=0., m='additional', do_kern=True): List.__init__(self, elements) if do_kern: @@ -1385,7 +1385,7 @@ Thus, hpack(w, exactly) produces a box whose width is exactly w, while hpack (w, additional ) yields a box whose width is the natural width plus w. The default values produce a box with the natural width. - @644, @649""" + node644, node649""" # I don't know why these get reset in TeX. Shift_amount is pretty # much useless if we do. #self.shift_amount = 0. @@ -1432,7 +1432,7 @@ class Vlist(List): """A vertical list of boxes. - @137""" + node137""" def __init__(self, elements, h=0., m='additional'): List.__init__(self, elements) self.vpack() @@ -1449,7 +1449,7 @@ Thus, vpack(h, exactly) produces a box whose width is exactly w, while vpack(w, additional) yields a box whose width is the natural width plus w. The default values produce a box with the natural width. - @644, @668""" + node644, node668""" # I don't know why these get reset in TeX. Shift_amount is pretty # much useless if we do. # self.shift_amount = 0. @@ -1508,7 +1508,7 @@ rule up to the boundary of the innermost enclosing box. This is called a "running dimension." The width is never running in an Hlist; the height and depth are never running in a Vlist. - @138""" + node138""" def __init__(self, width, height, depth, state): Box.__init__(self, width, height, depth) self.font_output = state.font_output @@ -1536,7 +1536,7 @@ GlueSpec class, which is shared between multiple glue objects. (This is a memory optimization which probably doesn't matter anymore, but it's easier to stick to what TeX does.) - @149, @152""" + node149, node152""" def __init__(self, glue_type, copy=False): Node.__init__(self) self.glue_subtype = 'normal' @@ -1564,7 +1564,7 @@ self.glue_spec.width *= GROW_FACTOR class GlueSpec(object): - """@150, @151""" + """node150, node151""" def __init__(self, width=0., stretch=0., stretch_order=0, shrink=0., shrink_order=0): self.width = width self.stretch = stretch @@ -1645,7 +1645,7 @@ better to move them closer together or further apart. A kern node can also appear in a vertical list, when its 'width' denotes additional spacing in the vertical direction. - @155""" + node155""" def __init__(self, width): Node.__init__(self) self.width = width @@ -1731,7 +1731,7 @@ and vlist_out , which traverse the Hlists and Vlists inside of horizontal and vertical boxes. The global variables used in TeX to store state as it processes have become member variables here. - @592.""" + node592.""" def __call__(self, ox, oy, box): self.max_push = 0 # Deepest nesting of push commands so far self.cur_s = 0 @@ -1767,7 +1767,7 @@ elif isinstance(p, Kern): self.cur_h += p.width elif isinstance(p, List): - # @623 + # node623 if len(p.children) == 0: self.cur_h += p.width else: @@ -1781,7 +1781,7 @@ self.cur_h = edge + p.width self.cur_v = base_line elif isinstance(p, Box): - # @624 + # node624 rule_height = p.height rule_depth = p.depth rule_width = p.width @@ -1797,7 +1797,7 @@ self.cur_v = baseline self.cur_h += rule_width elif isinstance(p, Glue): - # @625 + # node625 glue_spec = p.glue_spec rule_width = glue_spec.width - cur_g if glue_sign != 0: # normal @@ -2468,7 +2468,7 @@ else: shift_down = SUBDROP * xHeight if super is None: - # @757 + # node757 sub.shrink() x = Hlist([sub]) # x.width += SCRIPT_SPACE * xHeight This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4505 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4505&view=rev Author: jdh2358 Date: 2007年11月29日 11:44:49 -0800 (2007年11月29日) Log Message: ----------- minor changes for htdocs Modified Paths: -------------- trunk/matplotlib/examples/mathtext_examples.py Modified: trunk/matplotlib/examples/mathtext_examples.py =================================================================== --- trunk/matplotlib/examples/mathtext_examples.py 2007年11月29日 19:43:20 UTC (rev 4504) +++ trunk/matplotlib/examples/mathtext_examples.py 2007年11月29日 19:44:49 UTC (rev 4505) @@ -49,15 +49,7 @@ r'$\widehat{abc}\widetilde{def}$', r'$\Gamma \Delta \Theta \Lambda \Xi \Pi \Sigma \Upsilon \Phi \Psi \Omega$', r'$\alpha \beta \gamma \delta \epsilon \zeta \eta \theta \iota \lambda \mu \nu \xi \pi \kappa \rho \sigma \tau \upsilon \phi \chi \psi$', -<<<<<<< .mine -<<<<<<< .mine - #ur'Generic symbol: $\u23ce \mathrm{\ue0f2}$' -======= - #ur'Generic symbol: $\u23ce \mathrm{\ue0f2 \U0001D538}$' -======= ur'Generic symbol: $\u23ce \mathrm{\ue0f2 \U0001D538}$' ->>>>>>> .r4393 ->>>>>>> .r4174 ] from pylab import * @@ -71,11 +63,7 @@ axis([0, 3, -len(tests), 0]) yticks(arange(len(tests)) * -1) for i, s in enumerate(tests): -<<<<<<< .mine - print i,s -======= print (i, s) ->>>>>>> .r4174 text(0.1, -i, s, fontsize=20) savefig('mathtext_examples') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4504 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4504&view=rev Author: jdh2358 Date: 2007年11月29日 11:43:20 -0800 (2007年11月29日) Log Message: ----------- minor changes for htdocs Modified Paths: -------------- trunk/matplotlib/examples/mathtext_examples.py trunk/matplotlib/lib/matplotlib/mathtext.py Modified: trunk/matplotlib/examples/mathtext_examples.py =================================================================== --- trunk/matplotlib/examples/mathtext_examples.py 2007年11月29日 19:42:34 UTC (rev 4503) +++ trunk/matplotlib/examples/mathtext_examples.py 2007年11月29日 19:43:20 UTC (rev 4504) @@ -49,7 +49,15 @@ r'$\widehat{abc}\widetilde{def}$', r'$\Gamma \Delta \Theta \Lambda \Xi \Pi \Sigma \Upsilon \Phi \Psi \Omega$', r'$\alpha \beta \gamma \delta \epsilon \zeta \eta \theta \iota \lambda \mu \nu \xi \pi \kappa \rho \sigma \tau \upsilon \phi \chi \psi$', +<<<<<<< .mine +<<<<<<< .mine + #ur'Generic symbol: $\u23ce \mathrm{\ue0f2}$' +======= + #ur'Generic symbol: $\u23ce \mathrm{\ue0f2 \U0001D538}$' +======= ur'Generic symbol: $\u23ce \mathrm{\ue0f2 \U0001D538}$' +>>>>>>> .r4393 +>>>>>>> .r4174 ] from pylab import * @@ -63,7 +71,11 @@ axis([0, 3, -len(tests), 0]) yticks(arange(len(tests)) * -1) for i, s in enumerate(tests): +<<<<<<< .mine + print i,s +======= print (i, s) +>>>>>>> .r4174 text(0.1, -i, s, fontsize=20) savefig('mathtext_examples') Modified: trunk/matplotlib/lib/matplotlib/mathtext.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mathtext.py 2007年11月29日 19:42:34 UTC (rev 4503) +++ trunk/matplotlib/lib/matplotlib/mathtext.py 2007年11月29日 19:43:20 UTC (rev 4504) @@ -1092,7 +1092,7 @@ # Typesetting math formulas # # Many of the docstrings below refer to a numbered "node" in that -# book, e.g. @123 +# book, e.g. node123 # # Note that (as TeX) y increases downward, unlike many other parts of # matplotlib. @@ -1120,7 +1120,7 @@ class Node(object): """A node in the TeX box model - @133 + node133 """ def __init__(self): self.size = 0 @@ -1149,7 +1149,7 @@ class Box(Node): """Represents any node with a physical location. - @135""" + node135""" def __init__(self, width, height, depth): Node.__init__(self) self.width = width @@ -1195,7 +1195,7 @@ The metrics must be converted to the TeX way, and the advance (if different from width) must be converted into a Kern node when the Char is added to its parent Hlist. - @134""" + node134""" def __init__(self, c, state): Node.__init__(self) self.c = c @@ -1286,7 +1286,7 @@ class List(Box): """A list of nodes (either horizontal or vertical). - @135""" + node135""" def __init__(self, elements): Box.__init__(self, 0., 0., 0.) self.shift_amount = 0. # An arbitrary offset @@ -1344,7 +1344,7 @@ class Hlist(List): """A horizontal list of boxes. - @135""" + node135""" def __init__(self, elements, w=0., m='additional', do_kern=True): List.__init__(self, elements) if do_kern: @@ -1387,7 +1387,7 @@ Thus, hpack(w, exactly) produces a box whose width is exactly w, while hpack (w, additional ) yields a box whose width is the natural width plus w. The default values produce a box with the natural width. - @644, @649""" + node644, node649""" # I don't know why these get reset in TeX. Shift_amount is pretty # much useless if we do. #self.shift_amount = 0. @@ -1434,7 +1434,7 @@ class Vlist(List): """A vertical list of boxes. - @137""" + node137""" def __init__(self, elements, h=0., m='additional'): List.__init__(self, elements) self.vpack() @@ -1451,7 +1451,7 @@ Thus, vpack(h, exactly) produces a box whose width is exactly w, while vpack(w, additional) yields a box whose width is the natural width plus w. The default values produce a box with the natural width. - @644, @668""" + node644, node668""" # I don't know why these get reset in TeX. Shift_amount is pretty # much useless if we do. # self.shift_amount = 0. @@ -1510,7 +1510,7 @@ rule up to the boundary of the innermost enclosing box. This is called a "running dimension." The width is never running in an Hlist; the height and depth are never running in a Vlist. - @138""" + node138""" def __init__(self, width, height, depth, state): Box.__init__(self, width, height, depth) self.font_output = state.font_output @@ -1538,7 +1538,7 @@ GlueSpec class, which is shared between multiple glue objects. (This is a memory optimization which probably doesn't matter anymore, but it's easier to stick to what TeX does.) - @149, @152""" + node149, node152""" def __init__(self, glue_type, copy=False): Node.__init__(self) self.glue_subtype = 'normal' @@ -1566,7 +1566,7 @@ self.glue_spec.width *= GROW_FACTOR class GlueSpec(object): - """@150, @151""" + """node150, node151""" def __init__(self, width=0., stretch=0., stretch_order=0, shrink=0., shrink_order=0): self.width = width self.stretch = stretch @@ -1647,7 +1647,7 @@ better to move them closer together or further apart. A kern node can also appear in a vertical list, when its 'width' denotes additional spacing in the vertical direction. - @155""" + node155""" def __init__(self, width): Node.__init__(self) self.width = width @@ -1733,7 +1733,7 @@ and vlist_out , which traverse the Hlists and Vlists inside of horizontal and vertical boxes. The global variables used in TeX to store state as it processes have become member variables here. - @592.""" + node592.""" def __call__(self, ox, oy, box): self.max_push = 0 # Deepest nesting of push commands so far self.cur_s = 0 @@ -1769,7 +1769,7 @@ elif isinstance(p, Kern): self.cur_h += p.width elif isinstance(p, List): - # @623 + # node623 if len(p.children) == 0: self.cur_h += p.width else: @@ -1783,7 +1783,7 @@ self.cur_h = edge + p.width self.cur_v = base_line elif isinstance(p, Box): - # @624 + # node624 rule_height = p.height rule_depth = p.depth rule_width = p.width @@ -1799,7 +1799,7 @@ self.cur_v = baseline self.cur_h += rule_width elif isinstance(p, Glue): - # @625 + # node625 glue_spec = p.glue_spec rule_width = glue_spec.width - cur_g if glue_sign != 0: # normal @@ -2470,7 +2470,7 @@ else: shift_down = SUBDROP * xHeight if super is None: - # @757 + # node757 sub.shrink() x = Hlist([sub]) # x.width += SCRIPT_SPACE * xHeight This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4503 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4503&view=rev Author: jdh2358 Date: 2007年11月29日 11:42:34 -0800 (2007年11月29日) Log Message: ----------- updated site docs Modified Paths: -------------- trunk/htdocs/API_CHANGES trunk/htdocs/CHANGELOG trunk/htdocs/backends.html.template trunk/htdocs/classdocs.html.template trunk/htdocs/convert.py trunk/htdocs/credits.html.template trunk/htdocs/examples/agg_resize.py trunk/htdocs/examples/agg_test.py trunk/htdocs/examples/anscombe.py trunk/htdocs/examples/axes_demo.py trunk/htdocs/examples/axes_props.py trunk/htdocs/examples/backend_driver.py trunk/htdocs/examples/color_by_yvalue.py trunk/htdocs/examples/colours.py trunk/htdocs/examples/contour_demo.py trunk/htdocs/examples/contourf_demo.py trunk/htdocs/examples/csd_demo.py trunk/htdocs/examples/cursor_demo.py trunk/htdocs/examples/data_helper.py trunk/htdocs/examples/date_demo1.py trunk/htdocs/examples/date_demo_convert.py trunk/htdocs/examples/dynamic_demo_wx.py trunk/htdocs/examples/dynamic_image_wxagg.py trunk/htdocs/examples/dynamic_image_wxagg2.py trunk/htdocs/examples/embedding_in_gtk.py trunk/htdocs/examples/embedding_in_gtk2.py trunk/htdocs/examples/embedding_in_gtk3.py trunk/htdocs/examples/embedding_in_qt.py trunk/htdocs/examples/embedding_in_tk.py trunk/htdocs/examples/embedding_in_tk2.py trunk/htdocs/examples/embedding_in_wx.py trunk/htdocs/examples/embedding_in_wx2.py trunk/htdocs/examples/embedding_in_wx3.py trunk/htdocs/examples/embedding_in_wx4.py trunk/htdocs/examples/errorbar_demo.py trunk/htdocs/examples/figimage_demo.py trunk/htdocs/examples/fill_between.py trunk/htdocs/examples/fill_demo2.py trunk/htdocs/examples/font_indexing.py trunk/htdocs/examples/font_table_ttf.py trunk/htdocs/examples/fonts_demo.py trunk/htdocs/examples/fonts_demo_kw.py trunk/htdocs/examples/ftface_props.py trunk/htdocs/examples/glyph_to_path.py trunk/htdocs/examples/gtk_spreadsheet.py trunk/htdocs/examples/histogram_demo.py trunk/htdocs/examples/histogram_demo_canvasagg.py trunk/htdocs/examples/image_demo.py trunk/htdocs/examples/image_demo2.py trunk/htdocs/examples/image_interp.py trunk/htdocs/examples/integral_demo.py trunk/htdocs/examples/interactive.py trunk/htdocs/examples/interactive2.py trunk/htdocs/examples/keypress_demo.py trunk/htdocs/examples/layer_images.py trunk/htdocs/examples/legend_auto.py trunk/htdocs/examples/legend_demo2.py trunk/htdocs/examples/line_styles.py trunk/htdocs/examples/major_minor_demo1.py trunk/htdocs/examples/major_minor_demo2.py trunk/htdocs/examples/masked_demo.py trunk/htdocs/examples/mathtext_demo.py trunk/htdocs/examples/mpl_with_glade.py trunk/htdocs/examples/mri_with_eeg.py trunk/htdocs/examples/multiline.py trunk/htdocs/examples/pcolor_demo.py trunk/htdocs/examples/pcolor_demo2.py trunk/htdocs/examples/pcolor_small.py trunk/htdocs/examples/pie_demo.py trunk/htdocs/examples/polar_demo.py trunk/htdocs/examples/polar_scatter.py trunk/htdocs/examples/poly_editor.py trunk/htdocs/examples/printing_in_wx.py trunk/htdocs/examples/psd_demo.py trunk/htdocs/examples/pythonic_matplotlib.py trunk/htdocs/examples/quiver_demo.py trunk/htdocs/examples/scatter_demo.py trunk/htdocs/examples/scatter_profile.py trunk/htdocs/examples/set_and_get.py trunk/htdocs/examples/specgram_demo.py trunk/htdocs/examples/stem_plot.py trunk/htdocs/examples/system_monitor.py trunk/htdocs/examples/tex_demo.py trunk/htdocs/examples/to_numeric.py trunk/htdocs/examples/toggle_images.py trunk/htdocs/examples/unicode_demo.py trunk/htdocs/examples/units/bar_unit_demo.py trunk/htdocs/examples/units/basic_units.py trunk/htdocs/examples/units/date_support.py trunk/htdocs/examples/units/units_sample.py trunk/htdocs/examples/vline_demo.py trunk/htdocs/examples/webapp_demo.py trunk/htdocs/examples/widgets/buttons.py trunk/htdocs/examples/widgets/check_buttons.py trunk/htdocs/examples/widgets/radio_buttons.py trunk/htdocs/examples/widgets/sliders.py trunk/htdocs/examples/widgets/span_selector.py trunk/htdocs/examples/wxcursor_demo.py trunk/htdocs/faq.html.template trunk/htdocs/fonts.html.template trunk/htdocs/hthelpers.py trunk/htdocs/index.html.template trunk/htdocs/installing.html.template trunk/htdocs/interactive.html.template trunk/htdocs/license.html.template trunk/htdocs/make.py trunk/htdocs/matplotlib.afm.html.template trunk/htdocs/matplotlib.artist.html.template trunk/htdocs/matplotlib.axes.html.template trunk/htdocs/matplotlib.axis.html.template trunk/htdocs/matplotlib.backend_bases.html.template trunk/htdocs/matplotlib.backends.backend_agg.html.template trunk/htdocs/matplotlib.backends.backend_cairo.html.template trunk/htdocs/matplotlib.backends.backend_gd.html.template trunk/htdocs/matplotlib.backends.backend_gtk.html.template trunk/htdocs/matplotlib.backends.backend_gtkagg.html.template trunk/htdocs/matplotlib.backends.backend_gtkcairo.html.template trunk/htdocs/matplotlib.backends.backend_ps.html.template trunk/htdocs/matplotlib.backends.backend_qt.html.template trunk/htdocs/matplotlib.backends.backend_qtagg.html.template trunk/htdocs/matplotlib.backends.backend_svg.html.template trunk/htdocs/matplotlib.backends.backend_template.html.template trunk/htdocs/matplotlib.backends.backend_tkagg.html.template trunk/htdocs/matplotlib.backends.backend_wx.html.template trunk/htdocs/matplotlib.backends.backend_wxagg.html.template trunk/htdocs/matplotlib.cbook.html.template trunk/htdocs/matplotlib.cm.html.template trunk/htdocs/matplotlib.collections.html.template trunk/htdocs/matplotlib.colors.html.template trunk/htdocs/matplotlib.dates.html.template trunk/htdocs/matplotlib.figure.html.template trunk/htdocs/matplotlib.finance.html.template trunk/htdocs/matplotlib.font_manager.html.template trunk/htdocs/matplotlib.ft2font.html.template trunk/htdocs/matplotlib.image.html.template trunk/htdocs/matplotlib.legend.html.template trunk/htdocs/matplotlib.lines.html.template trunk/htdocs/matplotlib.mathtext.html trunk/htdocs/matplotlib.mathtext.html.template trunk/htdocs/matplotlib.mlab.html.template trunk/htdocs/matplotlib.numerix.html.template trunk/htdocs/matplotlib.patches.html.template trunk/htdocs/matplotlib.pylab.html.template trunk/htdocs/matplotlib.table.html.template trunk/htdocs/matplotlib.texmanager.html.template trunk/htdocs/matplotlib.text.html.template trunk/htdocs/matplotlib.ticker.html.template trunk/htdocs/matplotlib.transforms.html.template trunk/htdocs/matplotlib.widgets.html.template trunk/htdocs/matplotlibrc trunk/htdocs/pylab_commands.html.template trunk/htdocs/screenshots/align_text_large.png trunk/htdocs/screenshots/align_text_small.png trunk/htdocs/screenshots/axes_demo_large.png trunk/htdocs/screenshots/axes_demo_small.png trunk/htdocs/screenshots/barchart_demo_large.png trunk/htdocs/screenshots/barchart_demo_small.png trunk/htdocs/screenshots/date_demo_large.png trunk/htdocs/screenshots/date_demo_small.png trunk/htdocs/screenshots/fill_demo_large.png trunk/htdocs/screenshots/fill_demo_small.png trunk/htdocs/screenshots/finance_work2_large.png trunk/htdocs/screenshots/finance_work2_small.png trunk/htdocs/screenshots/histogram_demo_large.png trunk/htdocs/screenshots/histogram_demo_small.png trunk/htdocs/screenshots/layer_images_large.png trunk/htdocs/screenshots/layer_images_small.png trunk/htdocs/screenshots/legend_demo_large.png trunk/htdocs/screenshots/legend_demo_small.png trunk/htdocs/screenshots/log_shot_large.png trunk/htdocs/screenshots/log_shot_small.png trunk/htdocs/screenshots/mathtext_demo_large.png trunk/htdocs/screenshots/mathtext_demo_small.png trunk/htdocs/screenshots/mri_with_eeg.py trunk/htdocs/screenshots/mri_with_eeg_large.png trunk/htdocs/screenshots/mri_with_eeg_small.png trunk/htdocs/screenshots/pcolor_demo_large.png trunk/htdocs/screenshots/pcolor_demo_small.png trunk/htdocs/screenshots/pfm-lsm.png trunk/htdocs/screenshots/pie_demo_large.png trunk/htdocs/screenshots/pie_demo_small.png trunk/htdocs/screenshots/polar_demo_large.png trunk/htdocs/screenshots/polar_demo_small.png trunk/htdocs/screenshots/scatter_demo2_large.png trunk/htdocs/screenshots/scatter_demo2_small.png trunk/htdocs/screenshots/simple_plot_large.png trunk/htdocs/screenshots/simple_plot_small.png trunk/htdocs/screenshots/slider_demo_large.png trunk/htdocs/screenshots/slider_demo_small.png trunk/htdocs/screenshots/table_demo_large.png trunk/htdocs/screenshots/table_demo_small.png trunk/htdocs/screenshots/tex_demo_large.png trunk/htdocs/screenshots/tex_demo_small.png trunk/htdocs/screenshots/text_themes_large.png trunk/htdocs/screenshots/text_themes_small.png trunk/htdocs/screenshots/wheeler_demo_large.png trunk/htdocs/screenshots/wheeler_demo_small.png trunk/htdocs/screenshots.html.template trunk/htdocs/tut/custom_axes.png trunk/htdocs/tut/date_demo2.png trunk/htdocs/tut/firstfig.png trunk/htdocs/tut/mathtext_tut.png trunk/htdocs/tut/secondfig.png trunk/htdocs/tut/subplot.png trunk/htdocs/tut/text_dict.png trunk/htdocs/tut/text_simple.png trunk/htdocs/tut/thirdfig.png trunk/htdocs/tutorial.html.template trunk/htdocs/whats_new.html.template Added Paths: ----------- trunk/htdocs/matplotlib.colorbar.html.template trunk/htdocs/matplotlib.contour.html.template trunk/htdocs/matplotlib.dviread.html.template trunk/htdocs/matplotlib.fontconfig_pattern.html.template trunk/htdocs/matplotlib.pyplot.html.template trunk/htdocs/matplotlib.quiver.html.template trunk/htdocs/matplotlib.rcsetup.html.template trunk/htdocs/matplotlib.type1font.html.template trunk/htdocs/matplotlib.units.html.template Modified: trunk/htdocs/API_CHANGES =================================================================== --- trunk/htdocs/API_CHANGES 2007年11月29日 16:28:07 UTC (rev 4502) +++ trunk/htdocs/API_CHANGES 2007年11月29日 19:42:34 UTC (rev 4503) @@ -1,3 +1,68 @@ +0.91.0 Released + + Changed cbook.is_file_like to cbook.is_writable_file_like and + corrected behavior. + + Added ax kwarg to pyplot.colorbar and Figure.colorbar so that + one can specify the axes object from which space for the colorbar + is to be taken, if one does not want to make the colorbar axes + manually. + + Changed cbook.reversed so it yields a tuple rather than a + (index, tuple). This agrees with the python reversed builtin, + and cbook only defines reversed if python doesnt provide the + builtin. + + Made skiprows=1 the default on csv2rec + + 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. + + The dviread.py file now has a parser for files like psfonts.map + and pdftex.map, to map TeX font names to external files. + + The file type1font.py contains a new class for Type 1 fonts. + Currently it simply reads pfa and pfb format files and stores the + data in a way that is suitable for embedding in pdf files. In the + future the class might actually parse the font to allow e.g. + subsetting. + + FT2Font now supports FT_Attach_File. In practice this can be used + to read an afm file in addition to a pfa/pfb file, to get metrics + and kerning information for a Type 1 font. + + The AFM class now supports querying CapHeight and stem widths. The + get_name_char method now has an isord kwarg like get_width_char. + + Changed pcolor default to shading='flat'; but as noted now in the + docstring, it is preferable to simply use the edgecolor kwarg. + + The mathtext font commands (\cal, \rm, \it, \tt) now behave as TeX + does: they are in effect until the next font change command or the + end of the grouping. Therefore uses of $\cal{R}$ should be + changed to ${\cal R}$. Alternatively, you may use the new + LaTeX-style font commands (\mathcal, \mathrm, \mathit, \mathtt) + which do affect the following group, eg. $\mathcal{R}$. + + Text creation commands have a new default linespacing and + a new linespacing kwarg, which is a multiple of the maximum + vertical extent of a line of ordinary text. The default is + 1.2; linespacing=2 would be like ordinary double spacing, for + example. + + Changed default kwarg in colors.Normalize.__init__ to clip=False; + clipping silently defeats the purpose of the special over, under, + and bad values in the colormap, thereby leading to unexpected + behavior. The new default should reduce such surprises. + + Made the emit property of set_xlim and set_ylim true by default; + removed the Axes custom callback handling into a 'callbacks' + attribute which is a cbook.CallbackRegistry instance. This now + supports the xlim_changed and ylim_changed Axes events. + 0.90.1 released The file dviread.py has a (very limited and fragile) dvi reader Modified: trunk/htdocs/CHANGELOG =================================================================== --- trunk/htdocs/CHANGELOG 2007年11月29日 16:28:07 UTC (rev 4502) +++ trunk/htdocs/CHANGELOG 2007年11月29日 19:42:34 UTC (rev 4503) @@ -1,3 +1,390 @@ +=============================================================== +2007年11月27日 Released 0.91.0 at revision 4478 + +2007年11月13日 All backends now support writing to a file-like object, not + just a regular file. savefig() can be passed a file-like + object in place of a file path. - MGD + +2007年11月13日 Improved the default backend selection at build time: + SVG -> Agg -> TkAgg -> WXAgg -> GTK -> GTKAgg. The last usable + backend in this progression will be chosen in the default + config file. If a backend is defined in setup.cfg, that will + be the default backend - DSD + +2007年11月13日 Improved creation of default config files at build time for + traited config package - DSD + +2007年11月12日 Exposed all the build options in setup.cfg. These options are + read into a dict called "options" by setupext.py. Also, added + "-mpl" tags to the version strings for packages provided by + matplotlib. Versions provided by mpl will be identified and + updated on subsequent installs - DSD + +2007年11月12日 Added support for STIX fonts. A new rcParam, + mathtext.fontset, can be used to choose between: + + 'cm': + The TeX/LaTeX Computer Modern fonts + + 'stix': + The STIX fonts (see stixfonts.org) + + 'stixsans': + The STIX fonts, using sans-serif glyphs by default + + 'custom': + A generic Unicode font, in which case the mathtext font + must be specified using mathtext.bf, mathtext.it, + mathtext.sf etc. + + Added a new example, stix_fonts_demo.py to show how to access + different fonts and unusual symbols. + + - MGD + +2007年11月12日 Options to disable building backend extension modules moved + from setup.py to setup.cfg - DSD + +2007年11月09日 Applied Martin Teichmann's patch 1828813: a QPainter is used in + paintEvent, which has to be destroyed using the method end(). If + matplotlib raises an exception before the call to end - and it + does if you feed it with bad data - this method end() is never + called and Qt4 will start spitting error messages + +2007年11月09日 Moved pyparsing back into matplotlib namespace. Don't use + system pyparsing, API is too variable from one release + to the next - DSD + +2007年11月08日 Made pylab use straight numpy instead of oldnumeric + by default - EF + +2007年11月08日 Added additional record array utilites to mlab (rec2excel, + rec2gtk, rec_join, rec_append_field, rec_drop_field) - JDH + +2007年11月08日 Updated pytz to version 2007g - DSD + +2007年11月08日 Updated pyparsing to version 1.4.8 - DSD + +2007年11月08日 Moved csv2rec to recutils and added other record array + utilities - JDH + +2007年11月08日 If available, use existing pyparsing installation - DSD + +2007年11月07日 Removed old enthought.traits from lib/matplotlib, added + Gael Varoquaux's enthought.traits-2.6b1, which is stripped + of setuptools. The package is installed to site-packages + if not already available - DSD + +2007年11月05日 Added easy access to minor tick properties; slight mod + of patch by Pierre G-M - EF + +2007年11月02日 Commited Phil Thompson's patch 1599876, fixes to Qt4Agg + backend and qt4 blitting demo - DSD + +2007年11月02日 Commited Phil Thompson's patch 1599876, fixes to Qt4Agg + backend and qt4 blitting demo - DSD + +2007年10月31日 Made log color scale easier to use with contourf; + automatic level generation now works. - EF + +2007年10月24日 Added ax kwarg to Figure.colorbar and pyplot.colorbar - EF + +2007年10月19日 Removed a gsave/grestore pair surrounding _draw_ps, which + was causing a loss graphics state info (see "EPS output + problem - scatter & edgecolors" on mpl-dev, 2007年10月29日) + - DSD + +2007年10月15日 Fixed a bug in patches.Ellipse that was broken for + aspect='auto'. Scale free ellipses now work properly for + equal and auto on Agg and PS, and they fall back on a + polygonal approximation for nonlinear transformations until + we convince oursleves that the spline approximation holds + for nonlinear transformations. Added + unit/ellipse_compare.py to compare spline with vertex + approx for both aspects. JDH + +2007年10月05日 remove generator expressions from texmanager and mpltraits. + generator expressions are not supported by python-2.3 - DSD + +2007年10月01日 Made matplotlib.use() raise an exception if called after + backends has been imported. - EF + +2007年09月30日 Modified update* methods of Bbox and Interval so they + work with reversed axes. Prior to this, trying to + set the ticks on a reversed axis failed with an + uninformative error message. - EF + +2007年09月30日 Applied patches to axes3d to fix index error problem - EF + +2007年09月24日 Applied Eike Welk's patch reported on mpl-dev on 2007年09月22日 + Fixes a bug with multiple plot windows in the qt backend, + ported the changes to backend_qt4 as well - DSD + +2007年09月21日 Changed cbook.reversed to yield the same result as the + python reversed builtin - DSD + +2007年09月13日 The usetex support in the pdf backend is more usable now, + so I am enabling it. - JKS + +2007年09月12日 Fixed a Axes.bar unit bug - JDH + +2007年09月10日 Made skiprows=1 the default on csv2rec - JDH + +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 + +2007年09月06日 Fixed a bug in the embedding of Type 1 fonts in PDF. + 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 + +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 + renaming _draw_tex to draw_tex. - JKS + +2007年09月03日 Added ability of errorbar show limits via caret or + arrowhead ends on the bars; patch by Manual Metz. - EF + +2007年09月03日 Created type1font.py, added features to AFM and FT2Font + (see API_CHANGES), started work on embedding Type 1 fonts + in pdf files. - JKS + +2007年09月02日 Continued work on dviread.py. - JKS + +2007年08月16日 Added a set_extent method to AxesImage, allow data extent + to be modified after initial call to imshow - DSD + +2007年08月14日 Fixed a bug in pyqt4 subplots-adjust. Thanks to + Xavier Gnata for the report and suggested fix - DSD + +2007年08月13日 Use pickle to cache entire fontManager; change to using + font_manager module-level function findfont wrapper for + the fontManager.findfont method - EF + +2007年08月11日 Numpification and cleanup of mlab.py and some examples - EF + +2007年08月06日 Removed mathtext2 + +2007年07月31日 Refactoring of distutils scripts. + - Will not fail on the entire build if an optional Python + package (e.g. Tkinter) is installed but its development + headers are not (e.g. tk-devel). Instead, it will + continue to build all other extensions. + - Provide an overview at the top of the output to display + what dependencies and their versions were found, and (by + extension) what will be built. + - Use pkg-config, when available, to find freetype2, since + this was broken on Mac OS-X when using MacPorts in a non- + standard location. + +2007年07月30日 Reorganized configuration code to work with traited config + objects. The new config system is located in the + matplotlib.config package, but it is disabled by default. + To enable it, set NEWCONFIG=True in matplotlib.__init__.py. + The new configuration system will still use the old + matplotlibrc files by default. To switch to the experimental, + traited configuration, set USE_TRAITED_CONFIG=True in + config.__init__.py. + +2007年07月29日 Changed default pcolor shading to flat; added aliases + to make collection kwargs agree with setter names, so + updating works; related minor cleanups. + Removed quiver_classic, scatter_classic, pcolor_classic. - EF + +2007年07月26日 Major rewrite of mathtext.py, using the TeX box layout model. + + There is one (known) backward incompatible change. The + font commands (\cal, \rm, \it, \tt) now behave as TeX does: + they are in effect until the next font change command or + the end of the grouping. Therefore uses of $\cal{R}$ + should be changed to ${\cal R}$. Alternatively, you may + use the new LaTeX-style font commands (\mathcal, \mathrm, + \mathit, \mathtt) which do affect the following group, + eg. $\mathcal{R}$. + + Other new features include: + + - Math may be interspersed with non-math text. Any text + with an even number of $'s (non-escaped) will be sent to + the mathtext parser for layout. + + - Sub/superscripts are less likely to accidentally overlap. + + - Support for sub/superscripts in either order, eg. $x^i_j$ + and $x_j^i$ are equivalent. + + - Double sub/superscripts (eg. $x_i_j$) are considered + ambiguous and raise an exception. Use braces to disambiguate. + + - $\frac{x}{y}$ can be used for displaying fractions. + + - $\sqrt[3]{x}$ can be used to display the radical symbol + with a root number and body. + + - $\left(\frac{x}{y}\right)$ may be used to create + parentheses and other delimiters that automatically + resize to the height of their contents. + + - Spacing around operators etc. is now generally more like + TeX. + + - Added support (and fonts) for boldface (\bf) and + sans-serif (\sf) symbols. + + - Log-like function name shortcuts are supported. For + example, $\sin(x)$ may be used instead of ${\rm sin}(x)$ + + - Limited use of kerning for the easy case (same font) + + Behind the scenes, the pyparsing.py module used for doing + the math parsing was updated to the latest stable version + (1.4.6). A lot of duplicate code was refactored out of the + Font classes. + + - MGD + +2007年07月19日 completed numpification of most trivial cases - NN + +2007年07月19日 converted non-numpy relicts throughout the code - NN + +2007年07月19日 replaced the Python code in numerix/ by a minimal wrapper around + numpy that explicitly mentions all symbols that need to be + addressed for further numpification - NN + +2007年07月18日 make usetex respect changes to rcParams. texmanager used to + only configure itself when it was created, now it + reconfigures when rcParams are changed. Thank you Alexander + Schmolck for contributing a patch - DSD + +2007年07月17日 added validation to setting and changing rcParams - DSD + +2007年07月17日 bugfix segfault in transforms module. Thanks Ben North for + the patch. - ADS + +2007年07月16日 clean up some code in ticker.ScalarFormatter, use unicode to + render multiplication sign in offset ticklabel - DSD + +2007年07月16日 fixed a formatting bug in ticker.ScalarFormatter's scientific + notation (10^0 was being rendered as 10 in some cases) - DSD + +2007年07月13日 Add MPL_isfinite64() and MPL_isinf64() for testing + doubles in (the now misnamed) MPL_isnan.h. - ADS + +2007年07月13日 The matplotlib._isnan module removed (use numpy.isnan) - ADS + +2007年07月13日 Some minor cleanups in _transforms.cpp - ADS + +2007年07月13日 Removed the rest of the numerix extension code detritus, + numpified axes.py, and cleaned up the imports in axes.py + - JDH + +2007年07月13日 Added legend.loc as configurable option that could in + future default to 'best'. - NN + +2007年07月12日 Bugfixes in mlab.py to coerce inputs into numpy arrays. -ADS + +2007年07月11日 Added linespacing kwarg to text.Text - EF + +2007年07月11日 Added code to store font paths in SVG files. - MGD + +2007年07月10日 Store subset of TTF font as a Type 3 font in PDF files. - MGD + +2007年07月09日 Store subset of TTF font as a Type 3 font in PS files. - MGD + +2007年07月09日 Applied Paul's pick restructure pick and add pickers, + sourceforge patch 1749829 - JDH + + +2007年07月09日 Applied Allan's draw_lines agg optimization. JDH + + +2007年07月08日 Applied Carl Worth's patch to fix cairo draw_arc - SC + +2007年07月07日 fixed bug 1712099: xpdf distiller on windows - DSD + +2007年06月30日 Applied patches to tkagg, gtk, and wx backends to reduce + memory leakage. Patches supplied by Mike Droettboom; + see tracker numbers 1745400, 1745406, 1745408. + Also made unit/memleak_gui.py more flexible with + command-line options. - EF + +2007年06月30日 Split defaultParams into separate file rcdefaults (together with + validation code). Some heavy refactoring was necessary to do so, + but the overall behavior should be the same as before. - NN + +2007年06月27日 Added MPLCONFIGDIR for the default location for mpl data + and configuration. useful for some apache installs where + HOME is not writable. Tried to clean up the logic in + _get_config_dir to support non-writable HOME where are + writable HOME/.matplotlib already exists - JDH + +2007年06月27日 Fixed locale bug reported at + http://sourceforge.net/tracker/index.php?func=detail&aid=1744154&group_id=80706&atid=560720 + by adding a cbook.unicode_safe function - JDH + +2007年06月27日 Applied Micheal's tk savefig bugfix described at + http://sourceforge.net/tracker/index.php?func=detail&aid=1716732&group_id=80706&atid=560720 + Thanks Michael! + + +2007年06月27日 Patch for get_py2exe_datafiles() to work with new directory + layout. (Thanks Tocer and also Werner Bruhin.) -ADS + + +2007年06月27日 Added a scroll event to the mpl event handling system and + implemented it for backends GTK* -- other backend + users/developers/maintainers, please add support for your + backend. - JDH + +2007年06月25日 Changed default to clip=False in colors.Normalize; + modified ColorbarBase for easier colormap display - EF + +2007年06月13日 Added maskedarray option to rc, numerix - EF + +2007年06月11日 Python 2.5 compatibility fix for mlab.py - EF + +2007年06月10日 In matplotlibrc file, use 'dashed' | 'solid' instead + of a pair of floats for contour.negative_linestyle - EF + +2007年06月08日 Allow plot and fill fmt string to be any mpl string + colorspec - EF + +2007年06月08日 Added gnuplot file plotfile function to pylab -- see + examples/plotfile_demo.py - JDH + +2007年06月07日 Disable build of numarray and Numeric extensions for + internal MPL use and the numerix layer. - ADS + +2007年06月07日 Added csv2rec to matplotlib.mlab to support automatically + converting csv files to record arrays using type + introspection, and turned on native datetime support using + the new units support in matplotlib.dates. See + examples/loadrec.py ! JDH + +2007年06月07日 Simplified internal code of _auto_legend_data - NN + 2007年06月04日 Added labeldistance arg to Axes.pie to control the raidal distance of the wedge labels - JDH @@ -380,35 +767,35 @@ 2006年10月10日 deactivated rcfile-configurability of markerfacecolor and markeredgecolor. Both are now hardcoded to the special value - 'auto' to follow the line color. Configurability at run-time - (using function arguments) remains functional. - NN + 'auto' to follow the line color. Configurability at run-time + (using function arguments) remains functional. - NN 2006年10月07日 introduced dummy argument magnification=1.0 to FigImage.make_image to satisfy unit test figimage_demo.py The argument is not yet handled correctly, which should only - show up when using non-standard DPI settings in PS backend, - introduced by patch #1562394. - NN + show up when using non-standard DPI settings in PS backend, + introduced by patch #1562394. - NN 2006年10月06日 add backend-agnostic example: simple3d.py - NN 2006年09月29日 fix line-breaking for SVG-inline images (purely cosmetic) - NN 2006年09月29日 reworked set_linestyle and set_marker - markeredgecolor and markerfacecolor now default to - a special value "auto" that keeps the color in sync with - the line color - further, the intelligence of axes.plot is cleaned up, - improved and simplified. Complete compatibility cannot be - guaranteed, but the new behavior should be much more predictable - (see patch #1104615 for details) - NN + markeredgecolor and markerfacecolor now default to + a special value "auto" that keeps the color in sync with + the line color + further, the intelligence of axes.plot is cleaned up, + improved and simplified. Complete compatibility cannot be + guaranteed, but the new behavior should be much more predictable + (see patch #1104615 for details) - NN 2006年09月29日 changed implementation of clip-path in SVG to work around a limitation in inkscape - NN 2006年09月29日 added two options to matplotlibrc: - svg.image_inline - svg.image_noscale - see patch #1533010 for details - NN + svg.image_inline + svg.image_noscale + see patch #1533010 for details - NN 2006年09月29日 axes.py: cleaned up kwargs checking - NN @@ -439,8 +826,8 @@ 2006年09月05日 Released 0.87.5 at revision 2761 2006年09月04日 Added nxutils for some numeric add-on extension code -- - specifically a better/more efficient inside polygon tester (see - unit/inside_poly_*.py) - JDH + specifically a better/more efficient inside polygon tester (see + unit/inside_poly_*.py) - JDH 2006年09月04日 Made bitstream fonts the rc default - JDH @@ -785,7 +1172,7 @@ 2006年03月20日 Added contour.negative_linestyle rcParam - ADS 2006年03月20日 Added _isnan extension module to test for nan with Numeric - - ADS + - ADS 2006年03月17日 Added Paul and Alex's support for faceting with quadmesh in sf patch 1411223 - JDH @@ -1132,7 +1519,7 @@ 2005年11月09日 added axisbelow attr for Axes to determine whether ticks and such - are above or below the actors + are above or below the actors 2005年11月08日 Added Nicolas' irregularly spaced image patch @@ -1289,7 +1676,7 @@ 2005年07月24日 backend_gtk.py: modify print_figure() use own pixmap, fixing problems where print_figure() overwrites the display pixmap. - return False from all button/key etc events - to allow the event + return False from all button/key etc events - to allow the event to propagate further - SC 2005年07月23日 backend_gtk.py: change expose_event from using set_back_pixmap(); @@ -1311,7 +1698,7 @@ 2005年07月14日 Fixed a Windows related bug (#1238412) in texmanager - DSD 2005年07月11日 Fixed color kwarg bug, setting color=1 or 0 caused an - exception - DSD + exception - DSD 2005年07月07日 Added Eric's MA set_xdata Line2D fix - JDH @@ -1413,10 +1800,10 @@ 2005年06月13日 Exposed cap and join style for lines with new rc params and line properties - lines.dash_joinstyle : miter # miter|round|bevel - lines.dash_capstyle : butt # butt|round|projecting - lines.solid_joinstyle : miter # miter|round|bevel - lines.solid_capstyle : projecting # butt|round|projecting + lines.dash_joinstyle : miter # miter|round|bevel + lines.dash_capstyle : butt # butt|round|projecting + lines.solid_joinstyle : miter # miter|round|bevel + lines.solid_capstyle : projecting # butt|round|projecting 2005年06月13日 Added kwargs to Axes init @@ -1530,9 +1917,9 @@ for the interp kwarg are 'nearest', 'bilinear', 'bicubic', 'spline16', 'spline36', - 'hanning', 'hamming', 'hermite', 'kaiser', 'quadric', - 'catrom', 'gaussian', 'bessel', 'mitchell', 'sinc', - 'lanczos', 'blackman' + 'hanning', 'hamming', 'hermite', 'kaiser', 'quadric', + 'catrom', 'gaussian', 'bessel', 'mitchell', 'sinc', + 'lanczos', 'blackman' See help(imshow) for details, particularly the interpolation, filternorm and filterrad kwargs Modified: trunk/htdocs/backends.html.template =================================================================== --- trunk/htdocs/backends.html.template 2007年11月29日 16:28:07 UTC (rev 4502) +++ trunk/htdocs/backends.html.template 2007年11月29日 19:42:34 UTC (rev 4503) @@ -4,8 +4,8 @@ The matplotlib core graphics routines interact with an abstract renderer and graphics context to allow device independent ouput. -Currently, output to pygtk, wxPython, Tkinter, postscript, gdmodule, -libart/paint, svg, agg (antigrain geometry) and Cairo are supported. With +Currently, output to pygtk, wxPython, Tkinter, postscript, +pdf, svg, agg (antigrain geometry) and Cairo are supported. With not too much effort, you can port matplotlib to your favorite display; high on my list of priorities are PDF and PIL. If you are interested in porting to one of these platforms, please contact me!<p> @@ -35,24 +35,22 @@ > python subplot_demo.py -dAgg # antigrain geometry backend image > python subplot_demo.py -dCairo # Cairo backend > python subplot_demo.py -dPS # postscript backend +> python subplot_demo.py -dPDF # pdf backend > python subplot_demo.py -dSVG # SVG backend -> python subplot_demo.py -dGD # GD backend -> python subplot_demo.py -dPaint # Paint backend -> python subplot_demo.py -dEMF # EMF backend </pre> For backends that do not have a GUI, no output will be produced unless -a call to <a href=matplotlib.pylab.html#-savefig>savefig</a> is made. +a call to <a href=matplotlib.pyplot.html#-savefig>savefig</a> is made. The recommended way to use the savefig function is to not give an extension. The backends will choose the proper extension. This allows you to write a single script and select the output format from the command line. So a script containing <tt>savefig('somefile')</tt> will create <tt>somefile.ps</tt> if called with <tt>-dPS</tt> and -<tt>somefile.png</tt> if called with <tt>-dGD</tt>, and so on.<p> +<tt>somefile.png</tt> if called with <tt>-dAgg</tt>, and so on.<p> Alternatively, you can select the backend renderer in your script by -calling the matplotlib <a href=matplotlib.pylab.html#-use>use</a> +calling the matplotlib <a href=matplotlib.pyplot.html#-use>use</a> function. At the top of your script (before you <tt>import matplotlib.pylab</tt>, just do, for example @@ -69,12 +67,11 @@ href=matplotlib.backends.backend_gtkagg.html>GTKAgg</a>, <a href=matplotlib.backends.backend_gtkcairo.html>GTKCairo</a>, <a href=matplotlib.backends.backend_ps.html>PS</a>, <a +href=matplotlib.backends.backend_pdf.html>PDF</a>, <a +href=matplotlib.backends.backend_svg.html>SVG</a>, <a href=matplotlib.backends.backend_tkagg.html>TkAgg</a>, <a href=matplotlib.backends.backend_wx.html>WX</a>, <a href=matplotlib.backends.backend_wxagg.html>WXAgg</a>, <a -href=matplotlib.backends.backend_paint.html>Paint</a>, <a -href=matplotlib.backends.backend_gd.html>GD</a>, <a -href=matplotlib.backends.backend_emf.html>EMF</a> and <a href=matplotlib.backends.backend_template.html>Template</a>. The default is GTKAgg. Template is a do nothing backend that serves as a @@ -87,12 +84,9 @@ <h2>Backend requirements</h2> Each of the backends have a different set of requirements, listed -below. All require the <a -href=http://sourceforge.net/projects/numpy>Numeric or numarray</a> -modules. Note, matplotlib can also be made to work with numarray with -minor changes; see the <a href=faq.html#NUMARRAY>FAQ</a>.<p> +below. All require <a href=http://numpy.scipy.org/>numpy</a> +modules. - Specific information for installing the other backends can be found on this page below or by clicking <ul> @@ -105,9 +99,6 @@ <li><a href=backends.html#WX>WX</a></li> <li><a href=backends.html#WXAgg>WXAgg</a></li> <li><a href=backends.html#PS>PS</a></li> -<li><a href=backends.html#Paint>Paint</a></li> -<li><a href=backends.html#GD>GD</a></li> -<li><a href=backends.html#EMF>EMF</a></li> </ul> @@ -144,7 +135,7 @@ <ul> - <li><a href=http://www.pfdubois.com/numpy>Numeric/numarray</a></li> + <li><a href=http://numpy.scipy.org/>numpy</a></li> <li><a href=http://prdownloads.sourceforge.net/gtk-win> GTK runtime</a></li> @@ -175,9 +166,7 @@ href=http://matplotlib.sourceforge.net/faq.html#GTKPATH>the FAQ</a><ul> -<li>Install <a -href=http://sourceforge.net/project/showfiles.php?group_id=1369&release_id=176455> -Numeric/numarray</a>. If you are using the enthought edition of +<li>Install <a href=http://numpy.scipy.org/>numpy</a>. If you are using the enthought edition of python, you can skip this step.</li> <li>Install the <a href=http://prdownloads.sourceforge.net/gtk-win> @@ -203,7 +192,7 @@ Requires <a href=http://www.wxpython.org>wxpython</a>. Windows users may want to consider the <a href=http://www.enthought.com/python>enthought edition</a> of python, -which comes with wxpython and Numeric built in, so matplotlib will +which comes with wxpython and numpy built in, so matplotlib will work right out of the box. matplotlib under WX has been tested on linux, win32 and OSX.<p> @@ -212,7 +201,7 @@ Requires <a href=http://www.wxpython.org>wxpython</a>. Windows users may want to consider the <a href=http://www.enthought.com/python>enthought edition</a> of python, -which comes with wxpython and Numeric built in, so matplotlib will +which comes with wxpython and numpy built in, so matplotlib will work right out of the box. matplotlib under WXAgg has been tested on linux, win32 and OSX.<p> @@ -278,54 +267,10 @@ the same problem with Tkinter may be affecting both (SciTE and Pythonwin)... but I am out on a limb.<p> -<h3><a name=GD>GD output</a></h3> -The recommended image backend is Agg. If you are sure you want to use -GD, read on.<p> - -The GD module can be used to create images with no X11 server, and is -particularly useful for web application developers who want dynamic -graphing capabilities. There are a number of prerequisites but they -are easy to install (Windows users should skip ahead to the win32 -section).<p> - -The GD backend depends on Numeric/numarray, gdmodule, and gd. To ease -installation, the latter two packages now ship with matplotlib. Below -are instructions for building gdmodule. - - <ul> - - <li><a href=http://www.pfdubois.com/numpy>Numeric/numarray</a> -- - Numeric processing in python</li> - - <li><a href=http://www.boutell.com/gd>GD lib</a> -- The GD library. - Note if you are using linux and have this installed in /usr/lib, you - will need to install the latest version over the existing install - unless you have gd-2.0.22 or later</li> - - <li><a - href=http://newcenturycomputers.net/projects/gdmodule.html>gdmodule-0.52</a> - -- The python interface to the gd module.</li> - - </ul> - -<h4><a name=GDWIN32>Quick install guide for GD output: Windows</a></h4> - -In addition to Numeric, you'll need - -<ul> - -<li> The GD DLL <a href=gd/bgd.dll>bgd.dll</a> somewhere in your -PATH</li> - -<li> gdmodule for win32 and python2.3 <a href=gd/gdmodule-0.52a.win32-py2.3.exe >gdmodule-0.52a</a>.</li> - -</ul> - <a name=PS><h3>Postscript</h3></a> -The only requirement is <a -href=http://sourceforge.net/projects/numpy>Numeric/numarray</a><p> +The only requirement is <a href=http://numpy.scipy.org/>numpy</a><p> See the <a href=fonts.html#PSFONTS>fonts page</a> for more information about getting the postscript backend setup for proper font rendering; @@ -334,37 +279,8 @@ ship with matplotlib. -<a name=Paint><h3>Paint</h3></a> -David Moore has written a paint backend for matplotlib. paint is a <a -href=http://www.levien.com/libart>libart</a> wrapper</a>. In a -nutshell, libart is a svg oriented, high performance, 2D graphics -engine that supports lots of nifty features. The paint backend -exposes some of them, and David has been extending it to expose more.<p> -The paint backend requires <a -href=http://sourceforge.net/projects/numpy>Numeric/numarray</a>, <a -href=http://sourceforge.net/projects/pypaint>pypaint</a> version 0.3. - -libart is highly portable, and the paint backend has been confirmed to -work on win32 and linux. The pypaint web site has a src distribution -and a windows installer.<p> - - - -<a name=EMF><h3>EMF</h3></a> - -Rob McMullen has written an Enhanced Metafile (EMF) backend for -matplotlib, which requires <a -href="http://pyemf.sourceforge.net">pyemf</a> version 2.0.0b1 (or -newer). EMF is a vector graphics format supported by the -cross-platform OpenOffice suite as well as most Windows office -applications. EMF images can also be embedded within Rich Text Format -(.rtf) files to create a single document with multiple plots. <p> - - - - @footer@ Modified: trunk/htdocs/classdocs.html.template =================================================================== --- trunk/htdocs/classdocs.html.template 2007年11月29日 16:28:07 UTC (rev 4502) +++ trunk/htdocs/classdocs.html.template 2007年11月29日 19:42:34 UTC (rev 4503) @@ -18,7 +18,7 @@ ('lines', 'The Line2D classes'), ('mathtext', 'Use TeX expressions in text'), ('mlab', 'Non-graphical matlab® funcs to compliment MLab'), - ('numerix', 'Choose Numeric or numarray'), + ('numerix', 'Choose Numeric, numarray or numpy'), ('patches', 'Rectangles, polygons, circles, etc...'), ('pylab', 'The matlab® functional interface'), ('table', 'Table class'), Modified: trunk/htdocs/convert.py =================================================================== --- trunk/htdocs/convert.py 2007年11月29日 16:28:07 UTC (rev 4502) +++ trunk/htdocs/convert.py 2007年11月29日 19:42:34 UTC (rev 4503) @@ -20,7 +20,7 @@ class NewsBox: def __init__(self, body, title='News Flash'): self.body = body - self.title + self.title = title def format_header(self): return """ @@ -187,18 +187,10 @@ # re-add news to the params dict 'tables' entry below for news news1 = NewsBox("""matplotlib <a -href="http://sourceforge.net/project/showfiles.php?group_id=80706&package_id=82474">0.90.1</a> -is out. The 0.90 series is the last release that will continue to -support Numeric, numarray and numpy. At 0.91, we will be using numpy -only internally, though we will continue to provide the <a -href=matplotlib.numerix.html>numerix</a> compaitibility layer for -external use. """, title='New release') +href="http://sourceforge.net/project/showfiles.php?group_id=80706&package_id=82474">0.91.0</a> +is out. See <a href=whats_new.html>what's new</a> for a summary of new features. """, title='New release') -news2 = NewsBox(""" -If you are upgrading matplotlib from an earlier version, please make sure you are using the most recent matplotlib configuration file because we have made a number of organizational changes. See <a href=matplotlibrc>matplotlibrc<a/> for information about typical locations of your configuration files and directories. See also the <a href=faq.html#FONTMISSING>missing fonts FAQ</a>. -""", title='Missing fonts') - table1 = LinkBox(header='Matplotlib', links=( ('Home', 'http://matplotlib.sourceforge.net'), #('Donate', 'donations.html'), @@ -233,7 +225,7 @@ params = { 'myemail' : '<a href=mailto:jdh...@ac...> (jdh...@ac...)</a>', - 'tables' : (news1, news2, table1, table2, table3), + 'tables' : (news1, table1, table2, table3), 'default_table' : 'border=1 cellpadding=3 cellspacing=2', } Modified: trunk/htdocs/credits.html.template =================================================================== --- trunk/htdocs/credits.html.template 2007年11月29日 16:28:07 UTC (rev 4502) +++ trunk/htdocs/credits.html.template 2007年11月29日 19:42:34 UTC (rev 4503) @@ -72,7 +72,7 @@ cleaning up backend imports and expanding pylab functionality, and provided matplotlib support in the pylab mode for <a href=http://ipython.scipy.org>ipython</a>. He also provided the <a - href=matplotlib.pylab.html#-matshow>matshow</a> command.</li> + href=matplotlib.pyplot.html#-matshow>matshow</a> command.</li> <li>Andrew Dalke of Dalke Scientific Software contributed the strftime formatting code to handle years earlier than 1900</li> Modified: trunk/htdocs/examples/agg_resize.py =================================================================== --- trunk/htdocs/examples/agg_resize.py 2007年11月29日 16:28:07 UTC (rev 4502) +++ trunk/htdocs/examples/agg_resize.py 2007年11月29日 19:42:34 UTC (rev 4503) @@ -4,4 +4,4 @@ imMatrix = agg.trans_affine(1,0,0,1,0,0) -interp = agg.span_interpolator_linear(imMatrix); +interp = agg.span_interpolator_linear(imMatrix); Modified: trunk/htdocs/examples/agg_test.py =================================================================== --- trunk/htdocs/examples/agg_test.py 2007年11月29日 16:28:07 UTC (rev 4502) +++ trunk/htdocs/examples/agg_test.py 2007年11月29日 19:42:34 UTC (rev 4503) @@ -22,7 +22,7 @@ pf = agg.pixel_format_rgba(rbuf) rbase = agg.renderer_base_rgba(pf) -rbase.clear_rgba8(blue) +rbase.clear_rgba8(blue) renderer = agg.renderer_scanline_aa_solid_rgba(rbase); renderer.color_rgba8( red ) @@ -106,39 +106,42 @@ renderer.color_rgba8( white ) agg.render_scanlines_rgba(rasterizer, scanline, renderer); -## Copy a rectangle from the buffer the rectangle defined by -## x0,y0->x1,y1 and paste it at xdest, ydest -x0, y0 = 10, 50 -x1, y1 = 110, 190 -xdest, ydest = 350, 200 +if 0: + ## Copy a rectangle from the buffer the rectangle defined by + ## x0,y0->x1,y1 and paste it at xdest, ydest + x0, y0 = 10, 50 + x1, y1 = 110, 190 + xdest, ydest = 350, 200 -widthr, heightr = x1-x0, y1-y0 -strider = widthr*4 -copybuffer = agg.buffer(widthr, heightr, strider) -rbufcopy = agg.rendering_buffer() -rbufcopy.attachb(copybuffer) -pfcopy = agg.pixel_format_rgba(rbufcopy) -rbasecopy = agg.renderer_base_rgba(pfcopy) + widthr, heightr = x1-x0, y1-y0 + strider = widthr*4 + copybuffer = agg.buffer(widthr, heightr, strider) -rect = agg.rect(x0, y0, x1, y1) -print rect.is_valid() -rectp = agg.rectPtr(rect) -#print dir(rbasecopy) -# agg is funny about the arguments to copy from; the last 2 args are -# dx, dy. If the src and dest buffers are the same size and you omit -# the dx and dy args, the position of the copy in the dest buffer is -# the same as in the src. Since our dest buffer is smaller than our -# src buffer, we have to offset the location by -x0, -y0 -rbasecopy.copy_from(rbuf, rect, -x0, -y0); + rbufcopy = agg.rendering_buffer() + rbufcopy.attachb(copybuffer) + pfcopy = agg.pixel_format_rgba(rbufcopy) + rbasecopy = agg.renderer_base_rgba(pfcopy) -# paste the rectangle at a new location xdest, ydest -rbase.copy_from(rbufcopy, None, xdest, ydest); + rect = agg.rect(x0, y0, x1, y1) + print rect.is_valid() + rectp = agg.rectPtr(rect) + #print dir(rbasecopy) + # agg is funny about the arguments to copy from; the last 2 args are + # dx, dy. If the src and dest buffers are the same size and you omit + # the dx and dy args, the position of the copy in the dest buffer is + # the same as in the src. Since our dest buffer is smaller than our + # src buffer, we have to offset the location by -x0, -y0 + rbasecopy.copy_from(rbuf, rect, -x0, -y0); + # paste the rectangle at a new location xdest, ydest + rbase.copy_from(rbufcopy, None, xdest, ydest); + + ## Display it with PIL s = buffer.to_string() print len(s) Modified: trunk/htdocs/examples/anscombe.py =================================================================== --- trunk/htdocs/examples/anscombe.py 2007年11月29日 16:28:07 UTC (rev 4502) +++ trunk/htdocs/examples/anscombe.py 2007年11月29日 19:42:34 UTC (rev 4503) @@ -25,7 +25,7 @@ subplot(221) plot(x,y1,'ks', xfit, fit(xfit), 'r-', lw=2) -axis([2,20,2,14]) +axis([2,20,2,14]) setp(gca(), xticklabels=[], yticks=(4,8,12), xticks=(0,10,20)) text(3,12, 'I', fontsize=20) Modified: trunk/htdocs/examples/axes_demo.py =================================================================== --- trunk/htdocs/examples/axes_demo.py 2007年11月29日 16:28:07 UTC (rev 4502) +++ trunk/htdocs/examples/axes_demo.py 2007年11月29日 19:42:34 UTC (rev 4503) @@ -1,5 +1,5 @@ #!/usr/bin/env python - + from pylab import * # create some data to use for the plot @@ -7,7 +7,7 @@ t = arange(0.0, 10.0, dt) r = exp(-t[:1000]/0.05) # impulse response x = randn(len(t)) -s = conv(x,r)[:len(x)]*dt # colored noise +s = convolve(x,r)[:len(x)]*dt # colored noise # the main axes is subplot(111) by default plot(t, s) @@ -27,7 +27,7 @@ plot(t[:len(r)], r) title('Impulse response') setp(a, xlim=(0,.2), xticks=[], yticks=[]) - + #savefig('../figures/axes_demo.eps') #savefig('../figures/axes_demo.png') show() Modified: trunk/htdocs/examples/axes_props.py =================================================================== --- trunk/htdocs/examples/axes_props.py 2007年11月29日 16:28:07 UTC (rev 4502) +++ trunk/htdocs/examples/axes_props.py 2007年11月29日 19:42:34 UTC (rev 4503) @@ -42,9 +42,9 @@ ticklines = ax.get_xticklines() ticklines.extend( ax.get_yticklines() ) -gridlines = ax.get_xgridlines() +gridlines = ax.get_xgridlines() gridlines.extend( ax.get_ygridlines() ) -ticklabels = ax.get_xticklabels() +ticklabels = ax.get_xticklabels() ticklabels.extend( ax.get_yticklabels() ) for line in ticklines: Modified: trunk/htdocs/examples/backend_driver.py =================================================================== --- trunk/htdocs/examples/backend_driver.py 2007年11月29日 16:28:07 UTC (rev 4502) +++ trunk/htdocs/examples/backend_driver.py 2007年11月29日 19:42:34 UTC (rev 4503) @@ -1,38 +1,62 @@ #!/usr/bin/env python """ This is used to drive many of the examples across the backends, for -regression testing, and comparing backend efficiency +regression testing, and comparing backend efficiency. + +The script takes one or more arguments specifying backends +to be tested, e.g. + + python backend_driver.py agg ps cairo.png cairo.ps + +would test the agg and ps backends, and the cairo backend with +output to png and ps files. + +If no arguments are given, a default list of backends will be +tested. """ from __future__ import division import os, time, sys +import matplotlib.backends as mplbe + files = ( 'alignment_test.py', 'arctest.py', + 'arrow_demo.py', 'axes_demo.py', + 'axhspan_demo.py', 'bar_stacked.py', 'barchart_demo.py', + 'boxplot_demo.py', + 'broken_barh.py', + 'barh_demo.py', 'color_demo.py', + 'colorbar_only.py', + 'cohere_demo.py', 'contour_demo.py', 'contourf_demo.py', - 'csd_demo.py', + 'csd_demo.py', 'custom_ticker1.py', 'customize_rc.py', 'date_demo1.py', 'date_demo2.py', + 'equal_aspect_ratio.py', + 'errorbar_limits.py', 'figimage_demo.py', 'figlegend_demo.py', 'figtext.py', 'fill_demo.py', 'finance_demo.py', -# 'fonts_demo_kw.py', + 'fonts_demo_kw.py', 'histogram_demo.py', + 'hline_demo.py', 'image_demo.py', 'image_demo2.py', - 'image_demo_na.py', + 'image_masked.py', 'image_origin.py', 'invert_axes.py', 'layer_images.py', + 'legend_auto.py', 'legend_demo.py', 'legend_demo2.py', 'line_collection.py', @@ -53,11 +77,18 @@ 'polar_demo.py', 'polar_scatter.py', 'psd_demo.py', + 'quadmesh_demo.py', 'quiver_demo.py', 'scatter_demo.py', 'scatter_demo2.py', + 'scatter_star_poly.py', + 'shared_axis_demo.py', + 'shared_axis_across_figures.py', 'simple_plot.py', 'specgram_demo.py', + 'spy_demos.py', + 'stem_plot.py', + 'step_demo.py', 'stock_demo.py', 'subplot_demo.py', # 'set_and_get.py', @@ -74,39 +105,52 @@ ) -#tests known to fail on python22 (require datetime) -fail22 = ( - 'date_demo1.py', - 'date_demo2.py', - 'finance_demo.py', - ) - - # tests known to fail on a given backend failbackend = dict( SVG = ('tex_demo.py,'), ) -def drive(backend, python='python'): +try: + import subprocess + def run(arglist): + try: + subprocess.call(arglist) + except KeyboardInterrupt: + sys.exit() +except ImportError: + def run(arglist): + os.system(' '.join(arglist)) +def drive(backend, python=['python'], switches = []): exclude = failbackend.get(backend, []) - + # Strip off the format specifier, if any. + if backend.startswith('cairo'): + _backend = 'cairo' + else: + _backend = backend for fname in files: if fname in exclude: print '\tSkipping %s, known to fail on backend: %s'%backend continue - print '\tdriving %s' % fname + print ('\tdriving %-40s' % (fname)), basename, ext = os.path.splitext(fname) outfile = basename + '_%s'%backend tmpfile_name = '_tmp_%s.py' % basename tmpfile = file(tmpfile_name, 'w') + for line in file(fname): + line_lstrip = line.lstrip() + if line_lstrip.startswith("#"): + tmpfile.write(line) + else: + break + tmpfile.writelines(( 'from __future__ import division\n', 'import matplotlib\n', - 'matplotlib.use("%s")\n' % backend, + 'matplotlib.use("%s")\n' % _backend, 'from pylab import savefig\n', )) for line in file(fname): @@ -117,36 +161,43 @@ line_lstrip.startswith('show')): continue tmpfile.write(line) - if backend in ('GTK', 'WX', 'TkAgg'): + if backend in mplbe.interactive_bk: tmpfile.write('show()') else: tmpfile.write('savefig("%s", dpi=150)' % outfile) tmpfile.close() - os.system('%s %s' % (python, tmpfile_name)) + start_time = time.time() + run(python + [tmpfile_name, switchstring]) + end_time = time.time() + print (end_time - start_time) + #os.system('%s %s %s' % (python, tmpfile_name, switchstring)) os.remove(tmpfile_name) - if __name__ == '__main__': times = {} - # backends = ['Agg', 'Cairo', 'GDK', 'PS', 'SVG', 'Template'] - #backends = ['Agg', 'PS', 'SVG', 'Template'] - # backends = [ 'GTK', 'WX', 'TkAgg'] - default_backends = ['Agg', 'PS', 'SVG', 'Template'] - #default_backends = ['Agg'] - #backends = ['Agg'] - if sys.platform == 'win32': - python = r'c:\Python24\python.exe' + default_backends = ['Agg', 'PS', 'SVG', 'PDF', 'Template'] + if '--coverage' in sys.argv: + python = ['coverage.py', '-x'] + sys.argv.remove('--coverage') + elif sys.platform == 'win32': + python = [r'c:\Python24\python.exe'] else: - python = 'python' + python = ['python'] + all_backends = [b.lower() for b in mplbe.all_backends] + all_backends.extend(['cairo.png', 'cairo.ps', 'cairo.pdf', 'cairo.svg']) + backends = [] + switches = [] if sys.argv[1:]: - backends = [b for b in sys.argv[1:] if b in default_backends] - else: + backends = [b.lower() for b in sys.argv[1:] if b.lower() in all_backends] + switches = [s for s in sys.argv[1:] if s.startswith('--')] + if not backends: backends = default_backends for backend in backends: - print 'testing %s' % backend + switchstring = ' '.join(switches) + print 'testing %s %s' % (backend, switchstring) t0 = time.time() - drive(backend, python) + drive(backend, python, switches) t1 = time.time() times[backend] = (t1-t0)/60.0 Modified: trunk/htdocs/examples/color_by_yvalue.py =================================================================== --- trunk/htdocs/examples/color_by_yvalue.py 2007年11月29日 16:28:07 UTC (rev 4502) +++ trunk/htdocs/examples/color_by_yvalue.py 2007年11月29日 19:42:34 UTC (rev 4503) @@ -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/htdocs/examples/colours.py =================================================================== --- trunk/htdocs/examples/colours.py 2007年11月29日 16:28:07 UTC (rev 4502) +++ trunk/htdocs/examples/colours.py 2007年11月29日 19:42:34 UTC (rev 4503) @@ -2,22 +2,20 @@ """ Some simple functions to generate colours. """ -from matplotlib.numerix import asarray, asum -from matplotlib.mlab import linspace +import numpy as npy from matplotlib.colors import colorConverter... [truncated message content]
Revision: 4502 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4502&view=rev Author: jdh2358 Date: 2007年11月29日 08:28:07 -0800 (2007年11月29日) Log Message: ----------- Modified Paths: -------------- trunk/htdocs/credits.html.template trunk/htdocs/hthelpers.py trunk/htdocs/screenshots/align_text_large.png trunk/htdocs/screenshots/align_text_small.png trunk/htdocs/screenshots/axes_demo_large.png trunk/htdocs/screenshots/axes_demo_small.png trunk/htdocs/screenshots/barchart_demo_large.png trunk/htdocs/screenshots/barchart_demo_small.png trunk/htdocs/screenshots/date_demo_large.png trunk/htdocs/screenshots/date_demo_small.png trunk/htdocs/screenshots/fill_demo_large.png trunk/htdocs/screenshots/fill_demo_small.png trunk/htdocs/screenshots/finance_work2_large.png trunk/htdocs/screenshots/finance_work2_small.png trunk/htdocs/screenshots/histogram_demo.py trunk/htdocs/screenshots/layer_images_large.png trunk/htdocs/screenshots/layer_images_small.png trunk/htdocs/screenshots/legend_demo_large.png trunk/htdocs/screenshots/legend_demo_small.png trunk/htdocs/screenshots/log_shot_large.png trunk/htdocs/screenshots/log_shot_small.png trunk/htdocs/screenshots/makeshots.py trunk/htdocs/screenshots/mathtext_demo_large.png trunk/htdocs/screenshots/mathtext_demo_small.png trunk/htdocs/screenshots/mri_with_eeg.py trunk/htdocs/screenshots/pcolor_demo_large.png trunk/htdocs/screenshots/pcolor_demo_small.png trunk/htdocs/screenshots/pie_demo_large.png trunk/htdocs/screenshots/pie_demo_small.png trunk/htdocs/screenshots/polar_demo_large.png trunk/htdocs/screenshots/polar_demo_small.png trunk/htdocs/screenshots/scatter_demo2_large.png trunk/htdocs/screenshots/scatter_demo2_small.png trunk/htdocs/screenshots/simple_plot_large.png trunk/htdocs/screenshots/simple_plot_small.png trunk/htdocs/screenshots/slider_demo_large.png trunk/htdocs/screenshots/slider_demo_small.png trunk/htdocs/screenshots/text_themes_large.png trunk/htdocs/screenshots/text_themes_small.png trunk/htdocs/screenshots.html.template trunk/htdocs/whats_new.html.template Added Paths: ----------- trunk/htdocs/screenshots/mathtext_examples.py Modified: trunk/htdocs/credits.html.template =================================================================== --- trunk/htdocs/credits.html.template 2007年11月29日 15:40:42 UTC (rev 4501) +++ trunk/htdocs/credits.html.template 2007年11月29日 16:28:07 UTC (rev 4502) @@ -60,7 +60,8 @@ log plots, added improved support for scalar formatting, and did a lot of work to clean up the <a href=psfrag" rel="nofollow">http://www.ctan.org/tex-archive/help/Catalogue/entries/psfrag.html?action=/tex-archive/macros/latex/contrib/supported/psfrag/>psfrag</a> - LaTeX output. </li> + LaTeX output. He wrote the site.cfg and matplotlib.conf + configuration support</li> <li>Paul Mcguire provided the pyparsing module on which mathtext relies, and made a number of optimizations to the matplotlib @@ -109,6 +110,18 @@ href=http://ipython.scipy.org>ipython</a>/pylab.</li> + <li>Charlie Moad contributed work to matplotlib's Cocoa support and + does the binary builds and releases</li> + + <li>Jouni K. Seppaenen wrote the PDF backend</li> + + <li>Michael Droettboom wrote the enhanced mathtext support, +implementing Knuth's box layout algorithms, and is responsible for +numerous bug-fixes, better font support, and feature enhancements +across the matplotlib backends</li> + + + </ul> Modified: trunk/htdocs/hthelpers.py =================================================================== --- trunk/htdocs/hthelpers.py 2007年11月29日 15:40:42 UTC (rev 4501) +++ trunk/htdocs/hthelpers.py 2007年11月29日 16:28:07 UTC (rev 4502) @@ -7,14 +7,14 @@ 'matplotlib.backends.backend_agg', 'matplotlib.backends.backend_cairo', 'matplotlib.backends.backend_fltkagg', - 'matplotlib.backends.backend_gtkcairo', + 'matplotlib.backends.backend_gtkcairo', 'matplotlib.backends.backend_gd', 'matplotlib.backends.backend_gtk', 'matplotlib.backends.backend_gtkagg', 'matplotlib.backends.backend_paint', 'matplotlib.backends.backend_ps', - 'matplotlib.backends.backend_svg', - 'matplotlib.backends.backend_emf', + 'matplotlib.backends.backend_svg', + 'matplotlib.backends.backend_emf', 'matplotlib.backends.backend_template', 'matplotlib.backends.backend_tkagg', 'matplotlib.backends.backend_qt', @@ -22,13 +22,17 @@ 'matplotlib.backends.backend_wx', 'matplotlib.backends.backend_wxagg', 'matplotlib.cbook', - 'matplotlib.cm', + 'matplotlib.cm', 'matplotlib.collections', + 'matplotlib.colorbar', 'matplotlib.colors', + 'matplotlib.contour', 'matplotlib.dates', + 'matplotlib.dviread', 'matplotlib.figure', 'matplotlib.finance', 'matplotlib.font_manager', + 'matplotlib.fontconfig_pattern', 'matplotlib.ft2font', 'matplotlib.image', 'matplotlib.legend', @@ -37,14 +41,18 @@ 'matplotlib.mlab', 'matplotlib.numerix', 'matplotlib.patches', - 'matplotlib.pylab', + 'matplotlib.pylab', + 'matplotlib.pyplot', + 'matplotlib.quiver', + 'matplotlib.rcsetup', 'matplotlib.table', - 'matplotlib.texmanager', + 'matplotlib.texmanager', 'matplotlib.text', 'matplotlib.ticker', 'matplotlib.toolkits.basemap.basemap', 'matplotlib.transforms', - 'matplotlib.units', + 'matplotlib.type1font', + 'matplotlib.units', 'matplotlib.widgets', ) @@ -72,5 +80,5 @@ func, desc = tup func = func.strip() desc = desc.strip() - these.append((func, desc)) + these.append((func, desc)) return plot_commands Modified: trunk/htdocs/screenshots/align_text_large.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots/align_text_small.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots/axes_demo_large.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots/axes_demo_small.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots/barchart_demo_large.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots/barchart_demo_small.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots/date_demo_large.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots/date_demo_small.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots/fill_demo_large.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots/fill_demo_small.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots/finance_work2_large.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots/finance_work2_small.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots/histogram_demo.py =================================================================== --- trunk/htdocs/screenshots/histogram_demo.py 2007年11月29日 15:40:42 UTC (rev 4501) +++ trunk/htdocs/screenshots/histogram_demo.py 2007年11月29日 16:28:07 UTC (rev 4502) @@ -1,5 +1,4 @@ from matplotlib import rcParams -rcParams['text.fontname'] = 'cmr10' from pylab import * Modified: trunk/htdocs/screenshots/layer_images_large.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots/layer_images_small.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots/legend_demo_large.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots/legend_demo_small.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots/log_shot_large.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots/log_shot_small.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots/makeshots.py =================================================================== --- trunk/htdocs/screenshots/makeshots.py 2007年11月29日 15:40:42 UTC (rev 4501) +++ trunk/htdocs/screenshots/makeshots.py 2007年11月29日 16:28:07 UTC (rev 4502) @@ -7,29 +7,30 @@ default = 'Agg' # do not remove the pngs - some are screenshots! files = { - 'wheeler_demo.py' : default, - 'layer_images.py' : default, - 'finance_work2.py' : default, - 'simple_plot.py' : default, - 'axes_demo.py' : default, - 'histogram_demo.py' : default, + 'wheeler_demo.py' : default, + 'layer_images.py' : default, + 'finance_work2.py' : default, + 'simple_plot.py' : default, + 'axes_demo.py' : default, + 'histogram_demo.py' : default, 'mri_with_eeg.py' : default, 'fill_demo.py' : default, - 'date_demo.py' : default, + 'date_demo.py' : default, 'barchart_demo.py' : default, 'table_demo.py' : default, - 'tex_demo.py' : default, + 'tex_demo.py' : default, 'legend_demo.py' : default, - 'slider_demo.py' : default, - 'mathtext_demo.py' : default, - 'pcolor_demo.py' : default, - 'text_themes.py' : default, + 'slider_demo.py' : default, + 'mathtext_demo.py' : default, + 'mathtext_examples.py' : default, + 'pcolor_demo.py' : default, + 'text_themes.py' : default, 'log_shot.py' : default, - 'align_text.py' : default, - 'scatter_demo2.py' : default, + 'align_text.py' : default, + 'scatter_demo2.py' : default, 'polar_demo.py' : default, 'pie_demo.py' : default, - 'plotmap.py' : default, + 'plotmap.py' : default, 'hstdemo.py' : default, } @@ -43,7 +44,7 @@ 'matplotlib.use("%s")\n' % backend, 'from pylab import *\n' ] - + print '\tdriving %s' % fname for line in file(fname): if line.strip().startswith('from __future__ import division'): continue @@ -59,7 +60,7 @@ file(tmpfile, 'w').write(''.join(lines)) os.system('python %s' % tmpfile) #os.remove(tmpfile) - + for fname, backend in files.items(): make_shot(fname, backend) Modified: trunk/htdocs/screenshots/mathtext_demo_large.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots/mathtext_demo_small.png =================================================================== (Binary files differ) Added: trunk/htdocs/screenshots/mathtext_examples.py =================================================================== --- trunk/htdocs/screenshots/mathtext_examples.py (rev 0) +++ trunk/htdocs/screenshots/mathtext_examples.py 2007年11月29日 16:28:07 UTC (rev 4502) @@ -0,0 +1,89 @@ +#!/usr/bin/env python + +import os, sys, re + +import gc + +stests = [ + r'Kerning: AVA $AVA$', + r'\100ドル.00 $\alpha \_$', + r'$\frac{\100ドル.00}{y}$', + r'$x y$', + r'$x+y\ x=y\ x<y\ x:y\ x,y\ x@y$', + r'100ドル\%y\ x*y\ x/y x\$y$', + r'$x\leftarrow y\ x\forall y\ x-y$', + r'$x \sf x \bf x {\cal X} \rm x$', + r'$x\ x,円x\;x\quad x\qquad x\!x\hspace{ 0.5 }y$', + r'$\{ \rm braces \}$', + r'$\left[\left\lfloor\frac{5}{\frac{\left(3\right)}{4}} y\right)\right]$', + r'$\left(x\right)$', + r'$\sin(x)$', + r'$x_2$', + r'$x^2$', + r'$x^2_y$', + r'$x_y^2$', + r'$\prod_{i=\alpha_{i+1}}^\infty$', + r'$x = \frac{x+\frac{5}{2}}{\frac{y+3}{8}}$', + r'$dz/dt = \gamma x^2 + {\rm sin}(2\pi y+\phi)$', + r'Foo: $\alpha_{i+1}^j = {\rm sin}(2\pi f_j t_i) e^{-5 t_i/\tau}$', + r'$\mathcal{R}\prod_{i=\alpha_{i+1}}^\infty a_i \sin(2 \pi f x_i)$', +# r'$\bigodot \bigoplus {\sf R} a_i{\rm sin}(2 \pi f x_i)$', + r'Variable $i$ is good', + r'$\Delta_i^j$', + r'$\Delta^j_{i+1}$', + r'$\ddot{o}\acute{e}\grave{e}\hat{O}\breve{\imath}\tilde{n}\vec{q}$', + r'$_i$', + r"$\arccos((x^i))$", + r"$\gamma = \frac{x=\frac{6}{8}}{y} \delta$", + r'$\limsup_{x\to\infty}$', + r'$\oint^\infty_0$', + r"$f^'$", + r'$\frac{x_2888}{y}$', + r"$\sqrt[3]{\frac{X_2}{Y}}=5$", + r"$\sqrt[5x\pi]{\prod^\frac{x}{2\pi^2}_\infty}$", + r"$\sqrt[3]{x}=5$", + r'$\frac{X}{\frac{X}{Y}}$', + # From UTR #25 + r"$W^{3\beta}_{\delta_1 \rho_1 \sigma_2} = U^{3\beta}_{\delta_1 \rho_1} + \frac{1}{8 \pi 2} \int^{\alpha_2}_{\alpha_2} d \alpha^\prime_2 \left[\frac{ U^{2\beta}_{\delta_1 \rho_1} - \alpha^\prime_2U^{1\beta}_{\rho_1 \sigma_2} }{U^{0\beta}_{\rho_1 \sigma_2}}\right]$", + r'$\mathcal{H} = \int d \tau \left(\epsilon E^2 + \mu H^2\right)$', + r'$\widehat{abc}\widetilde{def}$', + r'$\Gamma \Delta \Theta \Lambda \Xi \Pi \Sigma \Upsilon \Phi \Psi \Omega$', + r'$\alpha \beta \gamma \delta \epsilon \zeta \eta \theta \iota \lambda \mu \nu \xi \pi \kappa \rho \sigma \tau \upsilon \phi \chi \psi$', + #ur'Generic symbol: $\u23ce \mathrm{\ue0f2 \U0001D538}$' + ] + +from pylab import * + +def doall(): + tests = stests + + figure(figsize=(8, (len(tests) * 1) + 2)) + plot([0, 0], 'r') + grid(False) + axis([0, 3, -len(tests), 0]) + yticks(arange(len(tests)) * -1) + for i, s in enumerate(tests): + print (i, s) + text(0.1, -i, s, fontsize=20) + + savefig('mathtext_examples') + #close('all') + show() + +if '--latex' in sys.argv: + fd = open("mathtext_examples.ltx", "w") + fd.write("\\documentclass{article}\n") + fd.write("\\begin{document}\n") + fd.write("\\begin{enumerate}\n") + + for i, s in enumerate(stests): + s = re.sub(r"(?<!\\)\$", "$$", s) + fd.write("\\item %s\n" % s) + + fd.write("\\end{enumerate}\n") + fd.write("\\end{document}\n") + fd.close() + + os.system("pdflatex mathtext_examples.ltx") +else: + doall() Property changes on: trunk/htdocs/screenshots/mathtext_examples.py ___________________________________________________________________ Name: svn:executable + * Modified: trunk/htdocs/screenshots/mri_with_eeg.py =================================================================== --- trunk/htdocs/screenshots/mri_with_eeg.py 2007年11月29日 15:40:42 UTC (rev 4501) +++ trunk/htdocs/screenshots/mri_with_eeg.py 2007年11月29日 16:28:07 UTC (rev 4502) @@ -4,6 +4,8 @@ faster* """ from __future__ import division +import numpy + from pylab import * from matplotlib.lines import Line2D from matplotlib.transforms import get_bbox_transform, Point, Value, Bbox,\ @@ -14,7 +16,7 @@ if 1: # load the data # data are 256x256 16 bit integers dfile = 'data/s1045.ima' - im = fromstring(file(dfile, 'rb').read(), UInt16).astype(Float) + im = fromstring(file(dfile, 'rb').read(), numpy.uint16).astype(numpy.float) im.shape = 256, 256 if 1: # plot the MRI in pcolor @@ -62,17 +64,17 @@ for i in range(numRows): # effectively a copy of transData - trans = get_bbox_transform(boxin, boxout) + trans = get_bbox_transform(boxin, boxout) offset = (i+1)/(numRows+1) trans.set_offset( (0, offset), transOffset) - + thisLine = Line2D( t, data[:,i]-data[0,i], ) - + thisLine.set_transform(trans) - + ax.add_line(thisLine) ticklocs.append(offset) @@ -85,10 +87,10 @@ ax.set_yticks(ticklocs) for tick in ax.yaxis.get_major_ticks(): tick.label1.set_transform(ax.transAxes) - tick.label2.set_transform(ax.transAxes) + tick.label2.set_transform(ax.transAxes) tick.tick1line.set_transform(ax.transAxes) - tick.tick2line.set_transform(ax.transAxes) - tick.gridline.set_transform(ax.transAxes) + tick.tick2line.set_transform(ax.transAxes) + tick.gridline.set_transform(ax.transAxes) xlabel('time (s)') Modified: trunk/htdocs/screenshots/pcolor_demo_large.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots/pcolor_demo_small.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots/pie_demo_large.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots/pie_demo_small.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots/polar_demo_large.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots/polar_demo_small.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots/scatter_demo2_large.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots/scatter_demo2_small.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots/simple_plot_large.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots/simple_plot_small.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots/slider_demo_large.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots/slider_demo_small.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots/text_themes_large.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots/text_themes_small.png =================================================================== (Binary files differ) Modified: trunk/htdocs/screenshots.html.template =================================================================== --- trunk/htdocs/screenshots.html.template 2007年11月29日 15:40:42 UTC (rev 4501) +++ trunk/htdocs/screenshots.html.template 2007年11月29日 16:28:07 UTC (rev 4502) @@ -101,11 +101,15 @@ ('mathtext_demo', """The mathtext module provides TeX style mathematical expressions using freetype2 and the BaKoMa computer -modern fonts. See the <a href=matplotlib.mathtext.html>mathtext</a> +modern or STIX fonts. See the <a href=matplotlib.mathtext.html>mathtext</a> module for usage, licensing and backend information. matplotlib mathtext is an independent implementation, and does not required TeX or any external packages installed on your computer.""", 1), +('mathtext_examples, """A sampling of the many TeX expressions now +supported by matplotlib's internal mathtext engine. +""", 1), + ('wheeler_demo', """ Plot of Level Set (LSM), Phase Field (PFM) and Sharp Interface Models Modified: trunk/htdocs/whats_new.html.template =================================================================== --- trunk/htdocs/whats_new.html.template 2007年11月29日 15:40:42 UTC (rev 4501) +++ trunk/htdocs/whats_new.html.template 2007年11月29日 16:28:07 UTC (rev 4502) @@ -1,9 +1,54 @@ # To update, add a new entry to the versioninfo dictionary using the -# version string as a key. The value of the dict entry should be a +# version string as a key. The value of the dict entry should be a # tuple of (name, description) tuples versioninfo = {} +versioninfo['0.91.0'] = ( + +('enhanced mathtext', """Complete revamp of matplotlib's internal math layout and rendering +engine. Michael Droetboom has improved the TeX parser to +significantly expand it's coverege, and implemeted Knuth's box layout +algorithms. Additionally, the much anticipated <a +href=http://www.stixfonts.org/>STIX fonts</a> for math expressions +have come online and ship with matplotlib. See a sample of the new mathtext at <a +href=screenshots.html#mathtext_examples>mathtext_examples</a>. +"""), + + +('better configuration', """Darren Dale has provided support for a site.cfg configuration file to +enable users and package maintainers to have better control over the +matplotlib build process. He has also provided a (currently optional) +<a href=http://code.enthought.com/traits/>enthought.traits</a> enabled property configuration to replace +matplotlib's <a href=matplotlibrc>rc</a> configuration using a <a href=http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/lib/matplotlib/mpl-data/matplotlib.conf.template?view=markup>maplotlib.conf</a> file + +""" +) + +('writing to file-like objects', """You can now pass file like objects (eg StringIO) to all backends for hardcopy. +This has been a much requested feature for usage in web application servers. +""") + +('record array support', """New functions for loading, displaying and saving numpy record arrays in <a href=matplotlib.html>matplotlib.mlab</a>. See for example, <a href=examples/loadrec.py>loadrec.py</a> +"""), + +('pyplot', """Added a module <a href=matplotlib.pyplot.html>matplotlib.pyplot</a> which has all of pylab's plotting functions (eg figure, plot, show, close) but does not import the numpy namepace. This is useful for those who want to use the pylab functionality w/o the namespace clutter. +"""), + +('maskedarray', """Added optional support for the scipy sandbox masked array packaged. Configurable with an rc setting. +"""), + +('plotfile', """Added new pylab/pyplot command <a +href=matplotlib.pylab.html#-plotfile>plotfile</a> for gnuplot style file plotting +"""), + + +('tons of bugfixes and minor enhancements', """See the <a href=CHANGELOG>CHANGELOG<a/> and <a href=API_CHANGES>API_CHANGES<a/> for details. +"""), + + +) + versioninfo['0.90.1'] = ( ('unicode support for latex', """Added LaTeX unicode support. Enable with the 'text.latex.unicode' @@ -68,7 +113,7 @@ columns are plotted as in Matlab"""), ('pcolor now supports vectors', """Made pcolor support vector X and/or Y instead of -requiring 2-D arrays."""), +requiring 2-D arrays."""), ('logarithmic color scaling', """Added LogNorm to colors.py as illustrated by <a href=examples/pcolor_log.py>pcolor_log.py</a>, based on suggestion by @@ -220,7 +265,7 @@ ('Bugs fixed / small features', """\ Applied SF patches 1242648, 1244732. Fixes SF bugs 1238412, 1231611, -1209354, subplot (2,1,1) bug, +1209354, subplot (2,1,1) bug, """), @@ -272,7 +317,7 @@ lines.solid_joinstyle : miter # miter|round|bevel lines.solid_capstyle : projecting # butt|round|projecting </pre> - + """), ('Axes kwargs', """\ @@ -282,7 +327,7 @@ <pre> subplot(111, xlabel='time', ylabel='volts', autoscale_on=False, xlim=(-1,1), ylim =(0,10) ) -</pre> +</pre> """), @@ -437,7 +482,7 @@ Heavy optimizations in line marker drawing eg <tt>plot(x,y,'+')</tt> or any other line marker. Here are some numbers, where N is the number of symbols - + <pre> 0.71 0.72 speedup ----------------------------------- @@ -449,7 +494,7 @@ N = 500000 | 48.81s | 2.32s | 21.03x </pre> """), - + ('log plot enhancements', """\ Lots of work making log plots <i>just work</i>. You can toggle log y axes with the <tt>l</tt> ("ell") keypress -- nonpositive data are simply @@ -484,8 +529,8 @@ ('Key press actions over axes', """\ Default key presses over axes: 'g' toggles grid, 'l' toggles logy"""), - + ('little features', """\ Calls to subplot with overlap other subplots now delete the overlapped subplot, load and save work with file and handles gzipped files @@ -511,16 +556,16 @@ >>> import matplotlib.pylab >>> matplotlib.pylab.__all__ </pre> -"""), +"""), ('contour zigzag bug fixed', """\ -Thanks Nadia for the blood, sweat and tears, and Dominique for the report."""), +Thanks Nadia for the blood, sweat and tears, and Dominique for the report."""), ('contour colormaps', """\ -Contour now uses the current colormap if colors is not provided, and works with colorbars. See <a href=examples/contour_demo2.py>contour_demo2.py</a>"""), +Contour now uses the current colormap if colors is not provided, and works with colorbars. See <a href=examples/contour_demo2.py>contour_demo2.py</a>"""), ('colorbar enhancements', """\ -Horizontal colorbars supported with keyword arg <tt>orientation='horizontal'</tt> and colorbars can be placed in an arbitrary axes with keyword arg <tt>cax</tt>. See <a href=matplotlib.pylab.html#-colorbar>colorbar</a>"""), +Horizontal colorbars supported with keyword arg <tt>orientation='horizontal'</tt> and colorbars can be placed in an arbitrary axes with keyword arg <tt>cax</tt>. See <a href=matplotlib.pylab.html#-colorbar>colorbar</a>"""), ('accents in mathtext', """\ Added accents to mathtext: <tt>\hat, \breve, \grave, \bar, \acute, \tilde, @@ -545,24 +590,24 @@ FigureManagerGTK. """), - - - + + + ) versioninfo['0.70'] = ( ('Users guide', """\ Though still not complete, there's enough to be useful -- <a href=users_guide.pdf>users_guide.pdf</a>. -"""), +"""), ('pie charts', """\ See <a href=screenshots.html#pie_demo>pie screenshot</a>. -"""), +"""), ('object picking', """\ @@ -572,10 +617,10 @@ part of the core, as will other keypress functionality for navigation, grid toogle, zoom toggle etc. """), - + ('wx/wxagg coords notification', """\ The wx toolbar now reports the x,y coords of the mouse -"""), +"""), ('key events', """\ Key press and release event supported across backends -- see @@ -584,7 +629,7 @@ ('shadow effect', """\ <a href=matplotlib.patches.html#Shadow>Shadow</a> patch class provides -a shadow effect for polygons, legends, pie charts - eg, +a shadow effect for polygons, legends, pie charts - eg, <a href=screenshots.html#legend_demo>legend screenshot</a>. """), @@ -637,7 +682,7 @@ href=examples/set_and_get.py>set_and_get.py</a>. Sample usage <pre> - >>> lines = plot([1,2,3]) + >>> lines = plot([1,2,3]) >>> set(lines) alpha: float antialiased or aa: [True | False] @@ -646,13 +691,13 @@ alpha = 1.0 antialiased or aa = True ...snip lots more... -</pre> +</pre> """), ('colormaps out the wazoo', """\ Added many new matlab compatible colormaps - autumn bone cool copper flag gray hot hsv jet pink prism spring summer winter - -Thanks Perry! +Thanks Perry! """), ('zordering', """\ @@ -694,7 +739,7 @@ <pre> title('hi mom', bbox={'facecolor':'r', 'alpha':0.5}) </pre> - + """), ('legend properties exposed as keyword arguments', """ @@ -748,7 +793,7 @@ href=examples/polar_scatter.py>polar_scatter.py</a> and <a href=screenshots.html#polar_demo>polar_demo<a/>."""), - + ('cairo backend', """\ Steve Chaplin has contributed a cairo and a gtkcairo backend - <a href=http://cairographics.org>cairographics</a>. Cairo is a vector @@ -882,7 +927,7 @@ appropriate interactive, threaded shell, as well as all of matplotlib.matlab and numerix. Requires ipython-0.6.3. Backend status summary: linux (all backends working), OSX (tkagg and gtk* -work), win32 (tkagg only). Thanks Fernando Perez! +work), win32 (tkagg only). Thanks Fernando Perez! """), ('Log ticking and formatting', """Excellent improvements in log @@ -987,27 +1032,27 @@ Thus you can type --not necessarily recommended for readability in scripts or apps but great for throwaway use in interactive shells -<pre> +<pre> # no antialiasing, thick green markeredge lines >>> plot(range(10), 'ro', aa=False, mew=2, mec='g') </pre> Analogs in matplotlib.patches -<pre> +<pre> aa : antialiased lw : linewidth ec : edgecolor fc : facecolor -</pre> +</pre> """), - + ('local rc files', """\ You can put a matplotlibrc file in a dir to override the one in your HOME dir. If you have a project, say a book, and you want to make a bunch of images with the same look and feel for the book, you can place a custom rc file in the code dir for that book and this won't -affect the configs you use for normal, interactive use."""), +affect the configs you use for normal, interactive use."""), ('Installing', """\ Updated installing instructions at <a @@ -1064,7 +1109,7 @@ equivalent to doing get_current_fig_manager().canvas.draw(), but takes less typing :-) """), - + ('Elaborate finance demo', """\ New finance demo shows off may of the features of matplotlib - see screenshot at <a href=screenshots.html#finance_work2>finance_work2</a>"""), @@ -1164,7 +1209,7 @@ # each plot command. Toggle with hold command grid.color : k # grid color grid.linestyle : : # dotted -grid.linewidth : 0.5 # in points +grid.linewidth : 0.5 # in points tick.major.pad : 4 # distance to major tick label in points tick.minor.pad : 4 # distance to the minor tick label in points @@ -1182,7 +1227,7 @@ to it now. """), - ('Properly aligned text with arbitrary alignments', + ('Properly aligned text with arbitrary alignments', """You can now expect horizontal and vertical alignment specifications to work with text at an arbitrary angle, eg, 45 degrees. See <a href=examples/alignment_test.py>alignment_test.py</a> """), @@ -1250,7 +1295,7 @@ href=matplotlib.dates.html>dates documentation</a> provides an overview and guide to with dates."""), - + ('Ported image support to numarray and postscript backend', """ The image module now works with Numeric or numarray, and now works in the postscript backend as well as GTKAgg, TkAgg, WXAgg, Agg, and GTK. @@ -1290,7 +1335,7 @@ """ ), ) -####################################################################################### +####################################################################################### versioninfo['0.52'] = ( ('Image support', """ @@ -1358,7 +1403,7 @@ ('GTKAgg', """GTK widgets with antigrain rendering. See the <a href=backends.html#GTKAgg>GTKAgg backend</a>.""" ), - + ('freetype2 support added for agg backend', """With freetype2, agg now renders fonts nicely even at very small raster sizes.""" ), @@ -1467,14 +1512,14 @@ 'x' linestyle. Thanks Matt! """ ), ('Exposed legend properties', """Added methods to access the legend primities: text, lines, and rectangles to allow fine-grained control over legend properties; see <a href=examples/legend_demo.py>legend_demo.py</a>""" ), - + ('gd module on win32', """\ With much weeping and gnashing of teeth and help from half the people on this globe, built a gdmodule win32 installer. Special thanks to Stefan Kuzminski for putting up with my endless windows confusions. See the win32 quickstart at <a href=backends.html#GDWIN32>installing</a> the GD backend.""" -), +), ('GD supports clipping and antialiased line drawing', """\ See instructions about upgrading gd and gdmodule at <a @@ -1530,8 +1575,8 @@ this should give better agreement with other backends with he relative sizes of objects</li> - <li> GTK : Dash spacing was not properly scaling with DPI</li> - <li> GTK : Rotated text did not display correctly in some cases</li> + <li> GTK : Dash spacing was not properly scaling with DPI</li> + <li> GTK : Rotated text did not display correctly in some cases</li> <li> GTK : Lots of optimizations using cacheing in GTK backend for improved performace for monitoring / animation scripts. Discovered @@ -1556,7 +1601,7 @@ ######################################################################## versioninfo['0.42'] = ( - ('EPS output from PS backend', + ('EPS output from PS backend', """Just add an eps extension"""), ('PS and EPS save from GTK and WX backends with bugs fixed', @@ -1566,9 +1611,9 @@ Text class enabled this. Text is now backend independent and behaves like the other artists in the figure (lines, patches, etc). Additionally, PS and EPS save from WX backend work -"""), +"""), - ('Object picker example', + ('Object picker example', """The file examples/object_picker.py is a template showing how to select objects in the figure with the mouse(eg, text, lines). If you click on the line, a properties dialog will pop up. You can edit the @@ -1583,7 +1628,7 @@ ######################################################################## versioninfo['0.41'] = ( -('Pcolor optimizations', +('Pcolor optimizations', """Several optimizations have improved the performance of pcolor across all backends, 4x on the GTK backend"""), @@ -1593,24 +1638,24 @@ Mostly works with a few know problems. You can simply call savefig('somefile.ps') or use the PS extension when saving from the GUI. -"""), +"""), ('Bug fixes', """ Fixed bugs in semilogy and in setting dashes under some versions of Numeric -"""), +"""), ('bar takes (optional)multiple color args', """ You can now pass bar a len(x) list of color args to have bars with different colors. -"""), +"""), ) ############################################################################## versioninfo['0.40'] = ( -('Wx python backend', +('Wx python backend', """ Jeremy O'Donoghue has done an amazing job implementing the backend for <a href=http://www.wxpython.org>wxpython</a>. See <a href=matplotlib.backends.backend_wx.html>backend_wx</a> for a status @@ -1625,7 +1670,7 @@ href=matplotlib.pylab.html#-cohere>cohere</a> plots the coherence. See the examples <a href=examples/psd_demo.py>psd_demo.py</a> and <a href=examples/csd_demo.py>csd_demo.py</a> -"""), +"""), ('Expanded legend capabilities', """ @@ -1676,7 +1721,7 @@ KNOWN BUGS section of the wx src to the <a href=http://sourceforge.net/mailarchive/forum.php?forum_id=36187>matplotlib-devel</a> mailing list. -"""), +"""), ('Pseudo color plots', """ The <a href=matplotlib.pylab.html#-pcolor>pcolor</a> command @@ -1692,7 +1737,7 @@ path setting for PS backend, fixed a label position bug """), ) -############################################################################### +############################################################################### versioninfo['0.29.2'] = ( ('Log scaling', @@ -1727,7 +1772,7 @@ ############################################################################## versioninfo['0.29'] = ( - ('Multiple output devices', + ('Multiple output devices', """The major improvement in matplotlib with this release is that the library no longer requires pygtk or GTK, and instead renders to an abstract drawing interface. This allows you to use matplotlib even in @@ -1802,10 +1847,10 @@ All drawing is done to a pixmap and then updated. This allows flicker free updates of the figure. You can use this, for example, to build a system monitor, which continuously shows system resources such as RAM, -CPU, etc... See <a href="examples/system_monitor.py">system_monitor.py</a> for a demo. +CPU, etc... See <a href="examples/system_monitor.py">system_monitor.py</a> for a demo. """), ) -############################################################################ +############################################################################ versioninfo['0.2'] = ( ('Font handling', @@ -1831,7 +1876,7 @@ interactively</a>. """), -('Saving figures', +('Saving figures', """ Ability to save figures in arbitrary resolution PNG or JPEG with a bug fix that caused saved figures to be corrupted by anything blocking the figure window. A GUI widget has been added to the figure toolbar This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4501 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4501&view=rev Author: mdboom Date: 2007年11月29日 07:40:42 -0800 (2007年11月29日) Log Message: ----------- Ran "astyle --style=ansi" to convert to ANSI style. Modified Paths: -------------- branches/transforms/src/_path.cpp branches/transforms/src/agg_py_path_iterator.h branches/transforms/src/agg_py_transforms.h Modified: branches/transforms/src/_path.cpp =================================================================== --- branches/transforms/src/_path.cpp 2007年11月29日 13:50:25 UTC (rev 4500) +++ branches/transforms/src/_path.cpp 2007年11月29日 15:40:42 UTC (rev 4501) @@ -11,61 +11,61 @@ // MGDTODO: Un-CXX-ify this module -struct XY { - double x; - double y; +struct XY +{ + double x; + double y; - XY(double x_, double y_) : x(x_), y(y_) {} + XY(double x_, double y_) : x(x_), y(y_) {} }; // the extension module class _path_module : public Py::ExtensionModule<_path_module> { public: - _path_module() - : Py::ExtensionModule<_path_module>( "_path" ) - { - add_varargs_method("point_in_path", &_path_module::point_in_path, - "point_in_path(x, y, path, trans)"); - add_varargs_method("point_on_path", &_path_module::point_on_path, - "point_on_path(x, y, r, path, trans)"); - add_varargs_method("get_path_extents", &_path_module::get_path_extents, - "get_path_extents(path, trans)"); - add_varargs_method("update_path_extents", &_path_module::update_path_extents, - "update_path_extents(path, trans, bbox, minpos)"); - add_varargs_method("get_path_collection_extents", &_path_module::get_path_collection_extents, - "get_path_collection_extents(trans, paths, transforms, offsets, offsetTrans)"); - add_varargs_method("point_in_path_collection", &_path_module::point_in_path_collection, - "point_in_path_collection(x, y, r, trans, paths, transforms, offsets, offsetTrans, filled)"); - add_varargs_method("path_in_path", &_path_module::path_in_path, - "path_in_path(a, atrans, b, btrans)"); - add_varargs_method("clip_path_to_rect", &_path_module::clip_path_to_rect, - "clip_path_to_rect(path, bbox, inside)"); - add_varargs_method("affine_transform", &_path_module::affine_transform, - "affine_transform(vertices, transform)"); - add_varargs_method("count_bboxes_overlapping_bbox", &_path_module::count_bboxes_overlapping_bbox, - "count_bboxes_overlapping_bbox(bbox, bboxes)"); - add_varargs_method("path_intersects_path", &_path_module::path_intersects_path, - "path_intersects_path(p1, p2)"); + _path_module() + : Py::ExtensionModule<_path_module>( "_path" ) + { + add_varargs_method("point_in_path", &_path_module::point_in_path, + "point_in_path(x, y, path, trans)"); + add_varargs_method("point_on_path", &_path_module::point_on_path, + "point_on_path(x, y, r, path, trans)"); + add_varargs_method("get_path_extents", &_path_module::get_path_extents, + "get_path_extents(path, trans)"); + add_varargs_method("update_path_extents", &_path_module::update_path_extents, + "update_path_extents(path, trans, bbox, minpos)"); + add_varargs_method("get_path_collection_extents", &_path_module::get_path_collection_extents, + "get_path_collection_extents(trans, paths, transforms, offsets, offsetTrans)"); + add_varargs_method("point_in_path_collection", &_path_module::point_in_path_collection, + "point_in_path_collection(x, y, r, trans, paths, transforms, offsets, offsetTrans, filled)"); + add_varargs_method("path_in_path", &_path_module::path_in_path, + "path_in_path(a, atrans, b, btrans)"); + add_varargs_method("clip_path_to_rect", &_path_module::clip_path_to_rect, + "clip_path_to_rect(path, bbox, inside)"); + add_varargs_method("affine_transform", &_path_module::affine_transform, + "affine_transform(vertices, transform)"); + add_varargs_method("count_bboxes_overlapping_bbox", &_path_module::count_bboxes_overlapping_bbox, + "count_bboxes_overlapping_bbox(bbox, bboxes)"); + add_varargs_method("path_intersects_path", &_path_module::path_intersects_path, + "path_intersects_path(p1, p2)"); - initialize("Helper functions for paths"); - } + initialize("Helper functions for paths"); + } - virtual ~_path_module() {} + virtual ~_path_module() {} private: - - Py::Object point_in_path(const Py::Tuple& args); - Py::Object point_on_path(const Py::Tuple& args); - Py::Object get_path_extents(const Py::Tuple& args); - Py::Object update_path_extents(const Py::Tuple& args); - Py::Object get_path_collection_extents(const Py::Tuple& args); - Py::Object point_in_path_collection(const Py::Tuple& args); - Py::Object path_in_path(const Py::Tuple& args); - Py::Object clip_path_to_rect(const Py::Tuple& args); - Py::Object affine_transform(const Py::Tuple& args); - Py::Object count_bboxes_overlapping_bbox(const Py::Tuple& args); - Py::Object path_intersects_path(const Py::Tuple& args); + Py::Object point_in_path(const Py::Tuple& args); + Py::Object point_on_path(const Py::Tuple& args); + Py::Object get_path_extents(const Py::Tuple& args); + Py::Object update_path_extents(const Py::Tuple& args); + Py::Object get_path_collection_extents(const Py::Tuple& args); + Py::Object point_in_path_collection(const Py::Tuple& args); + Py::Object path_in_path(const Py::Tuple& args); + Py::Object clip_path_to_rect(const Py::Tuple& args); + Py::Object affine_transform(const Py::Tuple& args); + Py::Object count_bboxes_overlapping_bbox(const Py::Tuple& args); + Py::Object path_intersects_path(const Py::Tuple& args); }; // @@ -106,466 +106,528 @@ // Input 2D polygon _pgon_ with _numverts_ number of vertices and test point // _point_, returns 1 if inside, 0 if outside. template<class T> -bool point_in_path_impl(double tx, double ty, T& path) { - int yflag0, yflag1, inside_flag; - double vtx0, vty0, vtx1, vty1, sx, sy; - double x, y; +bool point_in_path_impl(double tx, double ty, T& path) +{ + int yflag0, yflag1, inside_flag; + double vtx0, vty0, vtx1, vty1, sx, sy; + double x, y; - path.rewind(0); + path.rewind(0); - inside_flag = 0; + inside_flag = 0; - unsigned code = 0; - do { - if (code != agg::path_cmd_move_to) - code = path.vertex(&x, &y); + unsigned code = 0; + do + { + if (code != agg::path_cmd_move_to) + code = path.vertex(&x, &y); - sx = vtx0 = x; - sy = vty0 = y; + sx = vtx0 = x; + sy = vty0 = y; - // get test bit for above/below X axis - yflag0 = (vty0 >= ty); + // get test bit for above/below X axis + yflag0 = (vty0 >= ty); - vtx1 = x; - vty1 = x; + vtx1 = x; + vty1 = x; - inside_flag = 0; - do { - code = path.vertex(&x, &y); + inside_flag = 0; + do + { + code = path.vertex(&x, &y); - // The following cases denote the beginning on a new subpath - if (code == agg::path_cmd_stop || (code & agg::path_cmd_end_poly) == agg::path_cmd_end_poly) { - x = sx; y = sy; - } else if (code == agg::path_cmd_move_to) - break; + // The following cases denote the beginning on a new subpath + if (code == agg::path_cmd_stop || + (code & agg::path_cmd_end_poly) == agg::path_cmd_end_poly) + { + x = sx; + y = sy; + } + else if (code == agg::path_cmd_move_to) + break; - yflag1 = (vty1 >= ty); - // Check if endpoints straddle (are on opposite sides) of X axis - // (i.e. the Y's differ); if so, +X ray could intersect this edge. - // The old test also checked whether the endpoints are both to the - // right or to the left of the test point. However, given the faster - // intersection point computation used below, this test was found to - // be a break-even proposition for most polygons and a loser for - // triangles (where 50% or more of the edges which survive this test - // will cross quadrants and so have to have the X intersection computed - // anyway). I credit Joseph Samosky with inspiring me to try dropping - // the "both left or both right" part of my code. - if (yflag0 != yflag1) { - // Check intersection of pgon segment with +X ray. - // Note if >= point's X; if so, the ray hits it. - // The division operation is avoided for the ">=" test by checking - // the sign of the first vertex wrto the test point; idea inspired - // by Joseph Samosky's and Mark Haigh-Hutchinson's different - // polygon inclusion tests. - if ( ((vty1-ty) * (vtx0-vtx1) >= - (vtx1-tx) * (vty0-vty1)) == yflag1 ) { - inside_flag ^= 1; - } - } + yflag1 = (vty1 >= ty); + // Check if endpoints straddle (are on opposite sides) of X axis + // (i.e. the Y's differ); if so, +X ray could intersect this edge. + // The old test also checked whether the endpoints are both to the + // right or to the left of the test point. However, given the faster + // intersection point computation used below, this test was found to + // be a break-even proposition for most polygons and a loser for + // triangles (where 50% or more of the edges which survive this test + // will cross quadrants and so have to have the X intersection computed + // anyway). I credit Joseph Samosky with inspiring me to try dropping + // the "both left or both right" part of my code. + if (yflag0 != yflag1) + { + // Check intersection of pgon segment with +X ray. + // Note if >= point's X; if so, the ray hits it. + // The division operation is avoided for the ">=" test by checking + // the sign of the first vertex wrto the test point; idea inspired + // by Joseph Samosky's and Mark Haigh-Hutchinson's different + // polygon inclusion tests. + if ( ((vty1-ty) * (vtx0-vtx1) >= + (vtx1-tx) * (vty0-vty1)) == yflag1 ) + { + inside_flag ^= 1; + } + } - // Move to the next pair of vertices, retaining info as possible. - yflag0 = yflag1; - vtx0 = vtx1; - vty0 = vty1; + // Move to the next pair of vertices, retaining info as possible. + yflag0 = yflag1; + vtx0 = vtx1; + vty0 = vty1; - vtx1 = x; - vty1 = y; - } while (code != agg::path_cmd_stop && - (code & agg::path_cmd_end_poly) != agg::path_cmd_end_poly); + vtx1 = x; + vty1 = y; + } + while (code != agg::path_cmd_stop && + (code & agg::path_cmd_end_poly) != agg::path_cmd_end_poly); - yflag1 = (vty1 >= ty); - if (yflag0 != yflag1) { - if ( ((vty1-ty) * (vtx0-vtx1) >= - (vtx1-tx) * (vty0-vty1)) == yflag1 ) { - inside_flag ^= 1; - } + yflag1 = (vty1 >= ty); + if (yflag0 != yflag1) + { + if ( ((vty1-ty) * (vtx0-vtx1) >= + (vtx1-tx) * (vty0-vty1)) == yflag1 ) + { + inside_flag ^= 1; + } + } + + if (inside_flag != 0) + return true; } + while (code != agg::path_cmd_stop); - if (inside_flag != 0) - return true; - } while (code != agg::path_cmd_stop); - - return (inside_flag != 0); + return (inside_flag != 0); } -inline bool point_in_path(double x, double y, PathIterator& path, const agg::trans_affine& trans) { - typedef agg::conv_transform<PathIterator> transformed_path_t; - typedef agg::conv_curve<transformed_path_t> curve_t; +inline bool point_in_path(double x, double y, PathIterator& path, const agg::trans_affine& trans) +{ + typedef agg::conv_transform<PathIterator> transformed_path_t; + typedef agg::conv_curve<transformed_path_t> curve_t; - if (path.total_vertices() < 3) - return false; + if (path.total_vertices() < 3) + return false; - transformed_path_t trans_path(path, trans); - curve_t curved_path(trans_path); - return point_in_path_impl(x, y, curved_path); + transformed_path_t trans_path(path, trans); + curve_t curved_path(trans_path); + return point_in_path_impl(x, y, curved_path); } -inline bool point_on_path(double x, double y, double r, PathIterator& path, const agg::trans_affine& trans) { - typedef agg::conv_transform<PathIterator> transformed_path_t; - typedef agg::conv_curve<transformed_path_t> curve_t; - typedef agg::conv_stroke<curve_t> stroke_t; +inline bool point_on_path(double x, double y, double r, PathIterator& path, const agg::trans_affine& trans) +{ + typedef agg::conv_transform<PathIterator> transformed_path_t; + typedef agg::conv_curve<transformed_path_t> curve_t; + typedef agg::conv_stroke<curve_t> stroke_t; - transformed_path_t trans_path(path, trans); - curve_t curved_path(trans_path); - stroke_t stroked_path(curved_path); - stroked_path.width(r * 2.0); - return point_in_path_impl(x, y, stroked_path); + transformed_path_t trans_path(path, trans); + curve_t curved_path(trans_path); + stroke_t stroked_path(curved_path); + stroked_path.width(r * 2.0); + return point_in_path_impl(x, y, stroked_path); } -Py::Object _path_module::point_in_path(const Py::Tuple& args) { - args.verify_length(4); +Py::Object _path_module::point_in_path(const Py::Tuple& args) +{ + args.verify_length(4); - double x = Py::Float(args[0]); - double y = Py::Float(args[1]); - PathIterator path(args[2]); - agg::trans_affine trans = py_to_agg_transformation_matrix(args[3]); + double x = Py::Float(args[0]); + double y = Py::Float(args[1]); + PathIterator path(args[2]); + agg::trans_affine trans = py_to_agg_transformation_matrix(args[3]); - if (::point_in_path(x, y, path, trans)) - return Py::Int(1); - return Py::Int(0); + if (::point_in_path(x, y, path, trans)) + return Py::Int(1); + return Py::Int(0); } -Py::Object _path_module::point_on_path(const Py::Tuple& args) { - args.verify_length(5); +Py::Object _path_module::point_on_path(const Py::Tuple& args) +{ + args.verify_length(5); - double x = Py::Float(args[0]); - double y = Py::Float(args[1]); - double r = Py::Float(args[2]); - PathIterator path(args[3]); - agg::trans_affine trans = py_to_agg_transformation_matrix(args[4]); + double x = Py::Float(args[0]); + double y = Py::Float(args[1]); + double r = Py::Float(args[2]); + PathIterator path(args[3]); + agg::trans_affine trans = py_to_agg_transformation_matrix(args[4]); - if (::point_on_path(x, y, r, path, trans)) - return Py::Int(1); - return Py::Int(0); + if (::point_on_path(x, y, r, path, trans)) + return Py::Int(1); + return Py::Int(0); } void get_path_extents(PathIterator& path, const agg::trans_affine& trans, - double* x0, double* y0, double* x1, double* y1, - double* xm, double* ym) { - typedef agg::conv_transform<PathIterator> transformed_path_t; - typedef agg::conv_curve<transformed_path_t> curve_t; - double x, y; - unsigned code; + double* x0, double* y0, double* x1, double* y1, + double* xm, double* ym) +{ + typedef agg::conv_transform<PathIterator> transformed_path_t; + typedef agg::conv_curve<transformed_path_t> curve_t; + double x, y; + unsigned code; - transformed_path_t tpath(path, trans); - curve_t curved_path(tpath); + transformed_path_t tpath(path, trans); + curve_t curved_path(tpath); - curved_path.rewind(0); + curved_path.rewind(0); - while ((code = curved_path.vertex(&x, &y)) != agg::path_cmd_stop) { - if ((code & agg::path_cmd_end_poly) == agg::path_cmd_end_poly) - continue; - if (x < *x0) { - *x0 = x; - if (x > 0.0) - *xm = x; + while ((code = curved_path.vertex(&x, &y)) != agg::path_cmd_stop) + { + if ((code & agg::path_cmd_end_poly) == agg::path_cmd_end_poly) + continue; + if (x < *x0) + { + *x0 = x; + if (x > 0.0) + *xm = x; + } + if (y < *y0) + { + *y0 = y; + if (y > 0.0) + *ym = y; + } + if (x > *x1) *x1 = x; + if (y > *y1) *y1 = y; } - if (y < *y0) { - *y0 = y; - if (y > 0.0) - *ym = y; - } - if (x > *x1) *x1 = x; - if (y > *y1) *y1 = y; - } } -Py::Object _path_module::get_path_extents(const Py::Tuple& args) { - args.verify_length(2); +Py::Object _path_module::get_path_extents(const Py::Tuple& args) +{ + args.verify_length(2); - PathIterator path(args[0]); - agg::trans_affine trans = py_to_agg_transformation_matrix(args[1], false); + PathIterator path(args[0]); + agg::trans_affine trans = py_to_agg_transformation_matrix(args[1], false); - npy_intp extent_dims[] = { 2, 2, 0 }; - double* extents_data = new double[4]; - double xm, ym; - PyArrayObject* extents = NULL; - try { - extents_data[0] = std::numeric_limits<double>::infinity(); - extents_data[1] = std::numeric_limits<double>::infinity(); - extents_data[2] = -std::numeric_limits<double>::infinity(); - extents_data[3] = -std::numeric_limits<double>::infinity(); + npy_intp extent_dims[] = { 2, 2, 0 }; + double* extents_data = new double[4]; + double xm, ym; + PyArrayObject* extents = NULL; + try + { + extents_data[0] = std::numeric_limits<double>::infinity(); + extents_data[1] = std::numeric_limits<double>::infinity(); + extents_data[2] = -std::numeric_limits<double>::infinity(); + extents_data[3] = -std::numeric_limits<double>::infinity(); - ::get_path_extents(path, trans, - &extents_data[0], &extents_data[1], &extents_data[2], &extents_data[3], - &xm, &ym); + ::get_path_extents(path, trans, + &extents_data[0], &extents_data[1], &extents_data[2], &extents_data[3], + &xm, &ym); - extents = (PyArrayObject*)PyArray_SimpleNewFromData - (2, extent_dims, PyArray_DOUBLE, extents_data); - } catch (...) { - if (extents) - Py_XDECREF(extents); - else - delete[] extents_data; - throw; - } + extents = (PyArrayObject*)PyArray_SimpleNewFromData + (2, extent_dims, PyArray_DOUBLE, extents_data); + } + catch (...) + { + if (extents) + Py_XDECREF(extents); + else + delete[] extents_data; + throw; + } - return Py::Object((PyObject*)extents); + return Py::Object((PyObject*)extents); } -Py::Object _path_module::update_path_extents(const Py::Tuple& args) { - args.verify_length(5); +Py::Object _path_module::update_path_extents(const Py::Tuple& args) +{ + args.verify_length(5); - double x0, y0, x1, y1; - PathIterator path(args[0]); - agg::trans_affine trans = py_to_agg_transformation_matrix(args[1], false); - if (!py_convert_bbox(args[2].ptr(), x0, y0, x1, y1)) { - throw Py::ValueError("Must pass Bbox object as arg 3 of update_path_extents"); - } - Py::Object minpos_obj = args[3]; - bool ignore = bool(Py::Int(args[4])); + double x0, y0, x1, y1; + PathIterator path(args[0]); + agg::trans_affine trans = py_to_agg_transformation_matrix(args[1], false); + if (!py_convert_bbox(args[2].ptr(), x0, y0, x1, y1)) + { + throw Py::ValueError("Must pass Bbox object as arg 3 of update_path_extents"); + } + Py::Object minpos_obj = args[3]; + bool ignore = bool(Py::Int(args[4])); - double xm, ym; - PyArrayObject* input_minpos = NULL; - try { - input_minpos = (PyArrayObject*)PyArray_FromObject(minpos_obj.ptr(), PyArray_DOUBLE, 1, 1); - if (!input_minpos || PyArray_DIM(input_minpos, 0) != 2) { - throw Py::TypeError("Argument 4 to update_path_extents must be a length-2 numpy array."); + double xm, ym; + PyArrayObject* input_minpos = NULL; + try + { + input_minpos = (PyArrayObject*)PyArray_FromObject(minpos_obj.ptr(), PyArray_DOUBLE, 1, 1); + if (!input_minpos || PyArray_DIM(input_minpos, 0) != 2) + { + throw Py::TypeError("Argument 4 to update_path_extents must be a length-2 numpy array."); + } + xm = *(double*)PyArray_GETPTR1(input_minpos, 0); + ym = *(double*)PyArray_GETPTR1(input_minpos, 1); } - xm = *(double*)PyArray_GETPTR1(input_minpos, 0); - ym = *(double*)PyArray_GETPTR1(input_minpos, 1); - } catch (...) { + catch (...) + { + Py_XDECREF(input_minpos); + throw; + } Py_XDECREF(input_minpos); - throw; - } - Py_XDECREF(input_minpos); - npy_intp extent_dims[] = { 2, 2, 0 }; - double* extents_data = new double[4]; - npy_intp minpos_dims[] = { 2, 0 }; - double* minpos_data = new double[2]; - PyArrayObject* extents = NULL; - PyArrayObject* minpos = NULL; - bool changed = false; + npy_intp extent_dims[] = { 2, 2, 0 }; + double* extents_data = new double[4]; + npy_intp minpos_dims[] = { 2, 0 }; + double* minpos_data = new double[2]; + PyArrayObject* extents = NULL; + PyArrayObject* minpos = NULL; + bool changed = false; - try { - if (ignore) { - extents_data[0] = std::numeric_limits<double>::infinity(); - extents_data[1] = std::numeric_limits<double>::infinity(); - extents_data[2] = -std::numeric_limits<double>::infinity(); - extents_data[3] = -std::numeric_limits<double>::infinity(); - minpos_data[0] = std::numeric_limits<double>::infinity(); - minpos_data[1] = std::numeric_limits<double>::infinity(); - } else { - extents_data[0] = std::min(x0, x1); - extents_data[1] = std::min(y0, y1); - extents_data[2] = std::max(x0, x1); - extents_data[3] = std::max(y0, y1); - minpos_data[0] = xm; - minpos_data[1] = ym; - } + try + { + if (ignore) + { + extents_data[0] = std::numeric_limits<double>::infinity(); + extents_data[1] = std::numeric_limits<double>::infinity(); + extents_data[2] = -std::numeric_limits<double>::infinity(); + extents_data[3] = -std::numeric_limits<double>::infinity(); + minpos_data[0] = std::numeric_limits<double>::infinity(); + minpos_data[1] = std::numeric_limits<double>::infinity(); + } + else + { + extents_data[0] = std::min(x0, x1); + extents_data[1] = std::min(y0, y1); + extents_data[2] = std::max(x0, x1); + extents_data[3] = std::max(y0, y1); + minpos_data[0] = xm; + minpos_data[1] = ym; + } - ::get_path_extents(path, trans, - &extents_data[0], &extents_data[1], &extents_data[2], &extents_data[3], - &minpos_data[0], &minpos_data[1]); + ::get_path_extents(path, trans, + &extents_data[0], &extents_data[1], &extents_data[2], &extents_data[3], + &minpos_data[0], &minpos_data[1]); - changed = (extents_data[0] != x0 || - extents_data[1] != y0 || - extents_data[2] != x1 || - extents_data[3] != y1 || - minpos_data[0] != xm || - minpos_data[1] != ym); + changed = (extents_data[0] != x0 || + extents_data[1] != y0 || + extents_data[2] != x1 || + extents_data[3] != y1 || + minpos_data[0] != xm || + minpos_data[1] != ym); - extents = (PyArrayObject*)PyArray_SimpleNewFromData - (2, extent_dims, PyArray_DOUBLE, extents_data); - minpos = (PyArrayObject*)PyArray_SimpleNewFromData - (1, minpos_dims, PyArray_DOUBLE, minpos_data); - } catch(...) { - if (extents) - Py_XDECREF(extents); - else - delete[] extents_data; - if (minpos) - Py_XDECREF(minpos); - else - delete[] minpos_data; - throw; - } + extents = (PyArrayObject*)PyArray_SimpleNewFromData + (2, extent_dims, PyArray_DOUBLE, extents_data); + minpos = (PyArrayObject*)PyArray_SimpleNewFromData + (1, minpos_dims, PyArray_DOUBLE, minpos_data); + } + catch (...) + { + if (extents) + Py_XDECREF(extents); + else + delete[] extents_data; + if (minpos) + Py_XDECREF(minpos); + else + delete[] minpos_data; + throw; + } - Py::Tuple result(3); - result[0] = Py::Object((PyObject*) extents); - result[1] = Py::Object((PyObject*) minpos); - result[2] = Py::Int(changed ? 1 : 0); + Py::Tuple result(3); + result[0] = Py::Object((PyObject*) extents); + result[1] = Py::Object((PyObject*) minpos); + result[2] = Py::Int(changed ? 1 : 0); - return result; + return result; } -Py::Object _path_module::get_path_collection_extents(const Py::Tuple& args) { - args.verify_length(5); +Py::Object _path_module::get_path_collection_extents(const Py::Tuple& args) +{ + args.verify_length(5); - //segments, trans, clipbox, colors, linewidths, antialiaseds - agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[0]); - Py::SeqBase<Py::Object> paths = args[1]; - Py::SeqBase<Py::Object> transforms_obj = args[2]; - Py::Object offsets_obj = args[3]; - agg::trans_affine offset_trans = py_to_agg_transformation_matrix(args[4], false); + //segments, trans, clipbox, colors, linewidths, antialiaseds + agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[0]); + Py::SeqBase<Py::Object> paths = args[1]; + Py::SeqBase<Py::Object> transforms_obj = args[2]; + Py::Object offsets_obj = args[3]; + agg::trans_affine offset_trans = py_to_agg_transformation_matrix(args[4], false); - PyArrayObject* offsets = NULL; - double x0, y0, x1, y1, xm, ym; + PyArrayObject* offsets = NULL; + double x0, y0, x1, y1, xm, ym; - try { - offsets = (PyArrayObject*)PyArray_FromObject(offsets_obj.ptr(), PyArray_DOUBLE, 0, 2); - if (!offsets || - (PyArray_NDIM(offsets) == 2 && PyArray_DIM(offsets, 1) != 2) || - (PyArray_NDIM(offsets) == 1 && PyArray_DIM(offsets, 0) != 0)) { - throw Py::ValueError("Offsets array must be Nx2"); - } + try + { + offsets = (PyArrayObject*)PyArray_FromObject(offsets_obj.ptr(), PyArray_DOUBLE, 0, 2); + if (!offsets || + (PyArray_NDIM(offsets) == 2 && PyArray_DIM(offsets, 1) != 2) || + (PyArray_NDIM(offsets) == 1 && PyArray_DIM(offsets, 0) != 0)) + { + throw Py::ValueError("Offsets array must be Nx2"); + } - size_t Npaths = paths.length(); - size_t Noffsets = offsets->dimensions[0]; - size_t N = std::max(Npaths, Noffsets); - size_t Ntransforms = std::min(transforms_obj.length(), N); - size_t i; + size_t Npaths = paths.length(); + size_t Noffsets = offsets->dimensions[0]; + size_t N = std::max(Npaths, Noffsets); + size_t Ntransforms = std::min(transforms_obj.length(), N); + size_t i; - // Convert all of the transforms up front - typedef std::vector<agg::trans_affine> transforms_t; - transforms_t transforms; - transforms.reserve(Ntransforms); - for (i = 0; i < Ntransforms; ++i) { - agg::trans_affine trans = py_to_agg_transformation_matrix - (transforms_obj[i], false); - trans *= master_transform; - transforms.push_back(trans); - } + // Convert all of the transforms up front + typedef std::vector<agg::trans_affine> transforms_t; + transforms_t transforms; + transforms.reserve(Ntransforms); + for (i = 0; i < Ntransforms; ++i) + { + agg::trans_affine trans = py_to_agg_transformation_matrix + (transforms_obj[i], false); + trans *= master_transform; + transforms.push_back(trans); + } - // The offset each of those and collect the mins/maxs - x0 = std::numeric_limits<double>::infinity(); - y0 = std::numeric_limits<double>::infinity(); - x1 = -std::numeric_limits<double>::infinity(); - y1 = -std::numeric_limits<double>::infinity(); - agg::trans_affine trans; + // The offset each of those and collect the mins/maxs + x0 = std::numeric_limits<double>::infinity(); + y0 = std::numeric_limits<double>::infinity(); + x1 = -std::numeric_limits<double>::infinity(); + y1 = -std::numeric_limits<double>::infinity(); + agg::trans_affine trans; - for (i = 0; i < N; ++i) { - PathIterator path(paths[i % Npaths]); - if (Ntransforms) { - trans = transforms[i % Ntransforms]; - } else { - trans = master_transform; - } + for (i = 0; i < N; ++i) + { + PathIterator path(paths[i % Npaths]); + if (Ntransforms) + { + trans = transforms[i % Ntransforms]; + } + else + { + trans = master_transform; + } - if (Noffsets) { - double xo = *(double*)PyArray_GETPTR2(offsets, i % Noffsets, 0); - double yo = *(double*)PyArray_GETPTR2(offsets, i % Noffsets, 1); - offset_trans.transform(&xo, &yo); - trans *= agg::trans_affine_translation(xo, yo); - } + if (Noffsets) + { + double xo = *(double*)PyArray_GETPTR2(offsets, i % Noffsets, 0); + double yo = *(double*)PyArray_GETPTR2(offsets, i % Noffsets, 1); + offset_trans.transform(&xo, &yo); + trans *= agg::trans_affine_translation(xo, yo); + } - ::get_path_extents(path, trans, &x0, &y0, &x1, &y1, &xm, &ym); + ::get_path_extents(path, trans, &x0, &y0, &x1, &y1, &xm, &ym); + } } - } catch (...) { + catch (...) + { + Py_XDECREF(offsets); + throw; + } + Py_XDECREF(offsets); - throw; - } - Py_XDECREF(offsets); - - Py::Tuple result(4); - result[0] = Py::Float(x0); - result[1] = Py::Float(y0); - result[2] = Py::Float(x1); - result[3] = Py::Float(y1); - return result; + Py::Tuple result(4); + result[0] = Py::Float(x0); + result[1] = Py::Float(y0); + result[2] = Py::Float(x1); + result[3] = Py::Float(y1); + return result; } -Py::Object _path_module::point_in_path_collection(const Py::Tuple& args) { - args.verify_length(9); +Py::Object _path_module::point_in_path_collection(const Py::Tuple& args) +{ + args.verify_length(9); - //segments, trans, clipbox, colors, linewidths, antialiaseds - double x = Py::Float(args[0]); - double y = Py::Float(args[1]); - double radius = Py::Float(args[2]); - agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[3]); - Py::SeqBase<Py::Object> paths = args[4]; - Py::SeqBase<Py::Object> transforms_obj = args[5]; - Py::SeqBase<Py::Object> offsets_obj = args[6]; - agg::trans_affine offset_trans = py_to_agg_transformation_matrix(args[7]); - bool filled = Py::Int(args[8]); + //segments, trans, clipbox, colors, linewidths, antialiaseds + double x = Py::Float(args[0]); + double y = Py::Float(args[1]); + double radius = Py::Float(args[2]); + agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[3]); + Py::SeqBase<Py::Object> paths = args[4]; + Py::SeqBase<Py::Object> transforms_obj = args[5]; + Py::SeqBase<Py::Object> offsets_obj = args[6]; + agg::trans_affine offset_trans = py_to_agg_transformation_matrix(args[7]); + bool filled = Py::Int(args[8]); - PyArrayObject* offsets = (PyArrayObject*)PyArray_FromObject(offsets_obj.ptr(), PyArray_DOUBLE, 0, 2); - if (!offsets || - (PyArray_NDIM(offsets) == 2 && PyArray_DIM(offsets, 1) != 2) || - (PyArray_NDIM(offsets) == 1 && PyArray_DIM(offsets, 0) != 0)) { - throw Py::ValueError("Offsets array must be Nx2"); - } + PyArrayObject* offsets = (PyArrayObject*)PyArray_FromObject(offsets_obj.ptr(), PyArray_DOUBLE, 0, 2); + if (!offsets || + (PyArray_NDIM(offsets) == 2 && PyArray_DIM(offsets, 1) != 2) || + (PyArray_NDIM(offsets) == 1 && PyArray_DIM(offsets, 0) != 0)) + { + throw Py::ValueError("Offsets array must be Nx2"); + } - size_t Npaths = paths.length(); - size_t Noffsets = offsets->dimensions[0]; - size_t N = std::max(Npaths, Noffsets); - size_t Ntransforms = std::min(transforms_obj.length(), N); - size_t i; + size_t Npaths = paths.length(); + size_t Noffsets = offsets->dimensions[0]; + size_t N = std::max(Npaths, Noffsets); + size_t Ntransforms = std::min(transforms_obj.length(), N); + size_t i; - // Convert all of the transforms up front - typedef std::vector<agg::trans_affine> transforms_t; - transforms_t transforms; - transforms.reserve(Ntransforms); - for (i = 0; i < Ntransforms; ++i) { - agg::trans_affine trans = py_to_agg_transformation_matrix - (transforms_obj[i], false); - trans *= master_transform; - transforms.push_back(trans); - } + // Convert all of the transforms up front + typedef std::vector<agg::trans_affine> transforms_t; + transforms_t transforms; + transforms.reserve(Ntransforms); + for (i = 0; i < Ntransforms; ++i) + { + agg::trans_affine trans = py_to_agg_transformation_matrix + (transforms_obj[i], false); + trans *= master_transform; + transforms.push_back(trans); + } - Py::List result; - agg::trans_affine trans; + Py::List result; + agg::trans_affine trans; - for (i = 0; i < N; ++i) { - PathIterator path(paths[i % Npaths]); + for (i = 0; i < N; ++i) + { + PathIterator path(paths[i % Npaths]); - if (Ntransforms) { - trans = transforms[i % Ntransforms]; - } else { - trans = master_transform; - } + if (Ntransforms) + { + trans = transforms[i % Ntransforms]; + } + else + { + trans = master_transform; + } - if (Noffsets) { - double xo = *(double*)PyArray_GETPTR2(offsets, i % Noffsets, 0); - double yo = *(double*)PyArray_GETPTR2(offsets, i % Noffsets, 1); - offset_trans.transform(&xo, &yo); - trans *= agg::trans_affine_translation(xo, yo); - } + if (Noffsets) + { + double xo = *(double*)PyArray_GETPTR2(offsets, i % Noffsets, 0); + double yo = *(double*)PyArray_GETPTR2(offsets, i % Noffsets, 1); + offset_trans.transform(&xo, &yo); + trans *= agg::trans_affine_translation(xo, yo); + } - if (filled) { - if (::point_in_path(x, y, path, trans)) - result.append(Py::Int((int)i)); - } else { - if (::point_on_path(x, y, radius, path, trans)) - result.append(Py::Int((int)i)); + if (filled) + { + if (::point_in_path(x, y, path, trans)) + result.append(Py::Int((int)i)); + } + else + { + if (::point_on_path(x, y, radius, path, trans)) + result.append(Py::Int((int)i)); + } } - } - return result; + return result; } bool path_in_path(PathIterator& a, const agg::trans_affine& atrans, - PathIterator& b, const agg::trans_affine& btrans) { - typedef agg::conv_transform<PathIterator> transformed_path_t; - typedef agg::conv_curve<transformed_path_t> curve_t; + PathIterator& b, const agg::trans_affine& btrans) +{ + typedef agg::conv_transform<PathIterator> transformed_path_t; + typedef agg::conv_curve<transformed_path_t> curve_t; - if (a.total_vertices() < 3) - return false; + if (a.total_vertices() < 3) + return false; - transformed_path_t b_path_trans(b, btrans); - curve_t b_curved(b_path_trans); + transformed_path_t b_path_trans(b, btrans); + curve_t b_curved(b_path_trans); - double x, y; - b_curved.rewind(0); - while (b_curved.vertex(&x, &y) != agg::path_cmd_stop) { - if (!::point_in_path(x, y, a, atrans)) - return false; - } + double x, y; + b_curved.rewind(0); + while (b_curved.vertex(&x, &y) != agg::path_cmd_stop) + { + if (!::point_in_path(x, y, a, atrans)) + return false; + } - return true; + return true; } -Py::Object _path_module::path_in_path(const Py::Tuple& args) { - args.verify_length(4); +Py::Object _path_module::path_in_path(const Py::Tuple& args) +{ + args.verify_length(4); - PathIterator a(args[0]); - agg::trans_affine atrans = py_to_agg_transformation_matrix(args[1]); - PathIterator b(args[2]); - agg::trans_affine btrans = py_to_agg_transformation_matrix(args[3]); + PathIterator a(args[0]); + agg::trans_affine atrans = py_to_agg_transformation_matrix(args[1]); + PathIterator b(args[2]); + agg::trans_affine btrans = py_to_agg_transformation_matrix(args[3]); - return Py::Int(::path_in_path(a, atrans, b, btrans)); + return Py::Int(::path_in_path(a, atrans, b, btrans)); } /** The clip_path_to_rect code here is a clean-room implementation of the @@ -576,398 +638,465 @@ typedef std::vector<XY> Polygon; -namespace clip_to_rect_filters { - /* There are four different passes needed to create/remove vertices - (one for each side of the rectangle). The differences between those - passes are encapsulated in these functor classes. - */ - struct bisectx { +namespace clip_to_rect_filters +{ +/* There are four different passes needed to create/remove vertices + (one for each side of the rectangle). The differences between those + passes are encapsulated in these functor classes. +*/ +struct bisectx +{ double m_x; bisectx(double x) : m_x(x) {} - void bisect(double sx, double sy, double px, double py, double* bx, double* by) const { - *bx = m_x; - double dx = px - sx; - double dy = py - sy; - *by = sy + dy * ((m_x - sx) / dx); + void bisect(double sx, double sy, double px, double py, double* bx, double* by) const + { + *bx = m_x; + double dx = px - sx; + double dy = py - sy; + *by = sy + dy * ((m_x - sx) / dx); } - }; +}; - struct xlt : public bisectx { +struct xlt : public bisectx +{ xlt(double x) : bisectx(x) {} - bool is_inside(double x, double y) const { - return x <= m_x; + bool is_inside(double x, double y) const + { + return x <= m_x; } - }; +}; - struct xgt : public bisectx { +struct xgt : public bisectx +{ xgt(double x) : bisectx(x) {} - bool is_inside(double x, double y) const { - return x >= m_x; + bool is_inside(double x, double y) const + { + return x >= m_x; } - }; +}; - struct bisecty { +struct bisecty +{ double m_y; bisecty(double y) : m_y(y) {} - void bisect(double sx, double sy, double px, double py, double* bx, double* by) const { - *by = m_y; - double dx = px - sx; - double dy = py - sy; - *bx = sx + dx * ((m_y - sy) / dy); + void bisect(double sx, double sy, double px, double py, double* bx, double* by) const + { + *by = m_y; + double dx = px - sx; + double dy = py - sy; + *bx = sx + dx * ((m_y - sy) / dy); } - }; +}; - struct ylt : public bisecty { +struct ylt : public bisecty +{ ylt(double y) : bisecty(y) {} - bool is_inside(double x, double y) const { - return y <= m_y; + bool is_inside(double x, double y) const + { + return y <= m_y; } - }; +}; - struct ygt : public bisecty { +struct ygt : public bisecty +{ ygt(double y) : bisecty(y) {} - bool is_inside(double x, double y) const { - return y >= m_y; + bool is_inside(double x, double y) const + { + return y >= m_y; } - }; +}; } template<class Filter> -void clip_to_rect_one_step(const Polygon& polygon, Polygon& result, const Filter& filter) { - double sx, sy, px, py, bx, by; - bool sinside, pinside; - result.clear(); +void clip_to_rect_one_step(const Polygon& polygon, Polygon& result, const Filter& filter) +{ + double sx, sy, px, py, bx, by; + bool sinside, pinside; + result.clear(); - if (polygon.size() == 0) - return; + if (polygon.size() == 0) + return; - sx = polygon.back().x; - sy = polygon.back().y; - for (Polygon::const_iterator i = polygon.begin(); i != polygon.end(); ++i) { - px = i->x; - py = i->y; + sx = polygon.back().x; + sy = polygon.back().y; + for (Polygon::const_iterator i = polygon.begin(); i != polygon.end(); ++i) + { + px = i->x; + py = i->y; - sinside = filter.is_inside(sx, sy); - pinside = filter.is_inside(px, py); + sinside = filter.is_inside(sx, sy); + pinside = filter.is_inside(px, py); - if (sinside ^ pinside) { - filter.bisect(sx, sy, px, py, &bx, &by); - result.push_back(XY(bx, by)); - } + if (sinside ^ pinside) + { + filter.bisect(sx, sy, px, py, &bx, &by); + result.push_back(XY(bx, by)); + } - if (pinside) { - result.push_back(XY(px, py)); + if (pinside) + { + result.push_back(XY(px, py)); + } + + sx = px; + sy = py; } - - sx = px; sy = py; - } } void clip_to_rect(PathIterator& path, - double x0, double y0, double x1, double y1, - bool inside, std::vector<Polygon>& results) { - double xmin, ymin, xmax, ymax; - if (x0 < x1) { - xmin = x0; xmax = x1; - } else { - xmin = x1; xmax = x0; - } + double x0, double y0, double x1, double y1, + bool inside, std::vector<Polygon>& results) +{ + double xmin, ymin, xmax, ymax; + if (x0 < x1) + { + xmin = x0; + xmax = x1; + } + else + { + xmin = x1; + xmax = x0; + } - if (y0 < y1) { - ymin = y0; ymax = y1; - } else { - ymin = y1; ymax = y0; - } + if (y0 < y1) + { + ymin = y0; + ymax = y1; + } + else + { + ymin = y1; + ymax = y0; + } - if (!inside) { - std::swap(xmin, xmax); - std::swap(ymin, ymax); - } + if (!inside) + { + std::swap(xmin, xmax); + std::swap(ymin, ymax); + } - Polygon polygon1, polygon2; - double x, y; - unsigned code = 0; - path.rewind(0); + Polygon polygon1, polygon2; + double x, y; + unsigned code = 0; + path.rewind(0); - do { - // Grab the next subpath and store it in polygon1 - polygon1.clear(); - do { - if (code == agg::path_cmd_move_to) - polygon1.push_back(XY(x, y)); + do + { + // Grab the next subpath and store it in polygon1 + polygon1.clear(); + do + { + if (code == agg::path_cmd_move_to) + polygon1.push_back(XY(x, y)); - code = path.vertex(&x, &y); + code = path.vertex(&x, &y); - if (code == agg::path_cmd_stop) - break; + if (code == agg::path_cmd_stop) + break; - if (code != agg::path_cmd_move_to) - polygon1.push_back(XY(x, y)); - } while ((code & agg::path_cmd_end_poly) != agg::path_cmd_end_poly); + if (code != agg::path_cmd_move_to) + polygon1.push_back(XY(x, y)); + } + while ((code & agg::path_cmd_end_poly) != agg::path_cmd_end_poly); - // The result of each step is fed into the next (note the - // swapping of polygon1 and polygon2 at each step). - clip_to_rect_one_step(polygon1, polygon2, clip_to_rect_filters::xlt(xmax)); - clip_to_rect_one_step(polygon2, polygon1, clip_to_rect_filters::xgt(xmin)); - clip_to_rect_one_step(polygon1, polygon2, clip_to_rect_filters::ylt(ymax)); - clip_to_rect_one_step(polygon2, polygon1, clip_to_rect_filters::ygt(ymin)); + // The result of each step is fed into the next (note the + // swapping of polygon1 and polygon2 at each step). + clip_to_rect_one_step(polygon1, polygon2, clip_to_rect_filters::xlt(xmax)); + clip_to_rect_one_step(polygon2, polygon1, clip_to_rect_filters::xgt(xmin)); + clip_to_rect_one_step(polygon1, polygon2, clip_to_rect_filters::ylt(ymax)); + clip_to_rect_one_step(polygon2, polygon1, clip_to_rect_filters::ygt(ymin)); - // Empty polygons aren't very useful, so skip them - if (polygon1.size()) - results.push_back(polygon1); - } while (code != agg::path_cmd_stop); + // Empty polygons aren't very useful, so skip them + if (polygon1.size()) + results.push_back(polygon1); + } + while (code != agg::path_cmd_stop); } -Py::Object _path_module::clip_path_to_rect(const Py::Tuple &args) { - args.verify_length(3); +Py::Object _path_module::clip_path_to_rect(const Py::Tuple &args) +{ + args.verify_length(3); - PathIterator path(args[0]); - Py::Object bbox_obj = args[1]; - bool inside = Py::Int(args[2]); + PathIterator path(args[0]); + Py::Object bbox_obj = args[1]; + bool inside = Py::Int(args[2]); - double x0, y0, x1, y1; - if (!py_convert_bbox(bbox_obj.ptr(), x0, y0, x1, y1)) - throw Py::TypeError("Argument 2 to clip_to_rect must be a Bbox object."); + double x0, y0, x1, y1; + if (!py_convert_bbox(bbox_obj.ptr(), x0, y0, x1, y1)) + throw Py::TypeError("Argument 2 to clip_to_rect must be a Bbox object."); - std::vector<Polygon> results; + std::vector<Polygon> results; - ::clip_to_rect(path, x0, y0, x1, y1, inside, results); + ::clip_to_rect(path, x0, y0, x1, y1, inside, results); - int dims[2]; - dims[1] = 2; - PyObject* py_results = PyList_New(results.size()); - if (!py_results) - throw Py::RuntimeError("Error creating results list"); - try { - for (std::vector<Polygon>::const_iterator p = results.begin(); p != results.end(); ++p) { - size_t size = p->size(); - dims[0] = p->size(); - PyArrayObject* pyarray = (PyArrayObject*)PyArray_FromDims(2, dims, PyArray_DOUBLE); - for (size_t i = 0; i < size; ++i) { - ((double *)pyarray->data)[2*i] = (*p)[i].x; - ((double *)pyarray->data)[2*i+1] = (*p)[i].y; - } - if (PyList_SetItem(py_results, p - results.begin(), (PyObject *)pyarray) != -1) { - throw Py::RuntimeError("Error creating results list"); - } + int dims[2]; + dims[1] = 2; + PyObject* py_results = PyList_New(results.size()); + if (!py_results) + throw Py::RuntimeError("Error creating results list"); + try + { + for (std::vector<Polygon>::const_iterator p = results.begin(); p != results.end(); ++p) + { + size_t size = p->size(); + dims[0] = p->size(); + PyArrayObject* pyarray = (PyArrayObject*)PyArray_FromDims(2, dims, PyArray_DOUBLE); + for (size_t i = 0; i < size; ++i) + { + ((double *)pyarray->data)[2*i] = (*p)[i].x; + ((double *)pyarray->data)[2*i+1] = (*p)[i].y; + } + if (PyList_SetItem(py_results, p - results.begin(), (PyObject *)pyarray) != -1) + { + throw Py::RuntimeError("Error creating results list"); + } + } } - } catch (...) { - Py_XDECREF(py_results); - throw; - } + catch (...) + { + Py_XDECREF(py_results); + throw; + } - return Py::Object(py_results, true); + return Py::Object(py_results, true); } -Py::Object _path_module::affine_transform(const Py::Tuple& args) { - args.verify_length(2); +Py::Object _path_module::affine_transform(const Py::Tuple& args) +{ + args.verify_length(2); - Py::Object vertices_obj = args[0]; - Py::Object transform_obj = args[1]; + Py::Object vertices_obj = args[0]; + Py::Object transform_obj = args[1]; - PyArrayObject* vertices = NULL; - PyArrayObject* transform = NULL; - PyArrayObject* result = NULL; + PyArrayObject* vertices = NULL; + PyArrayObject* transform = NULL; + PyArrayObject* result = NULL; - try { - vertices = (PyArrayObject*)PyArray_FromObject - (vertices_obj.ptr(), PyArray_DOUBLE, 1, 2); - if (!vertices || - (PyArray_NDIM(vertices) == 2 && PyArray_DIM(vertices, 1) != 2) || - (PyArray_NDIM(vertices) == 1 && PyArray_DIM(vertices, 0) != 2)) - throw Py::ValueError("Invalid vertices array."); + try + { + vertices = (PyArrayObject*)PyArray_FromObject + (vertices_obj.ptr(), PyArray_DOUBLE, 1, 2); + if (!vertices || + (PyArray_NDIM(vertices) == 2 && PyArray_DIM(vertices, 1) != 2) || + (PyArray_NDIM(vertices) == 1 && PyArray_DIM(vertices, 0) != 2)) + throw Py::ValueError("Invalid vertices array."); - transform = (PyArrayObject*) PyArray_FromObject - (transform_obj.ptr(), PyArray_DOUBLE, 2, 2); - if (!transform || PyArray_NDIM(transform) != 2 || - PyArray_DIM(transform, 0) != 3 || PyArray_DIM(transform, 1) != 3) - throw Py::ValueError("Invalid transform."); + transform = (PyArrayObject*) PyArray_FromObject + (transform_obj.ptr(), PyArray_DOUBLE, 2, 2); + if (!transform || PyArray_NDIM(transform) != 2 || + PyArray_DIM(transform, 0) != 3 || PyArray_DIM(transform, 1) != 3) + throw Py::ValueError("Invalid transform."); - double a, b, c, d, e, f; - { - size_t stride0 = PyArray_STRIDE(transform, 0); - size_t stride1 = PyArray_STRIDE(transform, 1); - char* row0 = PyArray_BYTES(transform); - char* row1 = row0 + stride0; + double a, b, c, d, e, f; + { + size_t stride0 = PyArray_STRIDE(transform, 0); + size_t stride1 = PyArray_STRIDE(transform, 1); + char* row0 = PyArray_BYTES(transform); + char* row1 = row0 + stride0; - a = *(double*)(row0); - row0 += stride1; - c = *(double*)(row0); - row0 += stride1; - e = *(double*)(row0); + a = *(double*)(row0); + row0 += stride1; + c = *(double*)(row0); + row0 += stride1; + e = *(double*)(row0); - b = *(double*)(row1); - row1 += stride1; - d = *(double*)(row1); - row1 += stride1; - f = *(double*)(row1); - } + b = *(double*)(row1); + row1 += stride1; + d = *(double*)(row1); + row1 += stride1; + f = *(double*)(row1); + } - // I would have preferred to use PyArray_FromDims here, but on - // 64-bit platforms, PyArray_DIMS() does not return the same thing - // that PyArray_FromDims wants, requiring a copy, which I would - // like to avoid in this critical section. - result = (PyArrayObject*)PyArray_SimpleNew - (PyArray_NDIM(vertices), PyArray_DIMS(vertices), PyArray_DOUBLE); - if (PyArray_NDIM(vertices) == 2) { - size_t n = PyArray_DIM(vertices, 0); - char* vertex_in = PyArray_BYTES(vertices); - double* vertex_out = (double*)PyArray_DATA(result); - size_t stride0 = PyArray_STRIDE(vertices, 0); - size_t stride1 = PyArray_STRIDE(vertices, 1); - double x; - double y; + // I would have preferred to use PyArray_FromDims here, but on + // 64-bit platforms, PyArray_DIMS() does not return the same thing + // that PyArray_FromDims wants, requiring a copy, which I would + // like to avoid in this critical section. + result = (PyArrayObject*)PyArray_SimpleNew + (PyArray_NDIM(vertices), PyArray_DIMS(vertices), PyArray_DOUBLE); + if (PyArray_NDIM(vertices) == 2) + { + size_t n = PyArray_DIM(vertices, 0); + char* vertex_in = PyArray_BYTES(vertices); + double* vertex_out = (double*)PyArray_DATA(result); + size_t stride0 = PyArray_STRIDE(vertices, 0); + size_t stride1 = PyArray_STRIDE(vertices, 1); + double x; + double y; - for (size_t i = 0; i < n; ++i) { - x = *(double*)(vertex_in); - y = *(double*)(vertex_in + stride1); + for (size_t i = 0; i < n; ++i) + { + x = *(double*)(vertex_in); + y = *(double*)(vertex_in + stride1); - *vertex_out++ = a*x + c*y + e; - *vertex_out++ = b*x + d*y + f; + *vertex_out++ = a*x + c*y + e; + *vertex_out++ = b*x + d*y + f; - vertex_in += stride0; - } - } else { - char* vertex_in = PyArray_BYTES(vertices); - double* vertex_out = (double*)PyArray_DATA(result); - size_t stride0 = PyArray_STRIDE(vertices, 0); - double x; - double y; - x = *(double*)(vertex_in); - y = *(double*)(vertex_in + stride0); - *vertex_out++ = a*x + c*y + e; - *vertex_out++ = b*x + d*y + f; + vertex_in += stride0; + } + } + else + { + char* vertex_in = PyArray_BYTES(vertices); + double* vertex_out = (double*)PyArray_DATA(result); + size_t stride0 = PyArray_STRIDE(vertices, 0); + double x; + double y; + x = *(double*)(vertex_in); + y = *(double*)(vertex_in + stride0); + *vertex_out++ = a*x + c*y + e; + *vertex_out++ = b*x + d*y + f; + } } - } catch (...) { + catch (...) + { + Py_XDECREF(vertices); + Py_XDECREF(transform); + Py_XDECREF(result); + } + Py_XDECREF(vertices); Py_XDECREF(transform); - Py_XDECREF(result); - } - Py_XDECREF(vertices); - Py_XDECREF(transform); - - return Py::Object((PyObject*)result, true); + return Py::Object((PyObject*)result, true); } -Py::Object _path_module::count_bboxes_overlapping_bbox(const Py::Tuple& args) { - args.verify_length(2); +Py::Object _path_module::count_bboxes_overlapping_bbox(const Py::Tuple& args) +{ + args.verify_length(2); - Py::Object bbox = args[0]; - Py::SeqBase<Py::Object> bboxes = args[1]; + Py::Object bbox = args[0]; + Py::SeqBase<Py::Object> bboxes = args[1]; - double ax0, ay0, ax1, ay1; - double bx0, by0, bx1, by1; - long count = 0; + double ax0, ay0, ax1, ay1; + double bx0, by0, bx1, by1; + long count = 0; - if (py_convert_bbox(bbox.ptr(), ax0, ay0, ax1, ay1)) { - if (ax1 < ax0) - std::swap(ax0, ax1); - if (ay1 < ay0) - std::swap(ay0, ay1); + if (py_convert_bbox(bbox.ptr(), ax0, ay0, ax1, ay1)) + { + if (ax1 < ax0) + std::swap(ax0, ax1); + if (ay1 < ay0) + std::swap(ay0, ay1); - size_t num_bboxes = bboxes.size(); - for (size_t i = 0; i < num_bboxes; ++i) { - Py::Object bbox_b = bboxes[i]; - if (py_convert_bbox(bbox_b.ptr(), bx0, by0, bx1, by1)) { - if (bx1 < bx0) - std::swap(bx0, bx1); - if (by1 < by0) - std::swap(by0, by1); - if (not ((bx1 <= ax0) or - (by1 <= ay0) or - (bx0 >= ax1) or - (by0 >= ay1))) - ++count; - } else { - throw Py::ValueError("Non-bbox object in bboxes list"); - } + size_t num_bboxes = bboxes.size(); + for (size_t i = 0; i < num_bboxes; ++i) + { + Py::Object bbox_b = bboxes[i]; + if (py_convert_bbox(bbox_b.ptr(), bx0, by0, bx1, by1)) + { + if (bx1 < bx0) + std::swap(bx0, bx1); + if (by1 < by0) + std::swap(by0, by1); + if (not ((bx1 <= ax0) or + (by1 <= ay0) or + (bx0 >= ax1) or + (by0 >= ay1))) + ++count; + } + else + { + throw Py::ValueError("Non-bbox object in bboxes list"); + } + } } - } else { - throw Py::ValueError("First argument to count_bboxes_overlapping_bbox must be a Bbox object."); - } + else + { + throw Py::ValueError("First argument to count_bboxes_overlapping_bbox must be a Bbox object."); + } - return Py::Int(count); + return Py::Int(count); } bool segments_intersect(const double& x1, const double &y1, - const double& x2, const double &y2, - const double& x3, const double &y3, - const double& x4, const double &y4) { - double den = ((y4-y3) * (x2-x1)) - ((x4-x3)*(y2-y1)); - if (den == 0.0) - return false; + const double& x2, const double &y2, + const double& x3, const double &y3, + const double& x4, const double &y4) +{ + double den = ((y4-y3) * (x2-x1)) - ((x4-x3)*(y2-y1)); + if (den == 0.0) + return false; - double n1 = ((x4-x3) * (y1-y3)) - ((y4-y3)*(x1-x3)); - double n2 = ((x2-x1) * (y1-y3)) - ((y2-y1)*(x1-x3)); + double n1 = ((x4-x3) * (y1-y3)) - ((y4-y3)*(x1-x3)); + double n2 = ((x2-x1) * (y1-y3)) - ((y2-y1)*(x1-x3)); - double u1 = n1/den; - double u2 = n2/den; + double u1 = n1/den; + double u2 = n2/den; - return (u1 >= 0.0 && u1 <= 1.0 && - u2 >= 0.0 && u2 <= 1.0); + return (u1 >= 0.0 && u1 <= 1.0 && + u2 >= 0.0 && u2 <= 1.0); } -bool path_intersects_path(PathIterator& p1, PathIterator& p2) { - typedef agg::conv_curve<PathIterator> curve_t; +bool path_intersects_path(PathIterator& p1, PathIterator& p2) +{ + typedef agg::conv_curve<PathIterator> curve_t; - if (p1.total_vertices() < 2 || p2.total_vertices() < 2) - return false; + if (p1.total_vertices() < 2 || p2.total_vertices() < 2) + return false; - curve_t c1(p1); - curve_t c2(p2); + curve_t c1(p1); + curve_t c2(p2); - double x11, y11, x12, y12; - double x21, y21, x22, y22; + double x11, y11, x12, y12; + double x21, y21, x22, y22; - c1.vertex(&x11, &y11); - while (c1.vertex(&x12, &y12) != agg::path_cmd_stop) { - c2.rewind(0); - c2.vertex(&x21, &y21); - while (c2.vertex(&x22, &y22) != agg::path_cmd_stop) { - if (segments_intersect(x11, y11, x12, y12, x21, y21, x22, y22)) - return true; - x21 = x22; y21 = y22; + c1.vertex(&x11, &y11); + while (c1.vertex(&x12, &y12) != agg::path_cmd_stop) + { + c2.rewind(0); + c2.vertex(&x21, &y21); + while (c2.vertex(&x22, &y22) != agg::path_cmd_stop) + { + if (segments_intersect(x11, y11, x12, y12, x21, y21, x22, y22)) + return true; + x21 = x22; + y21 = y22; + } + x11 = x12; + y11 = y12; } - x11 = x12; y11 = y12; - } - return false; + return false; } -Py::Object _path_module::path_intersects_path(const Py::Tuple& args) { - args.verify_length(2); +Py::Object _path_module::path_intersects_path(const Py::Tuple& args) +{ + args.verify_length(2); - PathIterator p1(args[0]); - PathIterator p2(args[1]); + PathIterator p1(args[0]); + PathIterator p2(args[1]); - bool intersects = ::path_intersects_path(p1, p2); - if (!intersects) { - intersects = ::path_in_path(p1, agg::trans_affine(), p2, agg::trans_affine()); - if (!intersects) { - intersects = ::path_in_path(p2, agg::trans_affine(), p1, agg::trans_affine()); - if (!intersects) { - return Py::Int(0); - } + bool intersects = ::path_intersects_path(p1, p2); + if (!intersects) + { + intersects = ::path_in_path(p1, agg::trans_affine(), p2, agg::trans_affine()); + if (!intersects) + { + intersects = ::path_in_path(p2, agg::trans_affine(), p1, agg::trans_affine()); + if (!intersects) + { + return Py::Int(0); + } + } } - } - return Py::Int(1); + return Py::Int(1); } extern "C" -DL_EXPORT(void) - init_path(void) + DL_EXPORT(void) + init_path(void) { - import_array(); + import_array(); - static _path_module* _path = NULL; - _path = new _path_module; + static _path_module* _path = NULL; + _path = new _path_module; }; Modified: branches/transforms/src/agg_py_path_iterator.h ===========... [truncated message content]
Revision: 4500 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4500&view=rev Author: mdboom Date: 2007年11月29日 05:50:25 -0800 (2007年11月29日) Log Message: ----------- Fix mri_with_eeg example Modified Paths: -------------- branches/transforms/examples/mri_with_eeg.py Modified: branches/transforms/examples/mri_with_eeg.py =================================================================== --- branches/transforms/examples/mri_with_eeg.py 2007年11月28日 21:01:01 UTC (rev 4499) +++ branches/transforms/examples/mri_with_eeg.py 2007年11月29日 13:50:25 UTC (rev 4500) @@ -6,10 +6,8 @@ from __future__ import division from pylab import * from matplotlib.lines import Line2D -from matplotlib.transforms import get_bbox_transform, Point, Value, Bbox,\ - unit_bbox +from matplotlib.transforms import Bbox, BboxTransform, BboxTransformTo, Affine2D - # I use if 1 to break up the different regions of code visually if 1: # load the data @@ -36,37 +34,32 @@ if 1: # plot the EEG # load the data + numSamples, numRows = 800,4 data = fromstring(file('data/eeg.dat', 'rb').read(), float) data.shape = numSamples, numRows t = arange(numSamples)/float(numSamples)*10.0 ticklocs = [] ax = subplot(212) + xlim(0,10) + xticks(arange(10)) - boxin = Bbox( - Point(ax.viewLim.ll().x(), Value(-20)), - Point(ax.viewLim.ur().x(), Value(20))) + boxin = Bbox.from_extents(ax.viewLim.x0, -20, ax.viewLim.x1, 20) + height = ax.bbox.height + boxout = Bbox.from_extents(ax.bbox.x0, -1.0 * height, + ax.bbox.x1, 1.0 * height) - height = ax.bbox.ur().y() - ax.bbox.ll().y() - boxout = Bbox( - Point(ax.bbox.ll().x(), Value(-1)*height), - Point(ax.bbox.ur().x(), Value(1) * height)) + transOffset = BboxTransformTo( + Bbox.from_extents(0.0, ax.bbox.y0, 1.0, ax.bbox.y1)) - transOffset = get_bbox_transform( - unit_bbox(), - Bbox( Point( Value(0), ax.bbox.ll().y()), - Point( Value(1), ax.bbox.ur().y()) - )) - - for i in range(numRows): # effectively a copy of transData - trans = get_bbox_transform(boxin, boxout) + trans = BboxTransform(boxin, boxout) offset = (i+1)/(numRows+1) - trans.set_offset( (0, offset), transOffset) + trans += Affine2D().translate(*transOffset.transform_point((0, offset))) thisLine = Line2D( t, data[:,i]-data[0,i], @@ -77,9 +70,6 @@ ax.add_line(thisLine) ticklocs.append(offset) - xlim(0,10) - xticks(arange(10)) - setp(gca(), 'yticklabels', ['PG3', 'PG5', 'PG7', 'PG9']) # set the yticks to use axes coords on the y axis This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4499 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4499&view=rev Author: mdboom Date: 2007年11月28日 13:01:01 -0800 (2007年11月28日) Log Message: ----------- Merged revisions 4496-4498 via svnmerge from http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib ........ r4497 | mdboom | 2007年11月28日 15:43:01 -0500 (2007年11月28日) | 2 lines Minor fix -- updating old \rm{} syntax to \mathrm{} syntax. ........ r4498 | mdboom | 2007年11月28日 15:58:06 -0500 (2007年11月28日) | 2 lines Fix for STIX fonts with PDF backend. ........ Modified Paths: -------------- branches/transforms/examples/mathtext_demo.py branches/transforms/lib/matplotlib/backends/backend_pdf.py Property Changed: ---------------- branches/transforms/ Property changes on: branches/transforms ___________________________________________________________________ Name: svnmerge-integrated - /trunk/matplotlib:1-4495 + /trunk/matplotlib:1-4498 Modified: branches/transforms/examples/mathtext_demo.py =================================================================== --- branches/transforms/examples/mathtext_demo.py 2007年11月28日 20:58:06 UTC (rev 4498) +++ branches/transforms/examples/mathtext_demo.py 2007年11月28日 21:01:01 UTC (rev 4499) @@ -22,7 +22,7 @@ ax.legend(("Foo", "Testing $x^2$")) -ax.set_title(r'$\Delta_i^j \hspace{0.4} \rm{versus} \hspace{0.4} \Delta_{i+1}^j$', fontsize=20) +ax.set_title(r'$\Delta_i^j \hspace{0.4} \mathrm{versus} \hspace{0.4} \Delta_{i+1}^j$', fontsize=20) #fig.savefig('mathtext_demo') show() Modified: branches/transforms/lib/matplotlib/backends/backend_pdf.py =================================================================== --- branches/transforms/lib/matplotlib/backends/backend_pdf.py 2007年11月28日 20:58:06 UTC (rev 4498) +++ branches/transforms/lib/matplotlib/backends/backend_pdf.py 2007年11月28日 21:01:01 UTC (rev 4499) @@ -719,7 +719,7 @@ charprocDict['Type'] = Name('XObject') charprocDict['Subtype'] = Name('Form') charprocDict['BBox'] = bbox - charprocObject = self.reserveObject('charProc for %s' % name) + charprocObject = self.reserveObject('charProc') self.beginStream(charprocObject.id, None, charprocDict) self.currentstream.write(stream) self.endStream() @@ -1308,6 +1308,7 @@ fonttype = global_fonttype if fonttype == 3 and num > 255: + self.file.fontName(fontname) self.file.output(Op.gsave, 0.001 * fontsize, 0, 0, 0.001 * fontsize, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4498 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4498&view=rev Author: mdboom Date: 2007年11月28日 12:58:06 -0800 (2007年11月28日) Log Message: ----------- Fix for STIX fonts with PDF backend. 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年11月28日 20:43:01 UTC (rev 4497) +++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2007年11月28日 20:58:06 UTC (rev 4498) @@ -334,7 +334,7 @@ self.passed_in_file_object = True else: raise ValueError("filename must be a path or a file-like object") - + self.fh = fh self.currentstream = None # stream object to write to, if any fh.write("%PDF-1.4\n") # 1.4 is the first version to have alpha @@ -524,7 +524,7 @@ firstchar = 0 lastchar = len(fontinfo.widths) - 1 - + fontdict = { 'Type': Name('Font'), 'Subtype': Name('Type1'), @@ -569,7 +569,7 @@ 'XHeight': 500, # TODO: this one too 'FontFile': fontfileObject, 'FontFamily': familyname, - 'StemV': 50, # TODO + 'StemV': 50, # TODO # (see also revision 3874; but not all TeX distros have AFM files!) #'FontWeight': a number where 400 = Regular, 700 = Bold } @@ -614,7 +614,7 @@ CMapName currentdict /CMap defineresource pop end end""" - + def embedTTF(self, filename, characters): """Embed the TTF font from the named file into the document.""" @@ -713,7 +713,7 @@ charprocDict['Type'] = Name('XObject') charprocDict['Subtype'] = Name('Form') charprocDict['BBox'] = bbox - charprocObject = self.reserveObject('charProc for %s' % name) + charprocObject = self.reserveObject('charProc') self.beginStream(charprocObject.id, None, charprocDict) self.currentstream.write(stream) self.endStream() @@ -827,7 +827,7 @@ unicode_cmap = (self._identityToUnicodeCMap % (len(unicode_groups), "\n".join(unicode_bfrange))) - + # CIDToGIDMap stream cid_to_gid_map = "".join(cid_to_gid_map).encode("utf-16be") self.beginStream(cidToGidMapObject.id, @@ -842,7 +842,7 @@ {'Length': unicode_cmap}) self.currentstream.write(unicode_cmap) self.endStream() - + descriptor['MaxWidth'] = max_width # Write everything out @@ -896,7 +896,7 @@ warnings.warn(("'%s' can not be subsetted into a Type 3 font. " + "The entire font will be embedded in the output.") % os.path.basename(filename)) - + if fonttype == 3: return embedTTFType3(font, characters, descriptor) elif fonttype == 42: @@ -1378,7 +1378,7 @@ fonttype = 42 else: fonttype = global_fonttype - + if fonttype == 42 or num <= 255: self._setup_textpos(ox, oy, 0, oldx, oldy) oldx, oldy = ox, oy @@ -1397,8 +1397,9 @@ fonttype = 42 else: fonttype = global_fonttype - + if fonttype == 3 and num > 255: + self.file.fontName(fontname) self.file.output(Op.gsave, 0.001 * fontsize, 0, 0, 0.001 * fontsize, @@ -1534,12 +1535,12 @@ y += font.get_descent() / 64.0 fonttype = rcParams['pdf.fonttype'] - + # We can't subset all OpenType fonts, so switch to Type 42 # in that case. if is_opentype_cff_font(font.fname): fonttype = 42 - + def check_simple_method(s): """Determine if we should use the simple or woven method to output this text, and chunks the string into 1-byte and @@ -1830,7 +1831,7 @@ if (self._cliprect, self._clippath) != (cliprect, clippath): cmds.extend(self.push()) if self._cliprect != cliprect: - cmds.extend([t for t in cliprect] + + cmds.extend([t for t in cliprect] + [Op.rectangle, Op.clip, Op.endpath]) if self._clippath != clippath: cmds.extend(PdfFile.pathOperations(clippath) + @@ -1858,7 +1859,7 @@ """ cmds = [] for params, cmd in self.commands: - ours = [ getattr(self, p) for p in params ] + ours = [ getattr(self, p) for p in params ] theirs = [ getattr(other, p) for p in params ] if ours != theirs: cmds.extend(cmd(self, *theirs)) @@ -1919,10 +1920,10 @@ pass filetypes = {'pdf': 'Portable Document Format'} - + def get_default_filetype(self): return 'pdf' - + def print_pdf(self, filename, **kwargs): dpi = kwargs.get('dpi', None) self.figure.set_dpi(72) # Override the dpi kwarg This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4497 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4497&view=rev Author: mdboom Date: 2007年11月28日 12:43:01 -0800 (2007年11月28日) Log Message: ----------- Minor fix -- updating old \rm{} syntax to \mathrm{} syntax. Modified Paths: -------------- trunk/matplotlib/examples/mathtext_demo.py Modified: trunk/matplotlib/examples/mathtext_demo.py =================================================================== --- trunk/matplotlib/examples/mathtext_demo.py 2007年11月28日 20:41:15 UTC (rev 4496) +++ trunk/matplotlib/examples/mathtext_demo.py 2007年11月28日 20:43:01 UTC (rev 4497) @@ -22,7 +22,7 @@ ax.legend(("Foo", "Testing $x^2$")) -ax.set_title(r'$\Delta_i^j \hspace{0.4} \rm{versus} \hspace{0.4} \Delta_{i+1}^j$', fontsize=20) +ax.set_title(r'$\Delta_i^j \hspace{0.4} \mathrm{versus} \hspace{0.4} \Delta_{i+1}^j$', fontsize=20) #fig.savefig('mathtext_demo') show() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4496 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4496&view=rev Author: mdboom Date: 2007年11月28日 12:41:15 -0800 (2007年11月28日) Log Message: ----------- Merged revisions 4491-4495 via svnmerge from http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib ........ r4492 | mdboom | 2007年11月28日 15:13:47 -0500 (2007年11月28日) | 2 lines Fix bug using stix fonts. ........ Modified Paths: -------------- branches/transforms/lib/matplotlib/mathtext.py Property Changed: ---------------- branches/transforms/ Property changes on: branches/transforms ___________________________________________________________________ Name: svnmerge-integrated - /trunk/matplotlib:1-4490 + /trunk/matplotlib:1-4495 Modified: branches/transforms/lib/matplotlib/mathtext.py =================================================================== --- branches/transforms/lib/matplotlib/mathtext.py 2007年11月28日 20:37:04 UTC (rev 4495) +++ branches/transforms/lib/matplotlib/mathtext.py 2007年11月28日 20:41:15 UTC (rev 4496) @@ -850,6 +850,7 @@ fontmap = {} use_cmex = False cm_fallback = False + _sans = False def __init__(self, *args, **kwargs): TruetypeFonts.__init__(self, *args, **kwargs) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4495 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4495&view=rev Author: mdboom Date: 2007年11月28日 12:37:04 -0800 (2007年11月28日) Log Message: ----------- Minor fixes. Modified Paths: -------------- branches/transforms/lib/matplotlib/transforms.py Modified: branches/transforms/lib/matplotlib/transforms.py =================================================================== --- branches/transforms/lib/matplotlib/transforms.py 2007年11月28日 20:36:45 UTC (rev 4494) +++ branches/transforms/lib/matplotlib/transforms.py 2007年11月28日 20:37:04 UTC (rev 4495) @@ -556,7 +556,7 @@ corners = self.corners() corners_rotated = Affine2D().rotate(radians).transform(corners) bbox = Bbox.unit() - bbox.update_from_data(corners_rotated, ignore=True) + bbox.update_from_data_xy(corners_rotated, ignore=True) return bbox #@staticmethod @@ -649,7 +649,8 @@ def ignore(self, value): """ Set whether the existing bounds of the box should be ignored - by subsequent calls to update_from_data. + by subsequent calls to update_from_data or + update_from_data_xy. value: When True, subsequent calls to update_from_data will ignore the existing bounds of the Bbox. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4494 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4494&view=rev Author: mdboom Date: 2007年11月28日 12:36:45 -0800 (2007年11月28日) Log Message: ----------- Fix Ps import bug Modified Paths: -------------- branches/transforms/lib/matplotlib/backends/backend_ps.py Modified: branches/transforms/lib/matplotlib/backends/backend_ps.py =================================================================== --- branches/transforms/lib/matplotlib/backends/backend_ps.py 2007年11月28日 20:36:22 UTC (rev 4493) +++ branches/transforms/lib/matplotlib/backends/backend_ps.py 2007年11月28日 20:36:45 UTC (rev 4494) @@ -10,7 +10,6 @@ from cStringIO import StringIO from matplotlib import verbose, __version__, rcParams from matplotlib._pylab_helpers import Gcf -import matplotlib.agg as agg from matplotlib.afm import AFM from matplotlib.backend_bases import RendererBase, GraphicsContextBase,\ FigureManagerBase, FigureCanvasBase @@ -144,7 +143,7 @@ self.image_magnification = dpi/72.0 self._clip_paths = {} self._path_collection_id = 0 - + self.fontd = {} self.afmfontd = {} self.used_characters = {} @@ -332,7 +331,7 @@ size = prop.get_size_in_points() font.set_size(size, 72.0) return font - + def _rgba(self, im): return im.as_rgba_str() @@ -406,7 +405,7 @@ id = self._get_clip_path(clippath, clippath_trans) clip.append('%s' % id) clip = '\n'.join(clip) - + #y = figh-(y+h) ps = """gsave %(clip)s @@ -427,7 +426,7 @@ def _convert_path(self, path, transform): path = transform.transform_path(path) - + ps = [] for points, code in path.iter_segments(): if code == Path.MOVETO: @@ -444,7 +443,7 @@ elif code == Path.CLOSEPOLY: ps.append("cl") ps = "\n".join(ps) - + return ps def _get_clip_path(self, clippath, clippath_transform): @@ -489,7 +488,7 @@ ps_cmd.extend(['gsave', ps_color, 'fill', 'grestore']) ps_cmd.extend(['stroke', 'grestore', '} bind def']) - + tpath = trans.transform_path(path) for x, y in tpath.vertices: ps_cmd.append("%1.3g %1.3g o" % (x, y)) @@ -502,7 +501,7 @@ offsetTrans, facecolors, edgecolors, linewidths, linestyles, antialiaseds): write = self._pswriter.write - + path_codes = [] for i, (path, transform) in enumerate(self._iter_collection_raw_paths( master_transform, paths, all_transforms)): @@ -513,7 +512,7 @@ ps_cmd.extend(['} bind def\n']) write('\n'.join(ps_cmd)) path_codes.append(name) - + for xo, yo, path_id, gc, rgbFace in self._iter_collection( path_codes, cliprect, clippath, clippath_trans, offsets, offsetTrans, facecolors, edgecolors, @@ -523,7 +522,7 @@ self._draw_ps(ps, gc, rgbFace) self._path_collection_id += 1 - + def draw_tex(self, gc, x, y, s, prop, angle, ismath='TeX!'): """ draw a Text instance @@ -570,7 +569,7 @@ elif isinstance(s, unicode): return self.draw_unicode(gc, x, y, s, prop, angle) - + elif rcParams['ps.useafm']: font = self._get_font_afm(prop) @@ -654,7 +653,7 @@ kern = 0 last_name = name thisx += kern * scale - + lines.append('%f %f m /%s glyphshow'%(thisx, thisy, name)) thisx += width * scale @@ -671,7 +670,7 @@ grestore """ % locals() self._pswriter.write(ps) - + else: font = self._get_font_ttf(prop) @@ -750,7 +749,7 @@ (len(gc.get_rgb()) <= 3 or gc.get_rgb()[3] != 0.0)) fill = (fill and rgbFace is not None and (len(rgbFace) <= 3 or rgbFace[3] != 0.0)) - + if stroke: self.set_linewidth(gc.get_linewidth()) jint = gc.get_joinstyle() @@ -769,7 +768,7 @@ if clippath: id = self._get_clip_path(clippath, clippath_trans) write('gsave\n%s\n' % id) - + # Jochen, is the strip necessary? - this could be a honking big string write(ps.strip()) write("\n") @@ -795,7 +794,7 @@ if cliprect: write("grestore\n") - + class GraphicsContextPS(GraphicsContextBase): def get_capstyle(self): return {'butt':0, @@ -821,16 +820,16 @@ filetypes = {'ps' : 'Postscript', 'eps' : 'Encapsulated Postscript'} - + def get_default_filetype(self): return 'ps' - + def print_ps(self, outfile, *args, **kwargs): return self._print_ps(outfile, 'ps', *args, **kwargs) def print_eps(self, outfile, *args, **kwargs): return self._print_ps(outfile, 'eps', *args, **kwargs) - + def _print_ps(self, outfile, format, *args, **kwargs): papertype = kwargs.get("papertype", rcParams['ps.papersize']) papertype = papertype.lower() @@ -839,7 +838,7 @@ elif papertype not in papersize: raise RuntimeError( '%s is not a valid papertype. Use one \ of %s'% (papertype, ', '.join( papersize.keys() )) ) - + orientation = kwargs.get("orientation", "portrait").lower() if orientation == 'landscape': isLandscape = True elif orientation == 'portrait': isLandscape = False @@ -849,14 +848,14 @@ dpi = kwargs.get("dpi", 72) facecolor = kwargs.get("facecolor", "w") edgecolor = kwargs.get("edgecolor", "w") - + if rcParams['text.usetex']: self._print_figure_tex(outfile, format, dpi, facecolor, edgecolor, orientation, isLandscape, papertype) else: self._print_figure(outfile, format, dpi, facecolor, edgecolor, orientation, isLandscape, papertype) - + def _print_figure(self, outfile, format, dpi=72, facecolor='w', edgecolor='w', orientation='portrait', isLandscape=False, papertype=None): """ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4493 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4493&view=rev Author: mdboom Date: 2007年11月28日 12:36:22 -0800 (2007年11月28日) Log Message: ----------- Fix PDF font size bug. Modified Paths: -------------- branches/transforms/lib/matplotlib/backends/backend_pdf.py Modified: branches/transforms/lib/matplotlib/backends/backend_pdf.py =================================================================== --- branches/transforms/lib/matplotlib/backends/backend_pdf.py 2007年11月28日 20:13:47 UTC (rev 4492) +++ branches/transforms/lib/matplotlib/backends/backend_pdf.py 2007年11月28日 20:36:22 UTC (rev 4493) @@ -175,7 +175,7 @@ # A bounding box elif isinstance(obj, BboxBase): return fill([pdfRepr(val) for val in obj.bounds]) - + else: raise TypeError, \ "Don't know a PDF representation for %s objects." \ @@ -341,7 +341,7 @@ self.passed_in_file_object = True else: raise ValueError("filename must be a path or a file-like object") - + self.fh = fh self.currentstream = None # stream object to write to, if any fh.write("%PDF-1.4\n") # 1.4 is the first version to have alpha @@ -530,7 +530,7 @@ firstchar = 0 lastchar = len(fontinfo.widths) - 1 - + fontdict = { 'Type': Name('Font'), 'Subtype': Name('Type1'), @@ -575,7 +575,7 @@ 'XHeight': 500, # TODO: this one too 'FontFile': fontfileObject, 'FontFamily': familyname, - 'StemV': 50, # TODO + 'StemV': 50, # TODO # (see also revision 3874; but not all TeX distros have AFM files!) #'FontWeight': a number where 400 = Regular, 700 = Bold } @@ -620,7 +620,7 @@ CMapName currentdict /CMap defineresource pop end end""" - + def embedTTF(self, filename, characters): """Embed the TTF font from the named file into the document.""" @@ -833,7 +833,7 @@ unicode_cmap = (self._identityToUnicodeCMap % (len(unicode_groups), "\n".join(unicode_bfrange))) - + # CIDToGIDMap stream cid_to_gid_map = "".join(cid_to_gid_map).encode("utf-16be") self.beginStream(cidToGidMapObject.id, @@ -848,7 +848,7 @@ {'Length': unicode_cmap}) self.currentstream.write(unicode_cmap) self.endStream() - + descriptor['MaxWidth'] = max_width # Write everything out @@ -902,7 +902,7 @@ warnings.warn(("'%s' can not be subsetted into a Type 3 font. " + "The entire font will be embedded in the output.") % os.path.basename(filename)) - + if fonttype == 3: return embedTTFType3(font, characters, descriptor) elif fonttype == 42: @@ -1054,7 +1054,7 @@ 'SMask': smaskObject}) self.currentstream.write(data) # TODO: predictors (i.e., output png) self.endStream() - + img.flipud_out() def markerObject(self, path, trans, fillp, lw): @@ -1068,7 +1068,7 @@ else: name = result[0] return name - + def writeMarkers(self): for tup in self.markers.values(): name, object, path, trans, fillp, lw = tup @@ -1088,7 +1088,7 @@ #@staticmethod def pathOperations(path, transform): tpath = transform.transform_path(path) - + cmds = [] for points, code in tpath.iter_segments(): if code == Path.MOVETO: @@ -1109,11 +1109,11 @@ cmds.append(Op.closepath) return cmds pathOperations = staticmethod(pathOperations) - + def writePath(self, path, transform): cmds = self.pathOperations(path, transform) self.output(*cmds) - + def reserveObject(self, name=''): """Reserve an ID for an indirect object. The name is used for debugging in case we forget to print out @@ -1249,7 +1249,7 @@ marker, Op.use_xobject) lastx, lasty = x, y output(Op.grestore) - + def _setup_textpos(self, x, y, angle, oldx=0, oldy=0, oldangle=0): if angle == oldangle == 0: self.file.output(x - oldx, y - oldy, Op.textpos) @@ -1285,11 +1285,12 @@ fonttype = 42 else: fonttype = global_fonttype - + if fonttype == 42 or num <= 255: self._setup_textpos(ox, oy, 0, oldx, oldy) oldx, oldy = ox, oy if (fontname, fontsize) != prev_font: + fontsize *= self.dpi/72.0 self.file.output(self.file.fontName(fontname), fontsize, Op.selectfont) prev_font = fontname, fontsize @@ -1300,11 +1301,12 @@ # as XObjects using the 'Do' command. if global_fonttype == 3: for ox, oy, fontname, fontsize, num, symbol_name in glyphs: + fontsize *= self.dpi/72.0 if is_opentype_cff_font(fontname): fonttype = 42 else: fonttype = global_fonttype - + if fonttype == 3 and num > 255: self.file.output(Op.gsave, 0.001 * fontsize, 0, @@ -1427,7 +1429,7 @@ self.check_gc(gc, gc._rgb) if ismath: return self.draw_mathtext(gc, x, y, s, prop, angle) - fontsize = prop.get_size_in_points() + fontsize = prop.get_size_in_points() * self.dpi/72.0 if rcParams['pdf.use14corefonts']: font = self._get_font_afm(prop) @@ -1441,12 +1443,12 @@ y += font.get_descent() / 64.0 fonttype = rcParams['pdf.fonttype'] - + # We can't subset all OpenType fonts, so switch to Type 42 # in that case. if is_opentype_cff_font(font.fname): fonttype = 42 - + def check_simple_method(s): """Determine if we should use the simple or woven method to output this text, and chunks the string into 1-byte and @@ -1476,7 +1478,7 @@ """Outputs text using the simple method.""" self.file.output(Op.begin_text, self.file.fontName(prop), - prop.get_size_in_points(), + fontsize, Op.selectfont) self._setup_textpos(x, y, angle) self.file.output(self.encode_string(s, fonttype), Op.show, Op.end_text) @@ -1503,7 +1505,7 @@ if mode == 1: self.file.output(Op.begin_text, self.file.fontName(prop), - prop.get_size_in_points(), + fontsize, Op.selectfont) for chunk_type, chunk in chunks: @@ -1566,7 +1568,7 @@ elif rcParams['pdf.use14corefonts']: font = self._get_font_afm(prop) l, b, w, h, d = font.get_str_bbox_and_descent(s) - scale = prop.get_size_in_points() / 1000.0 + scale = prop.get_size_in_points() w *= scale h *= scale d *= scale @@ -1574,10 +1576,11 @@ font = self._get_font_ttf(prop) font.set_text(s, 0.0, flags=LOAD_NO_HINTING) w, h = font.get_width_height() - w /= 64.0 - h /= 64.0 + scale = (1.0 / 64.0) + w *= scale + h *= scale d = font.get_descent() - d /= 64.0 + d *= scale return w, h, d def _get_font_afm(self, prop): @@ -1780,7 +1783,7 @@ different = ours.shape != theirs.shape or npy.any(ours != theirs) if different: break - + if different: theirs = [getattr(other, p) for p in params] cmds.extend(cmd(self, *theirs)) @@ -1841,10 +1844,10 @@ pass filetypes = {'pdf': 'Portable Document Format'} - + def get_default_filetype(self): return 'pdf' - + def print_pdf(self, filename, **kwargs): dpi = kwargs.get('dpi', 72) self.figure.set_dpi(dpi) # Override the dpi kwarg This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4492 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4492&view=rev Author: mdboom Date: 2007年11月28日 12:13:47 -0800 (2007年11月28日) Log Message: ----------- Fix bug using stix fonts. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/mathtext.py Modified: trunk/matplotlib/lib/matplotlib/mathtext.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mathtext.py 2007年11月28日 18:30:10 UTC (rev 4491) +++ trunk/matplotlib/lib/matplotlib/mathtext.py 2007年11月28日 20:13:47 UTC (rev 4492) @@ -852,6 +852,7 @@ fontmap = {} use_cmex = False cm_fallback = False + _sans = False def __init__(self, *args, **kwargs): TruetypeFonts.__init__(self, *args, **kwargs) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4491 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4491&view=rev Author: mdboom Date: 2007年11月28日 10:30:10 -0800 (2007年11月28日) Log Message: ----------- Merged revisions 4444-4490 via svnmerge from http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib ........ r4457 | jdh2358 | 2007年11月26日 16:53:01 -0500 (2007年11月26日) | 2 lines fixed a bug in unit processing -- thanks chris ........ r4461 | efiring | 2007年11月26日 21:24:22 -0500 (2007年11月26日) | 5 lines Fixed pcolormesh bug Integer X input was causing Y to be turned into an integer as well. ........ r4472 | jdh2358 | 2007年11月27日 13:34:38 -0500 (2007年11月27日) | 2 lines tagged version 91.0 for release ........ r4474 | cmoad | 2007年11月27日 20:31:59 -0500 (2007年11月27日) | 1 line version bumps ........ r4475 | cmoad | 2007年11月27日 20:33:15 -0500 (2007年11月27日) | 1 line rev typo fixed for 0.91 release ........ r4476 | cmoad | 2007年11月27日 21:24:40 -0500 (2007年11月27日) | 1 line CXX/WrapPython.h was missing from sdist build ........ r4477 | cmoad | 2007年11月27日 21:25:06 -0500 (2007年11月27日) | 1 line rev bump for new bug ........ r4478 | cmoad | 2007年11月27日 21:48:38 -0500 (2007年11月27日) | 1 line reverting WrapPython.h inclusion ........ r4482 | mdboom | 2007年11月28日 10:18:41 -0500 (2007年11月28日) | 2 lines Remove fonts/otf directory in list of data files. ........ r4486 | jdh2358 | 2007年11月28日 13:11:27 -0500 (2007年11月28日) | 2 lines updated coding guide with trailing whitespace config suggestion ........ r4490 | jdh2358 | 2007年11月28日 13:28:19 -0500 (2007年11月28日) | 2 lines fixed coding guide bug for trailing whitespace ........ Modified Paths: -------------- branches/transforms/API_CHANGES branches/transforms/CHANGELOG branches/transforms/CODING_GUIDE branches/transforms/lib/matplotlib/__init__.py branches/transforms/lib/matplotlib/axes.py branches/transforms/lib/matplotlib/mlab.py branches/transforms/license/LICENSE branches/transforms/setup.py Property Changed: ---------------- branches/transforms/ Property changes on: branches/transforms ___________________________________________________________________ Name: svnmerge-integrated - /trunk/matplotlib:1-4443 + /trunk/matplotlib:1-4490 Modified: branches/transforms/API_CHANGES =================================================================== --- branches/transforms/API_CHANGES 2007年11月28日 18:28:19 UTC (rev 4490) +++ branches/transforms/API_CHANGES 2007年11月28日 18:30:10 UTC (rev 4491) @@ -33,11 +33,11 @@ Bbox.height() Bbox.height Bbox.intervalx().get_bounds() Bbox.intervalx - Bbox.intervalx().set_bounds() + Bbox.intervalx().set_bounds() [Bbox.intervalx is now a property.] Bbox.intervaly().get_bounds() Bbox.intervaly - Bbox.intervaly().set_bounds() + Bbox.intervaly().set_bounds() [Bbox.intervaly is now a property.] Bbox.xmin() Bbox.x0 or Bbox.xmin @@ -84,7 +84,7 @@ [Axes.set_position() now accepts either four scalars or a transforms Bbox instance.] - [also returns a Bbox] + [also returns a Bbox] Axes.toggle_log_lineary() Axes.set_yscale() [Since the recfactoring allows for more than two scale types ('log' or 'linear'), it no longer makes sense to have a @@ -119,10 +119,10 @@ contour.py Contour._segments Contour.get_paths() - [Contour.get_paths() now returns a list of path.Path instances.] + [Contour.get_paths() now returns a list of path.Path instances.] figure.py - Figure.dpi.get()/set() Figure.dpi (a property) + Figure.dpi.get()/set() Figure.dpi (a property) patches.py get_verts() get_path() @@ -150,9 +150,9 @@ offsetTrans, facecolors, edgecolors, linewidths, linestyles, antialiaseds) [optional] - + **changed methods** ---> - draw_image(self, x, y, im, bbox) draw_image(self, x, y, im, bbox, + draw_image(self, x, y, im, bbox) draw_image(self, x, y, im, bbox, clippath, clippath_trans) **removed methods** ---> @@ -166,9 +166,11 @@ draw_polygon draw_rectangle draw_regpoly_collection - + END OF TRANSFORMS REFACTORING +0.91.0 Released + Changed cbook.is_file_like to cbook.is_writable_file_like and corrected behavior. Modified: branches/transforms/CHANGELOG =================================================================== --- branches/transforms/CHANGELOG 2007年11月28日 18:28:19 UTC (rev 4490) +++ branches/transforms/CHANGELOG 2007年11月28日 18:30:10 UTC (rev 4491) @@ -1,3 +1,6 @@ +=============================================================== +2007年11月27日 Released 0.91.0 at revision 4478 + 2007年11月13日 All backends now support writing to a file-like object, not just a regular file. savefig() can be passed a file-like object in place of a file path. - MGD Modified: branches/transforms/CODING_GUIDE =================================================================== --- branches/transforms/CODING_GUIDE 2007年11月28日 18:28:19 UTC (rev 4490) +++ branches/transforms/CODING_GUIDE 2007年11月28日 18:30:10 UTC (rev 4491) @@ -39,6 +39,8 @@ * If you have altered extension code, do you pass unit/memleak_hawaii.py? + + == Importing and name spaces == For numpy, use: @@ -103,7 +105,27 @@ to replace a single long line with two shorter and more readable lines. +Please do not commit lines with trailing white space, as it causes +noise in svn diffs. If you are an emacs user, the following in your +.emacs will cause emacs to strip trailing white space on save for +python, C and C++ +; and similarly for c++-mode-hook and c-mode-hook +(add-hook 'python-mode-hook + (lambda () + (add-hook 'write-file-functions 'delete-trailing-whitespace))) + + + +for older versions of emacs (emacs<22) you may need to do + +(add-hook 'python-mode-hook + (lambda () + (add-hook 'local-write-file-hooks 'delete-trailing-whitespace))) + + + + == Licenses == matplotlib only uses BSD compatible code. If you bring in code from Modified: branches/transforms/lib/matplotlib/__init__.py =================================================================== --- branches/transforms/lib/matplotlib/__init__.py 2007年11月28日 18:28:19 UTC (rev 4490) +++ branches/transforms/lib/matplotlib/__init__.py 2007年11月28日 18:30:10 UTC (rev 4491) @@ -51,11 +51,11 @@ pylab (if pylab is imported). matplotlib is written by John D. Hunter (jdh2358 at -gmail.com). +gmail.com and a host of others). """ from __future__ import generators -__version__ = '0.90.1' +__version__ = '0.91.0' __revision__ = '$Revision$' __date__ = '$Date$' Modified: branches/transforms/lib/matplotlib/axes.py =================================================================== --- branches/transforms/lib/matplotlib/axes.py 2007年11月28日 18:28:19 UTC (rev 4490) +++ branches/transforms/lib/matplotlib/axes.py 2007年11月28日 18:30:10 UTC (rev 4491) @@ -180,7 +180,7 @@ def __call__(self, *args, **kwargs): - if self.axes.xaxis is not None and self.axes.xaxis is not None: + if self.axes.xaxis is not None and self.axes.yaxis is not None: xunits = kwargs.pop( 'xunits', self.axes.xaxis.units) yunits = kwargs.pop( 'yunits', self.axes.yaxis.units) if xunits!=self.axes.xaxis.units: @@ -1305,6 +1305,8 @@ artists = [] + + if len(self.images)<=1 or renderer.option_image_nocomposite(): for im in self.images: im.draw(renderer) @@ -4798,7 +4800,7 @@ X = X.ravel() Y = Y.ravel() - coords = npy.zeros(((Nx * Ny), 2), X.dtype) + coords = npy.zeros(((Nx * Ny), 2), dtype=float) coords[:, 0] = X coords[:, 1] = Y Modified: branches/transforms/lib/matplotlib/mlab.py =================================================================== --- branches/transforms/lib/matplotlib/mlab.py 2007年11月28日 18:28:19 UTC (rev 4490) +++ branches/transforms/lib/matplotlib/mlab.py 2007年11月28日 18:30:10 UTC (rev 4491) @@ -14,10 +14,7 @@ * find - Return the indices where some condition is true; numpy.nonzero is similar but more general. - * polyfit - least squares best polynomial fit of x to y - * polyval - evaluate a vector for a vector of polynomial coeffs - * prctile - find the percentiles of a sequence * prepca - Principal Component Analysis @@ -29,11 +26,14 @@ The following are deprecated; please import directly from numpy (with care--function signatures may differ): + * conv - convolution (numpy.convolve) * corrcoef - The matrix of correlation coefficients * hist -- Histogram (numpy.histogram) * linspace -- Linear spaced array from min to max * meshgrid + * polyfit - least squares best polynomial fit of x to y + * polyval - evaluate a vector for a vector of polynomial coeffs * trapz - trapeziodal integration (trapz(x,y) -> numpy.trapz(y,x)) * vander - the Vandermonde matrix @@ -46,13 +46,13 @@ = record array helper functions = - rec2csv : store record array in CSV file - rec2excel : store record array in excel worksheet - required pyExcelerator - rec2gtk : put record array in GTK treeview - requires gtk - csv2rec : import record array from CSV file with type inspection - rec_append_field : add a field/array to record array - rec_drop_fields : drop fields from record array - rec_join : join two record arrays on sequence of fields + * rec2csv : store record array in CSV file + * rec2excel : store record array in excel worksheet - required pyExcelerator + * rec2gtk : put record array in GTK treeview - requires gtk + * csv2rec : import record array from CSV file with type inspection + * rec_append_field : add a field/array to record array + * rec_drop_fields : drop fields from record array + * rec_join : join two record arrays on sequence of fields For the rec viewer clases (rec2csv, rec2excel and rec2gtk), there are a bunch of Format objects you can pass into the functions that will do Modified: branches/transforms/license/LICENSE =================================================================== --- branches/transforms/license/LICENSE 2007年11月28日 18:28:19 UTC (rev 4490) +++ branches/transforms/license/LICENSE 2007年11月28日 18:30:10 UTC (rev 4491) @@ -1,4 +1,4 @@ -LICENSE AGREEMENT FOR MATPLOTLIB 0.90 +LICENSE AGREEMENT FOR MATPLOTLIB 0.91 -------------------------------------- 1. This LICENSE AGREEMENT is between John D. Hunter ("JDH"), and the @@ -9,30 +9,30 @@ 2. Subject to the terms and conditions of this License Agreement, JDH hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare -derivative works, distribute, and otherwise use matplotlib 0.90 +derivative works, distribute, and otherwise use matplotlib 0.91 alone or in any derivative version, provided, however, that JDH's License Agreement and JDH's notice of copyright, i.e., "Copyright (c) 2002-2007 John D. Hunter; All Rights Reserved" are retained in -matplotlib 0.90 alone or in any derivative version prepared by +matplotlib 0.91 alone or in any derivative version prepared by Licensee. 3. In the event Licensee prepares a derivative work that is based on or -incorporates matplotlib 0.90 or any part thereof, and wants to +incorporates matplotlib 0.91 or any part thereof, and wants to make the derivative work available to others as provided herein, then Licensee hereby agrees to include in any such work a brief summary of -the changes made to matplotlib 0.90. +the changes made to matplotlib 0.91. -4. JDH is making matplotlib 0.90 available to Licensee on an "AS +4. JDH is making matplotlib 0.91 available to Licensee on an "AS IS" basis. JDH MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, JDH MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS -FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF MATPLOTLIB 0.90 +FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF MATPLOTLIB 0.91 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS. 5. JDH SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF MATPLOTLIB -0.90 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR +0.91 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING -MATPLOTLIB 0.90, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF +MATPLOTLIB 0.91, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. 6. This License Agreement will automatically terminate upon a material @@ -44,6 +44,6 @@ trademarks or trade name in a trademark sense to endorse or promote products or services of Licensee, or any third party. -8. By copying, installing or otherwise using matplotlib 0.90, +8. By copying, installing or otherwise using matplotlib 0.91, Licensee agrees to be bound by the terms and conditions of this License Agreement. Modified: branches/transforms/setup.py =================================================================== --- branches/transforms/setup.py 2007年11月28日 18:28:19 UTC (rev 4490) +++ branches/transforms/setup.py 2007年11月28日 18:30:10 UTC (rev 4491) @@ -88,7 +88,6 @@ 'mpl-data/fonts/pdfcorefonts/*.afm', 'mpl-data/fonts/pdfcorefonts/*.txt', 'mpl-data/fonts/ttf/*.ttf', - 'mpl-data/fonts/otf/*.otf', 'mpl-data/images/*.xpm', 'mpl-data/images/*.svg', 'mpl-data/images/*.png', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4490 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4490&view=rev Author: jdh2358 Date: 2007年11月28日 10:28:19 -0800 (2007年11月28日) Log Message: ----------- fixed coding guide bug for trailing whitespace Modified Paths: -------------- trunk/matplotlib/CODING_GUIDE Modified: trunk/matplotlib/CODING_GUIDE =================================================================== --- trunk/matplotlib/CODING_GUIDE 2007年11月28日 18:27:43 UTC (rev 4489) +++ trunk/matplotlib/CODING_GUIDE 2007年11月28日 18:28:19 UTC (rev 4490) @@ -113,14 +113,15 @@ ; and similarly for c++-mode-hook and c-mode-hook (add-hook 'python-mode-hook (lambda () - (add-hook 'local-write-file-hooks 'delete-trailing-whitespace))) + (add-hook 'write-file-functions 'delete-trailing-whitespace))) -for older versions of emacs (emacs<23) you may need to do +for older versions of emacs (emacs<22) you may need to do + (add-hook 'python-mode-hook (lambda () - (add-hook 'write-file-functions 'delete-trailing-whitespace))) + (add-hook 'local-write-file-hooks 'delete-trailing-whitespace))) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4489 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4489&view=rev Author: mdboom Date: 2007年11月28日 10:27:43 -0800 (2007年11月28日) Log Message: ----------- Speed improvements -- determine path extents in C Modified Paths: -------------- branches/transforms/lib/matplotlib/axes.py branches/transforms/lib/matplotlib/colorbar.py branches/transforms/lib/matplotlib/path.py branches/transforms/lib/matplotlib/text.py branches/transforms/lib/matplotlib/transforms.py branches/transforms/src/_path.cpp Modified: branches/transforms/lib/matplotlib/axes.py =================================================================== --- branches/transforms/lib/matplotlib/axes.py 2007年11月28日 18:26:40 UTC (rev 4488) +++ branches/transforms/lib/matplotlib/axes.py 2007年11月28日 18:27:43 UTC (rev 4489) @@ -425,10 +425,10 @@ """ name = "rectilinear" - + _shared_x_axes = cbook.Grouper() _shared_y_axes = cbook.Grouper() - + def __str__(self): return "Axes(%g,%g;%gx%g)" % tuple(self._position.bounds) def __init__(self, fig, rect, @@ -496,7 +496,7 @@ # this call may differ for non-sep axes, eg polar self._init_axis() - + if axisbg is None: axisbg = rcParams['axes.facecolor'] self._axisbg = axisbg self._frameon = frameon @@ -679,12 +679,12 @@ return (self._yaxis_transform + mtransforms.Affine2D().translate(pad_pixels, 0), "center", "left") - + def _update_transScale(self): self.transScale.set( mtransforms.blended_transform_factory( self.xaxis.get_transform(), self.yaxis.get_transform())) - + def get_position(self, original=False): 'Return the a copy of the axes rectangle as a Bbox' if original: @@ -692,7 +692,7 @@ else: return self._position.frozen() - + def set_position(self, pos, which='both'): """ Set the axes position with pos = [left, bottom, width, height] @@ -734,7 +734,7 @@ Intended to be overridden by new projection types. """ return mpatches.Rectangle((0.0, 0.0), 1.0, 1.0) - + def cla(self): 'Clear the current axes' @@ -780,7 +780,7 @@ self.title.set_clip_box(None) self._set_artist_props(self.title) - + self.axesPatch = self.get_axes_patch() self.axesPatch.set_figure(self.figure) self.axesPatch.set_facecolor(self._axisbg) @@ -904,7 +904,7 @@ ymin,ymax = self.get_ybound() ysize = max(math.fabs(ymax-ymin), 1e-30) return ysize/xsize - + def apply_aspect(self): ''' Use self._aspect and self._adjustable to modify the @@ -938,7 +938,7 @@ xsize = max(math.fabs(xmax-xmin), 1e-30) ymin,ymax = self.get_ybound() ysize = max(math.fabs(ymax-ymin), 1e-30) - + l,b,w,h = self.get_position(original=True).bounds box_aspect = fig_aspect * (h/w) data_ratio = box_aspect / A @@ -1125,7 +1125,6 @@ a.set_axes(self) self.artists.append(a) self._set_artist_props(a) - # MGDTODO: We may not want to do this -- the old trunk didn't a.set_clip_path(self.axesPatch) a._remove_method = lambda h: self.artists.remove(h) @@ -1168,7 +1167,7 @@ self._update_patch_limits(p) self.patches.append(p) p._remove_method = lambda h: self.patches.remove(h) - + def _update_patch_limits(self, p): 'update the datalimits for patch p' vertices = p.get_patch_transform().transform(p.get_path().vertices) @@ -1181,7 +1180,6 @@ 'Add a table instance to the list of axes tables' self._set_artist_props(tab) self.tables.append(tab) - # MGDTODO: We may not want to do this (the old version in trunk didn't) tab.set_clip_path(self.axesPatch) tab._remove_method = lambda h: self.tables.remove(h) @@ -1202,7 +1200,8 @@ # and the data in xydata if not ma.isMaskedArray(xys): xys = npy.asarray(xys) - self.update_datalim_numerix(xys[:, 0], xys[:, 1]) + self.dataLim.update_from_data_xy(xys, self.ignore_existing_data_limits) + self.ignore_existing_data_limits = False def update_datalim_numerix(self, x, y): 'Update the data lim bbox with seq of xy tups' @@ -1216,7 +1215,7 @@ def update_datalim_bounds(self, bounds): 'Update the datalim to include the given Bbox' self.dataLim.set(Bbox.union([self.dataLim, bounds])) - + def _process_unit_info(self, xdata=None, ydata=None, kwargs=None): 'look for unit kwargs and update the axis instances as necessary' @@ -1303,7 +1302,7 @@ if self.axison and self._frameon: self.axesPatch.draw(renderer) - + artists = [] if len(self.images)<=1 or renderer.option_image_nocomposite(): @@ -1513,7 +1512,7 @@ self.axesPatch.set_facecolor(color) ### data limits, ticks, tick labels, and formatting - + def invert_xaxis(self): "Invert the x-axis." left, right = self.get_xlim() @@ -1601,7 +1600,7 @@ xmin, xmax = self.xaxis.limit_range_for_scale(xmin, xmax) self.viewLim.intervalx = (xmin, xmax) - + if emit: self.callbacks.process('xlim_changed', self) # Call all of the other x-axes that are shared with this one @@ -1610,7 +1609,7 @@ other.set_xlim(self.viewLim.intervalx, emit=False) if other.figure != self.figure and other.figure.canvas is not None: other.figure.canvas.draw_idle() - + return xmin, xmax def get_xscale(self): @@ -1638,7 +1637,7 @@ """ % {'scale': ' | '.join([repr(x) for x in mscale.get_scale_names()])} self.xaxis.set_scale(value, **kwargs) self._update_transScale() - + def get_xticks(self, minor=False): 'Return the x ticks as a list of locations' return self.xaxis.get_ticklocs(minor=minor) @@ -1777,7 +1776,7 @@ 'return the xaxis scale string: %s' % ( ", ".join(mscale.get_scale_names())) return self.yaxis.get_scale() - + def set_yscale(self, value, **kwargs): """ SET_YSCALE(value, basey=10, subsy=None) @@ -1798,7 +1797,7 @@ """ % {'scale': ' | '.join([repr(x) for x in mscale.get_scale_names()])} self.yaxis.set_scale(value, **kwargs) self._update_transScale() - + def get_yticks(self, minor=False): 'Return the y ticks as a list of locations' return self.yaxis.get_ticklocs(minor=minor) @@ -1903,7 +1902,7 @@ xs = self.format_xdata(x) ys = self.format_ydata(y) return 'x=%s, y=%s'%(xs,ys) - + #### Interactive manipulation def can_zoom(self): @@ -1911,7 +1910,7 @@ Return True if this axes support the zoom box """ return True - + def get_navigate(self): """ Get whether the axes responds to navigation commands @@ -1949,7 +1948,7 @@ 1: LEFT 2: MIDDLE 3: RIGHT - + Intended to be overridden by new projection types. """ self._pan_start = cbook.Bunch( @@ -1968,7 +1967,7 @@ Intended to be overridden by new projection types. """ del self._pan_start - + def drag_pan(self, button, key, x, y): """ Called when the mouse moves during a pan operation. @@ -2029,10 +2028,10 @@ except OverflowError: warnings.warn('Overflow while panning') return - + self.set_xlim(*result.intervalx) self.set_ylim(*result.intervaly) - + def get_cursor_props(self): """return the cursor props as a linewidth, color tuple where linewidth is a float and color is an RGBA tuple""" @@ -3158,7 +3157,7 @@ if where not in ('pre', 'post', 'mid'): raise ValueError("'where' argument to step must be 'pre', 'post' or 'mid'") kwargs['linestyle'] = 'steps-' + where - + return self.plot(x, y, *args, **kwargs) @@ -3828,7 +3827,7 @@ # using list comps rather than arrays to preserve units lower = [thisy-thiserr for (thisy, thiserr) in cbook.safezip(y,yerr)] upper = [thisy+thiserr for (thisy, thiserr) in cbook.safezip(y,yerr)] - + barcols.append( self.vlines(x, lower, upper, **lines_kw) ) if capsize > 0: @@ -4334,7 +4333,7 @@ def quiver(self, *args, **kw): """ - MGDTODO: Document me + TODO: Document me """ q = mquiver.Quiver(self, *args, **kw) self.add_collection(q, False) @@ -4516,7 +4515,7 @@ return im - + def _pcolorargs(self, funcname, *args): if len(args)==1: C = args[0] @@ -4790,7 +4789,7 @@ shading = kwargs.pop('shading', 'flat') edgecolors = kwargs.pop('edgecolors', 'None') antialiased = kwargs.pop('antialiased', False) - + X, Y, C = self._pcolorargs('pcolormesh', *args) Ny, Nx = X.shape @@ -5519,7 +5518,7 @@ # _axes_class is set in the subplot_class_factory self._axes_class.__init__(self, fig, self.figbox, **kwargs) - + def get_geometry(self): 'get the subplot geometry, eg 2,2,3' return self._rows, self._cols, self._num+1 @@ -5608,24 +5607,24 @@ for label in self.get_yticklabels(): label.set_visible(firstcol) -_subplot_classes = {} +_subplot_classes = {} def subplot_class_factory(axes_class=None): # This makes a new class that inherits from SubclassBase and the # given axes_class (which is assumed to be a subclass of Axes). - + # This is perhaps a little bit roundabout to make a new class on # the fly like this, but it means that a new Subplot class does # not have to be created for every type of Axes. if axes_class is None: axes_class = Axes - + new_class = _subplot_classes.get(axes_class) if new_class is None: new_class = new.classobj("%sSubplot" % (axes_class.__name__), (SubplotBase, axes_class), {'_axes_class': axes_class}) _subplot_classes[axes_class] = new_class - + return new_class # This is provided for backward compatibility Modified: branches/transforms/lib/matplotlib/colorbar.py =================================================================== --- branches/transforms/lib/matplotlib/colorbar.py 2007年11月28日 18:26:40 UTC (rev 4488) +++ branches/transforms/lib/matplotlib/colorbar.py 2007年11月28日 18:27:43 UTC (rev 4489) @@ -198,17 +198,17 @@ ax = self.ax ax.set_frame_on(False) ax.set_navigate(False) - x, y = self._outline(X, Y) - ax.set_xlim(npy.amin(x), npy.amax(x)) - ax.set_ylim(npy.amin(y), npy.amax(y)) - ax.update_datalim_numerix(x, y) - self.outline = lines.Line2D(x, y, color=mpl.rcParams['axes.edgecolor'], + xy = self._outline(X, Y) + ax.update_datalim(xy) + ax.set_xlim(*ax.dataLim.intervalx) + ax.set_ylim(*ax.dataLim.intervaly) + self.outline = lines.Line2D(xy[:, 0], xy[:, 1], color=mpl.rcParams['axes.edgecolor'], linewidth=mpl.rcParams['axes.linewidth']) ax.add_artist(self.outline) self.outline.set_clip_box(None) self.outline.set_clip_path(None) c = mpl.rcParams['axes.facecolor'] - self.patch = patches.Polygon(zip(x,y), edgecolor=c, + self.patch = patches.Polygon(xy, edgecolor=c, facecolor=c, linewidth=0.01, zorder=-1) @@ -250,9 +250,11 @@ ii = [0, 1, N-2, N-1, 2*N-1, 2*N-2, N+1, N, 0] x = npy.take(npy.ravel(npy.transpose(X)), ii) y = npy.take(npy.ravel(npy.transpose(Y)), ii) + x = x.reshape((len(x), 1)) + y = y.reshape((len(y), 1)) if self.orientation == 'horizontal': - return y,x - return x,y + return npy.hstack((y, x)) + return npy.hstack((x, y)) def _edges(self, X, Y): ''' @@ -510,7 +512,7 @@ N = len(b) ii = npy.minimum(npy.searchsorted(b, xn), N-1) i0 = npy.maximum(ii - 1, 0) - #db = b[ii] - b[i0] + #db = b[ii] - b[i0] db = npy.take(b, ii) - npy.take(b, i0) db = npy.where(i0==ii, 1.0, db) #dy = y[ii] - y[i0] Modified: branches/transforms/lib/matplotlib/path.py =================================================================== --- branches/transforms/lib/matplotlib/path.py 2007年11月28日 18:26:40 UTC (rev 4488) +++ branches/transforms/lib/matplotlib/path.py 2007年11月28日 18:27:43 UTC (rev 4489) @@ -38,10 +38,10 @@ MOVETO : 1 vertex Pick up the pen and move to the given vertex. - + LINETO : 1 vertex Draw a line from the current position to the given vertex. - + CURVE3 : 1 control point, 1 endpoint Draw a quadratic Bezier curve from the current position, with the given control point, to the given end point. @@ -60,7 +60,7 @@ store a codes array at all, but have a default one provided for them by iter_segments. """ - + # Path codes STOP = 0 # 1 vertex MOVETO = 1 # 1 vertex @@ -70,7 +70,7 @@ CLOSEPOLY = 5 # 1 vertex NUM_VERTICES = [1, 1, 1, 2, 3, 1] - + code_type = npy.uint8 def __init__(self, vertices, codes=None): @@ -124,7 +124,7 @@ assert vertices.ndim == 2 assert vertices.shape[1] == 2 - + self.codes = codes self.vertices = vertices @@ -142,22 +142,22 @@ vertices = npy.vstack([x.vertices for x in args]) vertices.reshape((total_length, 2)) - + codes = Path.LINETO * npy.ones(total_length) i = 0 for length in lengths: codes[i] = Path.MOVETO i += length - + return Path(vertices, codes) make_compound_path = staticmethod(make_compound_path) - + def __repr__(self): return "Path(%s, %s)" % (self.vertices, self.codes) def __len__(self): return len(self.vertices) - + def iter_segments(self): """ Iterates over all of the curve segments in the path. @@ -171,10 +171,10 @@ LINETO = self.LINETO CLOSEPOLY = self.CLOSEPOLY STOP = self.STOP - + if not len(vertices): return - + if codes is None: yield vertices[0], MOVETO for v in vertices[1:]: @@ -192,7 +192,7 @@ num_vertices = NUM_VERTICES[code] yield vertices[i:i+num_vertices].flatten(), code i += num_vertices - + def transformed(self, transform): """ Return a transformed copy of the path. @@ -223,7 +223,7 @@ from transforms import IdentityTransform transform = IdentityTransform() return path_in_path(self, IdentityTransform(), path, transform) - + def get_extents(self, transform=None): """ Returns the extents (xmin, ymin, xmax, ymax) of the path. @@ -235,7 +235,7 @@ from transforms import Affine2D, Bbox if transform is None: transform = Affine2D() - return Bbox.from_extents(*get_path_extents(self, transform)) + return Bbox(get_path_extents(self, transform)) def intersects_path(self, other): """ @@ -252,7 +252,7 @@ BboxTransformTo(bbox)) result = self.intersects_path(rectangle) return result - + def interpolated(self, steps): """ Returns a new path resampled to length N x steps. @@ -266,7 +266,7 @@ else: new_codes = None return Path(vertices, new_codes) - + _unit_rectangle = None #@classmethod def unit_rectangle(cls): @@ -329,7 +329,7 @@ """ return cls.unit_regular_star(numVertices, 0.0) unit_regular_asterisk = classmethod(unit_regular_asterisk) - + _unit_circle = None #@classmethod def unit_circle(cls): @@ -341,19 +341,19 @@ offset = KAPPA vertices = npy.array( [[-1.0, 0.0], - + [-1.0, offset], [-offset, 1.0], [0.0, 1.0], - + [offset, 1.0], [1.0, offset], [1.0, 0.0], - + [1.0, -offset], [offset, -1.0], [0.0, -1.0], - + [-offset, -1.0], [-1.0, -offset], [-1.0, 0.0], @@ -383,10 +383,10 @@ # degrees to radians theta1 *= math.pi / 180.0 theta2 *= math.pi / 180.0 - + twopi = math.pi * 2.0 halfpi = math.pi * 0.5 - + eta1 = math.atan2(math.sin(theta1), math.cos(theta1)) eta2 = math.atan2(math.sin(theta2), math.cos(theta2)) eta2 -= twopi * math.floor((eta2 - eta1) / twopi) @@ -423,13 +423,13 @@ t = math.tan(0.5 * deta) alpha = math.sin(deta) * (math.sqrt(4.0 + 3.0 * t * t) - 1) / 3.0 - + for i in xrange(n): xA = xB yA = yB xA_dot = xB_dot yA_dot = yB_dot - + etaB += deta cos_etaB = math.cos(etaB) sin_etaB = math.sin(etaB) @@ -446,7 +446,7 @@ if is_wedge: codes[-2:] = [Path.LINETO, Path.CLOSEPOLY] - + return Path(vertices, codes) arc = classmethod(arc) Modified: branches/transforms/lib/matplotlib/text.py =================================================================== --- branches/transforms/lib/matplotlib/text.py 2007年11月28日 18:26:40 UTC (rev 4488) +++ branches/transforms/lib/matplotlib/text.py 2007年11月28日 18:27:43 UTC (rev 4489) @@ -258,7 +258,7 @@ xys -= (offsetx, offsety) xs, ys = xys[:, 0], xys[:, 1] - + ret = bbox, zip(lines, whs, xs, ys) self.cached[key] = ret return ret @@ -274,7 +274,6 @@ """ self._bbox = rectprops - # MGDTODO: The clipping here could be generalized def draw(self, renderer): #return if renderer is not None: @@ -297,7 +296,7 @@ posx, posy = self.get_position() posx, posy = trans.transform_point((posx, posy)) canvasw, canvash = renderer.get_canvas_width_height() - + if rcParams['text.usetex']: for line, wh, x, y in info: x = x + posx @@ -314,11 +313,11 @@ y = y + posy if renderer.flipy(): y = canvash-y - + renderer.draw_text(gc, x, y, line, self._fontproperties, angle, ismath=self.is_math_text(line)) - + def get_color(self): "Return the color of the text" return self._color @@ -1035,7 +1034,6 @@ """ Text.set_clip_box(self, clipbox) - # MGDTODO: Abstract this out -- this seems weird to have this big "switch" here def _get_xy(self, x, y, s): if s=='data': trans = self.axes.transData Modified: branches/transforms/lib/matplotlib/transforms.py =================================================================== --- branches/transforms/lib/matplotlib/transforms.py 2007年11月28日 18:26:40 UTC (rev 4488) +++ branches/transforms/lib/matplotlib/transforms.py 2007年11月28日 18:27:43 UTC (rev 4489) @@ -29,17 +29,18 @@ from numpy.linalg import inv from weakref import WeakKeyDictionary +import warnings import cbook from path import Path -from _path import count_bboxes_overlapping_bbox +from _path import count_bboxes_overlapping_bbox, update_path_extents DEBUG = False if DEBUG: import warnings MaskedArray = ma.MaskedArray - + class TransformNode(object): """ TransformNode is the base class for anything that participates in @@ -56,7 +57,7 @@ INVALID_NON_AFFINE = 1 INVALID_AFFINE = 2 INVALID = INVALID_NON_AFFINE | INVALID_AFFINE - + # Some metadata about the transform, used to determine whether an # invalidation is affine-only is_affine = False @@ -65,7 +66,7 @@ # If pass_through is True, all ancestors will always be # invalidated, even if 'self' is already invalid. pass_through = False - + def __init__(self): """ Creates a new TransformNode. @@ -79,16 +80,12 @@ # computed for the first time. self._invalid = 1 - # A list of the children is kept around for debugging purposes - # only. - self._children = [] - def __copy__(self, *args): raise NotImplementedError( "TransformNode instances can not be copied. " + "Consider using frozen() instead.") __deepcopy__ = __copy__ - + def invalidate(self): """ Invalidate this transform node and all of its parents. Should @@ -104,7 +101,7 @@ # are as well, so we don't need to do anything. if self._invalid == value or not len(self._parents): return - + # Invalidate all ancestors of self using pseudo-recursion. parent = None stack = [self] @@ -122,8 +119,13 @@ """ for child in children: child._parents[self] = None - self._children = children + if DEBUG: + _set_children = set_children + def set_children(self, *children): + self._set_children(*children) + self._children = children + def frozen(self): """ Returns a frozen copy of this transform node. The frozen copy @@ -169,17 +171,18 @@ fobj.write('%s [%s];\n' % (hash(root), props)) - for child in root._children: - name = '?' - for key, val in root.__dict__.items(): - if val is child: - name = key - break - fobj.write('%s -> %s [label="%s", fontsize=10];\n' % ( - hash(root), - hash(child), - name)) - recurse(child) + if hasattr(root, '_children'): + for child in root._children: + name = '?' + for key, val in root.__dict__.items(): + if val is child: + name = key + break + fobj.write('%s -> %s [label="%s", fontsize=10];\n' % ( + hash(root), + hash(child), + name)) + recurse(child) fobj.write("digraph G {\n") recurse(self) @@ -187,8 +190,8 @@ else: def write_graphviz(self, fobj, highlight=[]): return - - + + class BboxBase(TransformNode): """ This is the base class of all bounding boxes, and provides @@ -209,21 +212,21 @@ points[1,1] - points[0,1] == 0): warnings.warn("Singular Bbox.") _check = staticmethod(_check) - + def frozen(self): return Bbox(self.get_points().copy()) frozen.__doc__ = TransformNode.__doc__ - + def __array__(self, *args, **kwargs): return self.get_points() def is_unit(self): return list(self.get_points().flatten()) == [0., 0., 1., 1.] - + def _get_x0(self): return self.get_points()[0, 0] x0 = property(_get_x0) - + def _get_y0(self): return self.get_points()[0, 1] y0 = property(_get_y0) @@ -243,7 +246,7 @@ def _get_p1(self): return self.get_points()[1] p1 = property(_get_p1) - + def _get_xmin(self): return min(self.get_points()[:, 0]) xmin = property(_get_xmin) @@ -259,17 +262,17 @@ def _get_ymax(self): return max(self.get_points()[:, 1]) ymax = property(_get_ymax) - + def _get_min(self): return [min(self.get_points()[:, 0]), min(self.get_points()[:, 1])] min = property(_get_min) - + def _get_max(self): return [max(self.get_points()[:, 0]), max(self.get_points()[:, 1])] max = property(_get_max) - + def _get_intervalx(self): return self.get_points()[:, 0] intervalx = property(_get_intervalx) @@ -277,7 +280,7 @@ def _get_intervaly(self): return self.get_points()[:, 1] intervaly = property(_get_intervaly) - + def _get_width(self): points = self.get_points() return points[1, 0] - points[0, 0] @@ -292,7 +295,7 @@ points = self.get_points() return points[1] - points[0] size = property(_get_size) - + def _get_bounds(self): x0, y0, x1, y1 = self.get_points().flatten() return (x0, y0, x1 - x0, y1 - y0) @@ -301,10 +304,10 @@ def _get_extents(self): return self.get_points().flatten().copy() extents = property(_get_extents) - + def get_points(self): return NotImplementedError() - + def containsx(self, x): x0, x1 = self.intervalx return ((x0 < x1 @@ -316,7 +319,7 @@ return ((y0 < y1 and (y >= y0 and y <= y1)) or (y >= y1 and y <= y0)) - + def contains(self, x, y): return self.containsx(x) and self.containsy(y) @@ -337,7 +340,7 @@ (by2 < ay1) or (bx1 > ax2) or (by1 > ay2)) - + def fully_containsx(self, x): x0, x1 = self.intervalx return ((x0 < x1 @@ -349,7 +352,7 @@ return ((y0 < y1 and (x > y0 and x < y1)) or (x > y1 and x < y0)) - + def fully_contains(self, x, y): return self.fully_containsx(x) \ and self.fully_containsy(y) @@ -529,7 +532,7 @@ """ points = self._points return Bbox(points + [[-p, -p], [p, p]]) - + def translated(self, tx, ty): """ Return a copy of the Bbox, translated by tx and ty. @@ -543,7 +546,7 @@ """ l, b, r, t = self.get_points().flatten() return npy.array([[l, b], [l, t], [r, b], [r, t]]) - + def rotated(self, radians): """ Return a new bounding box that bounds a rotated version of this @@ -555,7 +558,7 @@ bbox = Bbox.unit() bbox.update_from_data(corners_rotated, ignore=True) return bbox - + #@staticmethod def union(bboxes): """ @@ -582,8 +585,8 @@ return Bbox.from_extents(x0, y0, x1, y1) union = staticmethod(union) - - + + class Bbox(BboxBase): def __init__(self, points): """ @@ -598,13 +601,13 @@ self._points = npy.asarray(points, npy.float_) self._minpos = npy.array([0.0000001, 0.0000001]) self._ignore = True - + if DEBUG: ___init__ = __init__ def __init__(self, points): self._check(points) self.___init__(points) - + def invalidate(self): self._check(self._points) TransformNode.invalidate(self) @@ -638,7 +641,7 @@ points = npy.array(args, dtype=npy.float_).reshape(2, 2) return Bbox(points) from_extents = staticmethod(from_extents) - + def __repr__(self): return 'Bbox(%s)' % repr(self._points) __str__ = __repr__ @@ -654,7 +657,7 @@ include the existing bounds of the Bbox. """ self._ignore = value - + def update_from_data(self, x, y, ignore=None): """ Update the bounds of the Bbox based on the passed in data. @@ -666,45 +669,10 @@ when False, include the existing bounds of the Bbox. when None, use the last value passed to Bbox.ignore(). """ - if ignore is None: - ignore = self._ignore + warnings.warn("update_from_data requires a memory copy -- please replace with update_from_data_xy") + xy = npy.hstack((x.reshape((len(x), 1)), y.reshape((len(y), 1)))) + return self.update_from_data_xy(xy, ignore) - if len(x) == 0 or len(y) == 0: - return - - if ma.isMaskedArray(x) or ma.isMaskedArray(y): - xpos = ma.where(x > 0.0, x, npy.inf) - ypos = ma.where(y > 0.0, y, npy.inf) - else: - xpos = npy.where(x > 0.0, x, npy.inf) - ypos = npy.where(y > 0.0, y, npy.inf) - if len(xpos) and len(ypos): - minpos = npy.array( - [xpos.min(), - ypos.min()], - npy.float_) - else: - minpos = npy.array([-npy.inf, -npy.inf], npy.float_) - - if ignore: - points = npy.array( - [[x.min(), y.min()], [x.max(), y.max()]], - npy.float_) - self._minpos = minpos - else: - x0, y0, x1, y1 = self._get_extents() - points = npy.array( - [[min(x.min(), x0, x1), - min(y.min(), y0, y1)], - [max(x.max(), x0, x1), - max(y.max(), y0, y1)]], - npy.float_) - self._minpos = npy.minimum(minpos, self._minpos) - - if npy.any(self._points != points): - self._points = points - self.invalidate() - def update_from_data_xy(self, xy, ignore=None): """ Update the bounds of the Bbox based on the passed in data. @@ -715,8 +683,20 @@ when False, include the existing bounds of the Bbox. when None, use the last value passed to Bbox.ignore(). """ - return self.update_from_data(xy[:, 0], xy[:, 1], ignore) - + if ignore is None: + ignore = self._ignore + + if len(xy) == 0: + return + + points, minpos, changed = update_path_extents( + Path(xy), None, self._points, self._minpos, ignore) + + if changed: + self._points = points + self._minpos = minpos + self.invalidate() + def _set_x0(self, val): self._points[0, 0] = val self.invalidate() @@ -746,7 +726,7 @@ self._points[1] = val self.invalidate() p1 = property(BboxBase._get_p1, _set_p1) - + def _set_intervalx(self, interval): self._points[:, 0] = interval self.invalidate() @@ -776,7 +756,7 @@ def _get_minposy(self): return self._minpos[1] minposy = property(_get_minposy) - + def get_points(self): """ Set the points of the bounding box directly as a numpy array @@ -803,7 +783,7 @@ self._points = other.get_points() self.invalidate() - + class TransformedBbox(BboxBase): """ A Bbox that is automatically transformed by a given Transform. When @@ -829,7 +809,7 @@ def __repr__(self): return "TransformedBbox(%s, %s)" % (self._bbox, self._transform) __str__ = __repr__ - + def get_points(self): if self._invalid: points = self._transform.transform(self._bbox.get_points()) @@ -846,7 +826,7 @@ points = self._get_points() self._check(points) return points - + class Transform(TransformNode): """ The base class of all TransformNodes that actually perform a @@ -854,7 +834,7 @@ All non-affine transformations should be subclass this class. New affine transformations should subclass Affine2D. - + Subclasses of this class should override the following members (at minimum): @@ -907,28 +887,28 @@ Used by C/C++ -based backends to get at the array matrix data. """ return self.frozen().__array__() - + def transform(self, values): """ Performs the transformation on the given array of values. - + Accepts a numpy array of shape (N x self.input_dims) and returns a numpy array of shape (N x self.output_dims). """ raise NotImplementedError() - + def transform_affine(self, values): """ Performs only the affine part of this transformation on the given array of values. - + transform(values) is equivalent to transform_affine(transform_non_affine(values)). In non-affine transformations, this is generally a no-op. In affine transformations, this is equivalent to transform(values). - + Accepts a numpy array of shape (N x self.input_dims) and returns a numpy array of shape (N x self.output_dims). """ @@ -944,7 +924,7 @@ In non-affine transformations, this is generally equivalent to transform(values). In affine transformations, this is a no-op. - + Accepts a numpy array of shape (N x self.input_dims) and returns a numpy array of shape (N x self.output_dims). """ @@ -955,7 +935,7 @@ Get the affine part of this transform. """ return IdentityTransform() - + def transform_point(self, point): """ A convenience function that returns the transformed copy of a @@ -973,7 +953,7 @@ Returns a transformed copy of path. path: a Path instance. - + In some cases, this transform may insert curves into the path that began as line segments. """ @@ -1002,7 +982,7 @@ transform_path_affine(transform_path_non_affine(values)). """ return Path(self.transform_non_affine(path.vertices), path.codes) - + def inverted(self): """ Return the corresponding inverse transformation. @@ -1036,7 +1016,7 @@ with set(). """ assert isinstance(child, Transform) - + Transform.__init__(self) self.input_dims = child.input_dims self.output_dims = child.output_dims @@ -1063,7 +1043,7 @@ self.transform_path_non_affine = child.transform_path_non_affine self.get_affine = child.get_affine self.inverted = child.inverted - + def set(self, child): """ Replace the current child of this transform with another one. @@ -1075,11 +1055,11 @@ assert child.output_dims == self.output_dims self._set(child) - + self._invalid = 0 self.invalidate() self._invalid = 0 - + def _get_is_affine(self): return self._child.is_affine is_affine = property(_get_is_affine) @@ -1091,22 +1071,22 @@ def _get_has_inverse(self): return self._child.has_inverse has_inverse = property(_get_has_inverse) - - + + class AffineBase(Transform): """ The base class of all affine transformations of any number of dimensions. """ is_affine = True - + def __init__(self): Transform.__init__(self) self._inverted = None def __array__(self, *args, **kwargs): return self.get_matrix() - + #@staticmethod def _concat(a, b): """ @@ -1133,28 +1113,28 @@ def transform_path_non_affine(self, path): return path transform_path_non_affine.__doc__ = Transform.transform_path_non_affine.__doc__ - + def get_affine(self): return self get_affine.__doc__ = Transform.get_affine.__doc__ - + class Affine2DBase(AffineBase): """ The base class of all 2D affine transformations. 2D affine transformations are performed using a 3x3 numpy array: - + a c e b d f 0 0 1 - + Provides the read-only interface. Subclasses of this class will generally only need to override a constructor and 'get_matrix' that generates a custom 3x3 matrix. """ - + input_dims = 2 output_dims = 2 @@ -1166,22 +1146,22 @@ def frozen(self): return Affine2D(self.get_matrix().copy()) frozen.__doc__ = AffineBase.frozen.__doc__ - + def _get_is_separable(self): mtx = self.get_matrix() return mtx[0, 1] == 0.0 and mtx[1, 0] == 0.0 is_separable = property(_get_is_separable) - + def __array__(self, *args, **kwargs): return self.get_matrix() - + def to_values(self): """ Return the values of the matrix as a sequence (a,b,c,d,e,f) """ mtx = self.get_matrix() return tuple(mtx[:2].swapaxes(0, 1).flatten()) - + #@staticmethod def matrix_from_values(a, b, c, d, e, f): """ @@ -1204,7 +1184,7 @@ def transform_point(self, point): mtx = self.get_matrix() return affine_transform(point, mtx) - + if DEBUG: _transform = transform def transform(self, points): @@ -1219,10 +1199,10 @@ % type(values)) return self._transform(points) transform.__doc__ = AffineBase.transform.__doc__ - + transform_affine = transform transform_affine.__doc__ = AffineBase.transform_affine.__doc__ - + def inverted(self): if self._inverted is None or self._invalid: mtx = self.get_matrix() @@ -1230,13 +1210,13 @@ self._invalid = 0 return self._inverted inverted.__doc__ = AffineBase.inverted.__doc__ - - + + class Affine2D(Affine2DBase): def __init__(self, matrix = None): """ Initialize an Affine transform from a 3x3 numpy float array: - + a c e b d f 0 0 1 @@ -1261,7 +1241,7 @@ (self.get_matrix() == other.get_matrix()).all()): return 0 return -1 - + #@staticmethod def from_values(a, b, c, d, e, f): """ @@ -1306,7 +1286,7 @@ assert isinstance(other, Affine2DBase) self._mtx = other.get_matrix() self.invalidate() - + #@staticmethod def identity(): """ @@ -1325,7 +1305,7 @@ self._mtx = npy.identity(3) self.invalidate() return self - + def rotate(self, theta): """ Add a rotation (in radians) to this transform in place. @@ -1368,7 +1348,7 @@ calls to rotate(), rotate_deg(), translate() and scale(). """ return self.translate(-x, -y).rotate_deg(degrees).translate(x, y) - + def translate(self, tx, ty): """ Adds a translation in place. @@ -1407,7 +1387,7 @@ return mtx[0, 1] == 0.0 and mtx[1, 0] == 0.0 is_separable = property(_get_is_separable) - + class IdentityTransform(Affine2DBase): """ A special class that does on thing, the identity transform, in a @@ -1418,19 +1398,19 @@ def frozen(self): return self frozen.__doc__ = Affine2DBase.frozen.__doc__ - + def __repr__(self): return "IdentityTransform()" __str__ = __repr__ - + def get_matrix(self): return self._mtx get_matrix.__doc__ = Affine2DBase.get_matrix.__doc__ - + def transform(self, points): return points transform.__doc__ = Affine2DBase.transform.__doc__ - + transform_affine = transform transform_affine.__doc__ = Affine2DBase.transform_affine.__doc__ @@ -1443,18 +1423,18 @@ transform_path_affine = transform_path transform_path_affine.__doc__ = Affine2DBase.transform_path_affine.__doc__ - + transform_path_non_affine = transform_path transform_path_non_affine.__doc__ = Affine2DBase.transform_path_non_affine.__doc__ - + def get_affine(self): return self get_affine.__doc__ = Affine2DBase.get_affine.__doc__ - + inverted = get_affine inverted.__doc__ = Affine2DBase.inverted.__doc__ - - + + class BlendedGenericTransform(Transform): """ A "blended" transform uses one transform for the x-direction, and @@ -1467,7 +1447,7 @@ output_dims = 2 is_separable = True pass_through = True - + def __init__(self, x_transform, y_transform): """ Create a new "blended" transform using x_transform to @@ -1479,13 +1459,13 @@ create. """ # Here we ask: "Does it blend?" - + Transform.__init__(self) self._x = x_transform self._y = y_transform self.set_children(x_transform, y_transform) self._affine = None - + def _get_is_affine(self): return self._x.is_affine and self._y.is_affine is_affine = property(_get_is_affine) @@ -1493,7 +1473,7 @@ def frozen(self): return blended_transform_factory(self._x.frozen(), self._y.frozen()) frozen.__doc__ = Transform.frozen.__doc__ - + def __repr__(self): return "BlendedGenericTransform(%s,%s)" % (self._x, self._y) __str__ = __repr__ @@ -1510,7 +1490,7 @@ else: x_points = x.transform(points[:, 0]) x_points = x_points.reshape((len(x_points), 1)) - + if y.input_dims == 2: y_points = y.transform(points)[:, 1:] else: @@ -1555,8 +1535,8 @@ self._invalid = 0 return self._affine get_affine.__doc__ = Transform.get_affine.__doc__ - - + + class BlendedAffine2D(Affine2DBase): """ A "blended" transform uses one transform for the x-direction, and @@ -1567,14 +1547,14 @@ """ is_separable = True - + def __init__(self, x_transform, y_transform): """ Create a new "blended" transform using x_transform to transform the x-axis and y_transform to transform the y_axis. Both x_transform and y_transform must be 2D affine transforms. - + You will generally not call this constructor directly but use the blended_transform_factory function instead, which can determine automatically which kind of blended transform to @@ -1589,14 +1569,14 @@ self._x = x_transform self._y = y_transform self.set_children(x_transform, y_transform) - + Affine2DBase.__init__(self) self._mtx = None def __repr__(self): return "BlendedAffine2D(%s,%s)" % (self._x, self._y) __str__ = __repr__ - + def get_matrix(self): if self._invalid: if self._x == self._y: @@ -1612,8 +1592,8 @@ self._invalid = 0 return self._mtx get_matrix.__doc__ = Affine2DBase.get_matrix.__doc__ - - + + def blended_transform_factory(x_transform, y_transform): """ Create a new "blended" transform using x_transform to @@ -1635,7 +1615,7 @@ This "generic" version can handle any two arbitrary transformations. """ pass_through = True - + def __init__(self, a, b): """ Create a new composite transform that is the result of @@ -1649,7 +1629,7 @@ assert a.output_dims == b.input_dims self.input_dims = a.input_dims self.output_dims = b.output_dims - + Transform.__init__(self) self._a = a self._b = b @@ -1662,15 +1642,15 @@ return frozen.frozen() return frozen frozen.__doc__ = Transform.frozen.__doc__ - + def _get_is_affine(self): return self._a.is_affine and self._b.is_affine is_affine = property(_get_is_affine) - + def _get_is_separable(self): return self._a.is_separable and self._b.is_separable is_separable = property(_get_is_separable) - + def __repr__(self): return "CompositeGenericTransform(%s, %s)" % (self._a, self._b) __str__ = __repr__ @@ -1679,7 +1659,7 @@ return self._b.transform( self._a.transform(points)) transform.__doc__ = Transform.transform.__doc__ - + def transform_affine(self, points): return self.get_affine().transform(points) transform_affine.__doc__ = Transform.transform_affine.__doc__ @@ -1695,7 +1675,7 @@ return self._b.transform_path( self._a.transform_path(path)) transform_path.__doc__ = Transform.transform_path.__doc__ - + def transform_path_affine(self, path): return self._b.transform_path_affine( self._a.transform_path(path)) @@ -1707,7 +1687,7 @@ return self._b.transform_path_non_affine( self._a.transform_path(path)) transform_path_non_affine.__doc__ = Transform.transform_path_non_affine.__doc__ - + def get_affine(self): if self._a.is_affine and self._b.is_affine: return Affine2D(npy.dot(self._b.get_affine().get_matrix(), @@ -1715,12 +1695,12 @@ else: return self._b.get_affine() get_affine.__doc__ = Transform.get_affine.__doc__ - + def inverted(self): return CompositeGenericTransform(self._b.inverted(), self._a.inverted()) inverted.__doc__ = Transform.inverted.__doc__ - + class CompositeAffine2D(Affine2DBase): """ A composite transform formed by applying transform a then transform b. @@ -1734,7 +1714,7 @@ applying transform a then transform b. Both a and b must be instances of Affine2DBase. - + You will generally not call this constructor directly but use the composite_transform_factory function instead, which can automatically choose the best kind of composite transform @@ -1765,8 +1745,8 @@ self._invalid = 0 return self._mtx get_matrix.__doc__ = Affine2DBase.get_matrix.__doc__ - - + + def composite_transform_factory(a, b): """ Create a new composite transform that is the result of applying @@ -1787,8 +1767,8 @@ elif isinstance(a, AffineBase) and isinstance(b, AffineBase): return CompositeAffine2D(a, b) return CompositeGenericTransform(a, b) - - + + class BboxTransform(Affine2DBase): """ BboxTransform linearly transforms points from one Bbox to another Bbox. @@ -1802,7 +1782,7 @@ """ assert boxin.is_bbox assert boxout.is_bbox - + Affine2DBase.__init__(self) self._boxin = boxin self._boxout = boxout @@ -1813,7 +1793,7 @@ def __repr__(self): return "BboxTransform(%s, %s)" % (self._boxin, self._boxout) __str__ = __repr__ - + def get_matrix(self): if self._invalid: inl, inb, inw, inh = self._boxin.bounds @@ -1845,7 +1825,7 @@ from the unit Bbox to boxout. """ assert boxout.is_bbox - + Affine2DBase.__init__(self) self._boxout = boxout self.set_children(boxout) @@ -1855,7 +1835,7 @@ def __repr__(self): return "BboxTransformTo(%s)" % (self._boxout) __str__ = __repr__ - + def get_matrix(self): if self._invalid: outl, outb, outw, outh = self._boxout.bounds @@ -1884,7 +1864,7 @@ from boxin to the unit Bbox. """ assert boxin.is_bbox - + Affine2DBase.__init__(self) self._boxin = boxin self.set_children(boxin) @@ -1894,7 +1874,7 @@ def __repr__(self): return "BboxTransformFrom(%s)" % (self._boxin) __str__ = __repr__ - + def get_matrix(self): if self._invalid: inl, inb, inw, inh = self._boxin.bounds @@ -1910,8 +1890,8 @@ self._invalid = 0 return self._mtx get_matrix.__doc__ = Affine2DBase.get_matrix.__doc__ - + class TransformedPath(TransformNode): """ A TransformedPath caches a non-affine transformed copy of the @@ -1924,7 +1904,7 @@ """ assert isinstance(transform, Transform) TransformNode.__init__(self) - + self._path = path self._transform = transform self.set_children(transform) @@ -1957,7 +1937,7 @@ def get_affine(self): return self._transform.get_affine() - + def nonsingular(vmin, vmax, expander=0.001, tiny=1e-15, increasing=True): ''' Ensure the endpoints of a range are not too close together. @@ -1996,7 +1976,7 @@ return ( ((a < b) and (a < val and b > val)) or (b < val and a > val)) - + if __name__ == '__main__': import copy from random import random @@ -2019,10 +1999,10 @@ assert bbox.bounds == (10, 15, 10, 10) assert tuple(npy.asarray(bbox).flatten()) == (10, 15, 20, 25) - + bbox.intervalx = (11, 21) bbox.intervaly = (16, 26) - + assert bbox.bounds == (11, 16, 10, 10) bbox.x0 = 12 @@ -2040,7 +2020,7 @@ bbox_copy.p1 = (14, 15) assert bbox.bounds == (10, 11, 12, 13) assert bbox_copy.bounds == (10, 11, 4, 4) - + bbox1 = Bbox([[10., 15.], [20., 25.]]) bbox2 = Bbox([[30., 35.], [40., 45.]]) trans = BboxTransform(bbox1, bbox2) @@ -2055,7 +2035,7 @@ assert rotation.to_values() == (0.86602540378443871, 0.49999999999999994, -0.49999999999999994, 0.86602540378443871, 0.0, 0.0) - + points = npy.array([[1, 2], [3, 4], [5, 6], [7, 8]], npy.float_) translated_points = translation.transform(points) assert (translated_points == [[11., 22.], [13., 24.], [15., 26.], [17., 28.]]).all() @@ -2071,7 +2051,7 @@ assert (tpoints1.round() == tpoints2.round()).all() print points - + # Here are some timing tests points = npy.asarray([(random(), random()) for i in xrange(10000)]) t = timeit.Timer("trans_sum.transform(points)", "from __main__ import trans_sum, points") Modified: branches/transforms/src/_path.cpp =================================================================== --- branches/transforms/src/_path.cpp 2007年11月28日 18:26:40 UTC (rev 4488) +++ branches/transforms/src/_path.cpp 2007年11月28日 18:27:43 UTC (rev 4489) @@ -31,6 +31,8 @@ "point_on_path(x, y, r, path, trans)"); add_varargs_method("get_path_extents", &_path_module::get_path_extents, "get_path_extents(path, trans)"); + add_varargs_method("update_path_extents", &_path_module::update_path_extents, + "update_path_extents(path, trans, bbox, minpos)"); add_varargs_method("get_path_collection_extents", &_path_module::get_path_collection_extents, "get_path_collection_extents(trans, paths, transforms, offsets, offsetTrans)"); add_varargs_method("point_in_path_collection", &_path_module::point_in_path_collection, @@ -45,7 +47,7 @@ "count_bboxes_overlapping_bbox(bbox, bboxes)"); add_varargs_method("path_intersects_path", &_path_module::path_intersects_path, "path_intersects_path(p1, p2)"); - + initialize("Helper functions for paths"); } @@ -56,6 +58,7 @@ Py::Object point_in_path(const Py::Tuple& args); Py::Object point_on_path(const Py::Tuple& args); Py::Object get_path_extents(const Py::Tuple& args); + Py::Object update_path_extents(const Py::Tuple& args); Py::Object get_path_collection_extents(const Py::Tuple& args); Py::Object point_in_path_collection(const Py::Tuple& args); Py::Object path_in_path(const Py::Tuple& args); @@ -71,7 +74,7 @@ // just polygons. The original comments have been kept intact. // -- Michael Droettboom 2007年10月02日 // -//======= Crossings Multiply algorithm of InsideTest ======================== +//======= Crossings Multiply algorithm of InsideTest ======================== // // By Eric Haines, 3D/Eye Inc, er...@ey... // @@ -164,10 +167,10 @@ yflag0 = yflag1; vtx0 = vtx1; vty0 = vty1; - + vtx1 = x; vty1 = y; - } while (code != agg::path_cmd_stop && + } while (code != agg::path_cmd_stop && (code & agg::path_cmd_end_poly) != agg::path_cmd_end_poly); yflag1 = (vty1 >= ty); @@ -188,7 +191,7 @@ inline bool point_in_path(double x, double y, PathIterator& path, const agg::trans_affine& trans) { typedef agg::conv_transform<PathIterator> transformed_path_t; typedef agg::conv_curve<transformed_path_t> curve_t; - + if (path.total_vertices() < 3) return false; @@ -211,7 +214,7 @@ Py::Object _path_module::point_in_path(const Py::Tuple& args) { args.verify_length(4); - + double x = Py::Float(args[0]); double y = Py::Float(args[1]); PathIterator path(args[2]); @@ -224,7 +227,7 @@ Py::Object _path_module::point_on_path(const Py::Tuple& args) { args.verify_length(5); - + double x = Py::Float(args[0]); double y = Py::Float(args[1]); double r = Py::Float(args[2]); @@ -236,8 +239,9 @@ return Py::Int(0); } -void get_path_extents(PathIterator& path, const agg::trans_affine& trans, - double* x0, double* y0, double* x1, double* y1) { +void get_path_extents(PathIterator& path, const agg::trans_affine& trans, + double* x0, double* y0, double* x1, double* y1, + double* xm, double* ym) { typedef agg::conv_transform<PathIterator> transformed_path_t; typedef agg::conv_curve<transformed_path_t> curve_t; double x, y; @@ -251,8 +255,16 @@ while ((code = curved_path.vertex(&x, &y)) != agg::path_cmd_stop) { if ((code & agg::path_cmd_end_poly) == agg::path_cmd_end_poly) continue; - if (x < *x0) *x0 = x; - if (y < *y0) *y0 = y; + if (x < *x0) { + *x0 = x; + if (x > 0.0) + *xm = x; + } + if (y < *y0) { + *y0 = y; + if (y > 0.0) + *ym = y; + } if (x > *x1) *x1 = x; if (y > *y1) *y1 = y; } @@ -260,22 +272,121 @@ Py::Object _path_module::get_path_extents(const Py::Tuple& args) { args.verify_length(2); - + PathIterator path(args[0]); - agg::trans_affine trans = py_to_agg_transformation_matrix(args[1]); + agg::trans_affine trans = py_to_agg_transformation_matrix(args[1], false); - double x0 = std::numeric_limits<double>::infinity(); - double y0 = std::numeric_limits<double>::infinity(); - double x1 = -std::numeric_limits<double>::infinity(); - double y1 = -std::numeric_limits<double>::infinity(); + npy_intp extent_dims[] = { 2, 2, 0 }; + double* extents_data = new double[4]; + double xm, ym; + PyArrayObject* extents = NULL; + try { + extents_data[0] = std::numeric_limits<double>::infinity(); + extents_data[1] = std::numeric_limits<double>::infinity(); + extents_data[2] = -std::numeric_limits<double>::infinity(); + extents_data[3] = -std::numeric_limits<double>::infinity(); - ::get_path_extents(path, trans, &x0, &y0, &x1, &y1); + ::get_path_extents(path, trans, + &extents_data[0], &extents_data[1], &extents_data[2], &extents_data[3], + &xm, &ym); - Py::Tuple result(4); - result[0] = Py::Float(x0); - result[1] = Py::Float(y0); - result[2] = Py::Float(x1); - result[3] = Py::Float(y1); + extents = (PyArrayObject*)PyArray_SimpleNewFromData + (2, extent_dims, PyArray_DOUBLE, extents_data); + } catch (...) { + if (extents) + Py_XDECREF(extents); + else + delete[] extents_data; + throw; + } + + return Py::Object((PyObject*)extents); +} + +Py::Object _path_module::update_path_extents(const Py::Tuple& args) { + args.verify_length(5); + + double x0, y0, x1, y1; + PathIterator path(args[0]); + agg::trans_affine trans = py_to_agg_transformation_matrix(args[1], false); + if (!py_convert_bbox(args[2].ptr(), x0, y0, x1, y1)) { + throw Py::ValueError("Must pass Bbox object as arg 3 of update_path_extents"); + } + Py::Object minpos_obj = args[3]; + bool ignore = bool(Py::Int(args[4])); + + double xm, ym; + PyArrayObject* input_minpos = NULL; + try { + input_minpos = (PyArrayObject*)PyArray_FromObject(minpos_obj.ptr(), PyArray_DOUBLE, 1, 1); + if (!input_minpos || PyArray_DIM(input_minpos, 0) != 2) { + throw Py::TypeError("Argument 4 to update_path_extents must be a length-2 numpy array."); + } + xm = *(double*)PyArray_GETPTR1(input_minpos, 0); + ym = *(double*)PyArray_GETPTR1(input_minpos, 1); + } catch (...) { + Py_XDECREF(input_minpos); + throw; + } + Py_XDECREF(input_minpos); + + npy_intp extent_dims[] = { 2, 2, 0 }; + double* extents_data = new double[4]; + npy_intp minpos_dims[] = { 2, 0 }; + double* minpos_data = new double[2]; + PyArrayObject* extents = NULL; + PyArrayObject* minpos = NULL; + bool changed = false; + + try { + if (ignore) { + extents_data[0] = std::numeric_limits<double>::infinity(); + extents_data[1] = std::numeric_limits<double>::infinity(); + extents_data[2] = -std::numeric_limits<double>::infinity(); + extents_data[3] = -std::numeric_limits<double>::infinity(); + minpos_data[0] = std::numeric_limits<double>::infinity(); + minpos_data[1] = std::numeric_limits<double>::infinity(); + } else { + extents_data[0] = std::min(x0, x1); + extents_data[1] = std::min(y0, y1); + extents_data[2] = std::max(x0, x1); + extents_data[3] = std::max(y0, y1); + minpos_data[0] = xm; + minpos_data[1] = ym; + } + + ::get_path_extents(path, trans, + &extents_data[0], &extents_data[1], &extents_data[2], &extents_data[3], + &minpos_data[0], &minpos_data[1]); + + changed = (extents_data[0] != x0 || + extents_data[1] != y0 || + extents_data[2] != x1 || + extents_data[3] != y1 || + minpos_data[0] != xm || + minpos_data[1] != ym); + + extents = (PyArrayObject*)PyArray_SimpleNewFromData + (2, extent_dims, PyArray_DOUBLE, extents_data); + minpos = (PyArrayObject*)PyArray_SimpleNewFromData + (1, minpos_dims, PyArray_DOUBLE, minpos_data); + } catch(...) { + if (extents) + Py_XDECREF(extents); + else + delete[] extents_data; + if (minpos) + Py_XDECREF(minpos); + else + delete[] minpos_data; + throw; + } + + Py::Tuple result(3); + result[0] = Py::Object((PyObject*) extents); + result[1] = Py::Object((PyObject*) minpos); + result[2] = Py::Int(changed ? 1 : 0); + return result; } @@ -290,12 +401,12 @@ agg::trans_affine offset_trans = py_to_agg_transformation_matrix(args[4], false); PyArrayObject* offsets = NULL; - double x0, y0, x1, y1; + double x0, y0, x1, y1, xm, ym; try { offsets = (PyArrayObject*)PyArray_FromObject(offsets_obj.ptr(), PyArray_DOUBLE, 0, 2); - if (!offsets || - (PyArray_NDIM(offsets) == 2 && PyArray_DIM(offsets, 1) != 2) || + if (!offsets || + (PyArray_NDIM(offsets) == 2 && PyArray_DIM(offsets, 1) != 2) || (PyArray_NDIM(offsets) == 1 && PyArray_DIM(offsets, 0) != 0)) { throw Py::ValueError("Offsets array must be Nx2"); } @@ -316,7 +427,7 @@ trans *= master_transform; transforms.push_back(trans); } - + // The offset each of those and collect the mins/maxs x0 = std::numeric_limits<double>::infinity(); y0 = std::numeric_limits<double>::infinity(); @@ -339,7 +450,7 @@ trans *= agg::trans_affine_translation(xo, yo); } - ::get_path_extents(path, trans, &x0, &y0, &x1, &y1); + ::get_path_extents(path, trans, &x0, &y0, &x1, &y1, &xm, &ym); } } catch (...) { Py_XDECREF(offsets); @@ -369,10 +480,10 @@ Py::SeqBase<Py::Object> offsets_obj = args[6]; agg::trans_affine offset_trans = py_to_agg_transformation_matrix(args[7]); bool filled = Py::Int(args[8]); - + PyArrayObject* offsets = (PyArrayObject*)PyArray_FromObject(offsets_obj.ptr(), PyArray_DOUBLE, 0, 2); - if (!offsets || - (PyArray_NDIM(offsets) == 2 && PyArray_DIM(offsets, 1) !=... [truncated message content]
Revision: 4488 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4488&view=rev Author: mdboom Date: 2007年11月28日 10:26:40 -0800 (2007年11月28日) Log Message: ----------- Increase performance of draw_markers in Agg backend Modified Paths: -------------- branches/transforms/src/_backend_agg.cpp branches/transforms/src/agg_py_path_iterator.h Modified: branches/transforms/src/_backend_agg.cpp =================================================================== --- branches/transforms/src/_backend_agg.cpp 2007年11月28日 18:18:11 UTC (rev 4487) +++ branches/transforms/src/_backend_agg.cpp 2007年11月28日 18:26:40 UTC (rev 4488) @@ -549,8 +549,8 @@ agg::serialized_scanlines_adaptor_aa8 sa; agg::serialized_scanlines_adaptor_aa8::embedded_scanline sl; - while (path_quantized.vertex(&x, &y) != agg::path_cmd_stop) { - if (has_clippath) { + if (has_clippath) { + while (path_quantized.vertex(&x, &y) != agg::path_cmd_stop) { pixfmt_amask_type pfa(*pixFmt, *alphaMask); amask_ren_type r(pfa); amask_aa_renderer_type ren(r); @@ -563,7 +563,9 @@ ren.color(gc.color); sa.init(strokeCache, strokeSize, x, y); agg::render_scanlines(sa, sl, ren); - } else { + } + } else { + while (path_quantized.vertex(&x, &y) != agg::path_cmd_stop) { if (face.first) { rendererAA->color(face.second); sa.init(fillCache, fillSize, x, y); @@ -1139,6 +1141,7 @@ m_iterator(0), m_m(m), m_n(n), m_coordinates(coordinates) { } + private: inline unsigned vertex(unsigned idx, double* x, double* y) { size_t m = (idx & 0x2) ? (m_m + 1) : m_m; size_t n = (idx+1 & 0x2) ? (m_n + 1) : m_n; @@ -1148,8 +1151,9 @@ return (idx) ? agg::path_cmd_line_to : agg::path_cmd_move_to; } + public: inline unsigned vertex(double* x, double* y) { - if (m_iterator >= total_vertices()) + if (m_iterator >= total_vertices()) return agg::path_cmd_stop; return vertex(m_iterator++, x, y); } @@ -1496,7 +1500,7 @@ int ymin = height; int xmax = 0; int ymax = 0; - + // Looks at the alpha channel to find the minimum extents of the image unsigned char* pixel = pixBuffer + 3; for (int y = 0; y < (int)height; ++y) { @@ -1520,11 +1524,11 @@ ymin = std::max(0, ymin - 1); xmax = std::min(xmax, (int)width); ymax = std::min(ymax, (int)height); - + newwidth = xmax - xmin; newheight = ymax - ymin; int newsize = newwidth * newheight * 4; - + unsigned char* buf = new unsigned char[newsize]; unsigned int* dst = (unsigned int*)buf; unsigned int* src = (unsigned int*)pixBuffer; @@ -1540,7 +1544,7 @@ bounds[1] = Py::Int(ymin); bounds[2] = Py::Int(newwidth); bounds[3] = Py::Int(newheight); - + Py::Tuple result(2); result[0] = data; result[1] = bounds; Modified: branches/transforms/src/agg_py_path_iterator.h =================================================================== --- branches/transforms/src/agg_py_path_iterator.h 2007年11月28日 18:18:11 UTC (rev 4487) +++ branches/transforms/src/agg_py_path_iterator.h 2007年11月28日 18:26:40 UTC (rev 4488) @@ -17,7 +17,7 @@ m_vertices(NULL), m_codes(NULL), m_iterator(0) { Py::Object vertices_obj = path_obj.getAttr("vertices"); Py::Object codes_obj = path_obj.getAttr("codes"); - + m_vertices = (PyArrayObject*)PyArray_FromObject (vertices_obj.ptr(), PyArray_DOUBLE, 2, 2); if (!m_vertices || PyArray_NDIM(m_vertices) != 2 || PyArray_DIM(m_vertices, 1) != 2) @@ -26,7 +26,7 @@ if (codes_obj.ptr() != Py_None) { m_codes = (PyArrayObject*)PyArray_FromObject (codes_obj.ptr(), PyArray_UINT8, 1, 1); - if (!m_codes) + if (!m_codes) throw Py::ValueError("Invalid codes array."); } @@ -40,11 +40,11 @@ static const char code_map[]; + private: inline unsigned vertex(unsigned idx, double* x, double* y) { - if (idx > m_total_vertices) - throw Py::RuntimeError("Requested vertex past end"); - *x = *(double*)PyArray_GETPTR2(m_vertices, idx, 0); - *y = *(double*)PyArray_GETPTR2(m_vertices, idx, 1); + char* pair = (char*)PyArray_GETPTR2(m_vertices, idx, 0); + *x = *(double*)pair; + *y = *(double*)(pair + PyArray_STRIDE(m_vertices, 1)); if (m_codes) { return code_map[(int)*(char *)PyArray_GETPTR1(m_codes, idx)]; } else { @@ -52,6 +52,7 @@ } } + public: inline unsigned vertex(double* x, double* y) { if (m_iterator >= m_total_vertices) return agg::path_cmd_stop; return vertex(m_iterator++, x, y); @@ -71,10 +72,10 @@ }; // Maps path codes on the Python side to agg path commands -const char PathIterator::code_map[] = - {0, - agg::path_cmd_move_to, - agg::path_cmd_line_to, +const char PathIterator::code_map[] = + {0, + agg::path_cmd_move_to, + agg::path_cmd_line_to, agg::path_cmd_curve3, agg::path_cmd_curve4, agg::path_cmd_end_poly | agg::path_flags_close}; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4487 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4487&view=rev Author: jswhit Date: 2007年11月28日 10:18:11 -0800 (2007年11月28日) Log Message: ----------- fixes for fillcontinents in ortho Modified Paths: -------------- trunk/toolkits/basemap/Changelog Modified: trunk/toolkits/basemap/Changelog =================================================================== --- trunk/toolkits/basemap/Changelog 2007年11月28日 18:11:27 UTC (rev 4486) +++ trunk/toolkits/basemap/Changelog 2007年11月28日 18:18:11 UTC (rev 4487) @@ -1,4 +1,5 @@ version 0.9.8 (not yet released) + * fixes for filling continents in orthographic projection. * added 'maskandscale' kwarg to NetCDFFile to optionally turn off automatic masking and rescaling of variable data. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4486 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4486&view=rev Author: jdh2358 Date: 2007年11月28日 10:11:27 -0800 (2007年11月28日) Log Message: ----------- updated coding guide with trailing whitespace config suggestion Modified Paths: -------------- trunk/matplotlib/CODING_GUIDE Modified: trunk/matplotlib/CODING_GUIDE =================================================================== --- trunk/matplotlib/CODING_GUIDE 2007年11月28日 17:19:16 UTC (rev 4485) +++ trunk/matplotlib/CODING_GUIDE 2007年11月28日 18:11:27 UTC (rev 4486) @@ -39,6 +39,8 @@ * If you have altered extension code, do you pass unit/memleak_hawaii.py? + + == Importing and name spaces == For numpy, use: @@ -103,7 +105,26 @@ to replace a single long line with two shorter and more readable lines. +Please do not commit lines with trailing white space, as it causes +noise in svn diffs. If you are an emacs user, the following in your +.emacs will cause emacs to strip trailing white space on save for +python, C and C++ +; and similarly for c++-mode-hook and c-mode-hook +(add-hook 'python-mode-hook + (lambda () + (add-hook 'local-write-file-hooks 'delete-trailing-whitespace))) + + +for older versions of emacs (emacs<23) you may need to do + +(add-hook 'python-mode-hook + (lambda () + (add-hook 'write-file-functions 'delete-trailing-whitespace))) + + + + == Licenses == matplotlib only uses BSD compatible code. If you bring in code from This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4485 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4485&view=rev Author: jswhit Date: 2007年11月28日 09:19:16 -0800 (2007年11月28日) Log Message: ----------- more orthographic fixes Modified Paths: -------------- trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py Modified: trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py =================================================================== --- trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py 2007年11月28日 15:58:28 UTC (rev 4484) +++ trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py 2007年11月28日 17:19:16 UTC (rev 4485) @@ -689,10 +689,11 @@ lat_0=self.projparams['lat_0'] re = self.projparams['R'] # center of stereographic projection restricted to be - # nearest one of 60 points on the sphere (every 45 deg lat/lon). - lon0 = 45.*(npy.around(lon_0/45.)) - lat0 = 45.*(npy.around(lat_0/45.)) - maptran = pyproj.Proj(proj='stere',lon_0=lon0,lat0=lat_0,R=re) + # nearest one of 6 points on the sphere (every 90 deg lat/lon). + lon0 = 90.*(npy.around(lon_0/90.)) + lat0 = 90.*(npy.around(lat_0/90.)) + if npy.abs(int(lat0)) == 90: lon0=0. + maptran = pyproj.Proj(proj='stere',lon_0=lon0,lat_0=lat0,R=re) # boundary polygon for orthographic projection # in stereographic coorindates. b = self._boundarypolyll.boundary This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.