From: <md...@us...> - 2007-12-07 19:18:07
|
Revision: 4669 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4669&view=rev Author: mdboom Date: 2007-12-07 11:18:02 -0800 (Fri, 07 Dec 2007) Log Message: ----------- Merged revisions 4653-4668 via svnmerge from http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib ........ r4653 | mdboom | 2007-12-06 14:10:12 -0500 (Thu, 06 Dec 2007) | 2 lines [ 1841933 ] font_manager.win32FontDirectory() fails as Vista service ........ r4654 | dsdale | 2007-12-06 14:18:49 -0500 (Thu, 06 Dec 2007) | 2 lines updated references to mpl data directories for py2exe ........ r4658 | dsdale | 2007-12-06 17:28:27 -0500 (Thu, 06 Dec 2007) | 4 lines let widgets.Cursor initialize to the lower x and y bounds rather than 0,0, which can cause havoc for dates and other transforms ........ r4665 | efiring | 2007-12-07 02:12:33 -0500 (Fri, 07 Dec 2007) | 2 lines Clarify docstrings on Subplot classes; closes 1659419 ........ r4667 | mdboom | 2007-12-07 14:05:11 -0500 (Fri, 07 Dec 2007) | 4 lines [ 1697287 ] imshow on log axes broken if axes limits != image extent Adds a warning when an image is used on non-linear axes. Doesn't really address the problem (see bug report for the reason.) ........ Modified Paths: -------------- branches/transforms/CHANGELOG branches/transforms/lib/matplotlib/__init__.py branches/transforms/lib/matplotlib/axes.py branches/transforms/lib/matplotlib/config/cutils.py branches/transforms/lib/matplotlib/figure.py branches/transforms/lib/matplotlib/font_manager.py branches/transforms/lib/matplotlib/image.py branches/transforms/lib/matplotlib/widgets.py Property Changed: ---------------- branches/transforms/ Property changes on: branches/transforms ___________________________________________________________________ Name: svnmerge-integrated - /trunk/matplotlib:1-4652 + /trunk/matplotlib:1-4668 Modified: branches/transforms/CHANGELOG =================================================================== --- branches/transforms/CHANGELOG 2007-12-07 19:09:52 UTC (rev 4668) +++ branches/transforms/CHANGELOG 2007-12-07 19:18:02 UTC (rev 4669) @@ -1,3 +1,9 @@ +2007-12-06 let widgets.Cursor initialize to the lower x and y bounds + rather than 0,0, which can cause havoc for dates and other + transforms - DSD + +2007-12-06 updated references to mpl data directories for py2exe - DSD + 2007-12-06 fixed a bug in rcsetup, see bug 1845057 - DSD =============================================================== @@ -11,8 +17,8 @@ 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 + 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 @@ -22,41 +28,41 @@ 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 + 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: - + mathtext.fontset, can be used to choose between: + 'cm': - The TeX/LaTeX Computer Modern fonts + The TeX/LaTeX Computer Modern fonts - 'stix': + 'stix': The STIX fonts (see stixfonts.org) - 'stixsans': - The STIX fonts, using sans-serif glyphs by default + 'stixsans': + The STIX fonts, using sans-serif glyphs by default - 'custom': + '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 +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 + 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 +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 @@ -101,7 +107,7 @@ The transformation framework was completely rewritten in Python (with Numpy). This will make it easier to add news - kinds of transformations without writing C/C++ code. + kinds of transformations without writing C/C++ code. Transforms are composed into a 'transform tree', made of transforms whose value depends on other transforms (their @@ -133,7 +139,7 @@ the backends more consistent in terms of functionality. User visible changes: - + - POLAR PLOTS: Polar plots are now interactively zoomable, and the r-axis labels can be interactively rotated. Straight line segments are now interpolated to follow the @@ -141,21 +147,21 @@ - Non-rectangular clipping works in more backends and with more types of objects. - + - Sharing an axis across figures is now done in exactly the same way as sharing an axis between two axes in the same figure: - + fig1 = figure() fig2 = figure() ax1 = fig1.add_subplot(111) ax2 = fig2.add_subplot(111, sharex=ax1, sharey=ax1) - + - linestyles now include steps-pre, steps-post and steps-mid. The old step still works and is equivalent to step-pre. - + - Multiple line styles may be provided to a collection. See API_CHANGES for more low-level information about this Modified: branches/transforms/lib/matplotlib/__init__.py =================================================================== --- branches/transforms/lib/matplotlib/__init__.py 2007-12-07 19:09:52 UTC (rev 4668) +++ branches/transforms/lib/matplotlib/__init__.py 2007-12-07 19:18:02 UTC (rev 4669) @@ -428,11 +428,16 @@ # py2exe zips pure python, so still need special check if getattr(sys,'frozen',None): - path = os.path.join(os.path.split(sys.path[0])[0], 'matplotlibdata') + path = os.path.join(os.path.split(sys.path[0])[0], 'mpl-data') if os.path.isdir(path): return path else: + # Try again assuming we need to step up one more directory + path = os.path.join(os.path.split(os.path.split(sys.path[0])[0])[0], + 'mpl-data') + if os.path.isdir(path): return path + else: # Try again assuming sys.path[0] is a dir not a exe - path = os.path.join(sys.path[0], 'matplotlibdata') + path = os.path.join(sys.path[0], 'mpl-data') if os.path.isdir(path): return path raise RuntimeError('Could not find the matplotlib data files') @@ -442,7 +447,8 @@ defaultParams['datapath'][0] = _get_data_path() return defaultParams['datapath'][0] -get_data_path = verbose.wrap('matplotlib data path %s', _get_data_path_cached, always=False) +get_data_path = verbose.wrap('matplotlib data path %s', _get_data_path_cached, + always=False) def get_py2exe_datafiles(): datapath = get_data_path() @@ -454,8 +460,8 @@ if 'Matplotlib.nib' in files: files.remove('Matplotlib.nib') files = [os.path.join(root, filename) for filename in files] - root = root.replace(tail, 'matplotlibdata') - root = root[root.index('matplotlibdata'):] + root = root.replace(tail, 'mpl-data') + root = root[root.index('mpl-data'):] d[root] = files return d.items() Modified: branches/transforms/lib/matplotlib/axes.py =================================================================== --- branches/transforms/lib/matplotlib/axes.py 2007-12-07 19:09:52 UTC (rev 4668) +++ branches/transforms/lib/matplotlib/axes.py 2007-12-07 19:18:02 UTC (rev 4669) @@ -5511,25 +5511,23 @@ class SubplotBase: """ - Emulate matlab's(TM) subplot command, creating axes with - - Subplot(numRows, numCols, plotNum) - - where plotNum=1 is the first plot number and increasing plotNums - fill rows first. max(plotNum)==numRows*numCols - - You can leave out the commas if numRows<=numCols<=plotNum<10, as - in - - Subplot(211) # 2 rows, 1 column, first (upper) plot + Base class for subplots, which are Axes instances with additional + methods to facilitate generating and manipulating a set of Axes + within a figure. """ def __init__(self, fig, *args, **kwargs): """ fig is a figure instance - args is a varargs to specify the subplot + args is numRows, numCols, plotNum + where the array of subplots in the figure has dimensions + numRows, numCols, and where plotNum is the number of the + subplot being created. plotNum starts at 1 in the upper + right corner and increases to the right. + If numRows<=numCols<=plotNum<10, args can be the decimal + integer numRows*100 + numCols*10 + plotNum. """ self.figure = fig @@ -5650,7 +5648,6 @@ 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. Modified: branches/transforms/lib/matplotlib/config/cutils.py =================================================================== --- branches/transforms/lib/matplotlib/config/cutils.py 2007-12-07 19:09:52 UTC (rev 4668) +++ branches/transforms/lib/matplotlib/config/cutils.py 2007-12-07 19:18:02 UTC (rev 4669) @@ -77,7 +77,7 @@ if os.path.exists(p): if not is_writable_dir(p): raise RuntimeError("""\ -'%s' is not a writable dir; you must set %s/.matplotlib to be a writable dir. +'%s' is not a writable dir; you must set %s/.matplotlib to be a writable dir. You can also set environment variable MPLCONFIGDIR to any writable directory where you want matplotlib data stored """%h) else: @@ -110,11 +110,16 @@ # py2exe zips pure python, so still need special check if getattr(sys,'frozen',None): - path = os.path.join(os.path.split(sys.path[0])[0], 'matplotlibdata') + path = os.path.join(os.path.split(sys.path[0])[0], 'mpl-data') if os.path.isdir(path): return path else: + # Try again assuming we need to step up one more directory + path = os.path.join(os.path.split(os.path.split(sys.path[0])[0])[0], + 'mpl-data') + if os.path.isdir(path): return path + else: # Try again assuming sys.path[0] is a dir not a exe - path = os.path.join(sys.path[0], 'matplotlibdata') + path = os.path.join(sys.path[0], 'mpl-data') if os.path.isdir(path): return path raise RuntimeError('Could not find the matplotlib data files') @@ -136,8 +141,8 @@ if 'Matplotlib.nib' in files: files.remove('Matplotlib.nib') files = [os.path.join(root, filename) for filename in files] - root = root.replace(tail, 'matplotlibdata') - root = root[root.index('matplotlibdata'):] + root = root.replace(tail, 'mpl-data') + root = root[root.index('mpl-data'):] d[root] = files return d.items() Modified: branches/transforms/lib/matplotlib/figure.py =================================================================== --- branches/transforms/lib/matplotlib/figure.py 2007-12-07 19:09:52 UTC (rev 4668) +++ branches/transforms/lib/matplotlib/figure.py 2007-12-07 19:18:02 UTC (rev 4669) @@ -526,6 +526,7 @@ Add a subplot. Examples add_subplot(111) + add_subplot(1,1,1) # equivalent but more general add_subplot(212, axisbg='r') # add subplot with red background add_subplot(111, polar=True) # add a polar subplot add_subplot(sub) # add Subplot instance sub Modified: branches/transforms/lib/matplotlib/font_manager.py =================================================================== --- branches/transforms/lib/matplotlib/font_manager.py 2007-12-07 19:09:52 UTC (rev 4668) +++ branches/transforms/lib/matplotlib/font_manager.py 2007-12-07 19:18:02 UTC (rev 4669) @@ -105,14 +105,16 @@ try: import _winreg except ImportError: - return os.path.join(os.environ['WINDIR'], 'Fonts') + pass # Fall through to default else: user = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, MSFolders) try: return _winreg.QueryValueEx(user, 'Fonts')[0] + except OSError: + pass # Fall through to default finally: _winreg.CloseKey(user) - return None + return os.path.join(os.environ['WINDIR'], 'Fonts') def win32InstalledFonts(directory=None, fontext='ttf'): """ Modified: branches/transforms/lib/matplotlib/image.py =================================================================== --- branches/transforms/lib/matplotlib/image.py 2007-12-07 19:09:52 UTC (rev 4668) +++ branches/transforms/lib/matplotlib/image.py 2007-12-07 19:18:02 UTC (rev 4669) @@ -4,7 +4,7 @@ """ from __future__ import division -import os +import os, warnings import numpy as npy @@ -180,6 +180,9 @@ def draw(self, renderer, *args, **kwargs): if not self.get_visible(): return + if (self.axes.get_xscale() != 'linear' or + self.axes.get_yscale() != 'linear'): + warnings.warn("Images are not supported on non-linear axes.") im = self.make_image(renderer.get_image_magnification()) l, b, widthDisplay, heightDisplay = self.axes.bbox.bounds renderer.draw_image(l, b, im, self.axes.bbox.frozen(), Modified: branches/transforms/lib/matplotlib/widgets.py =================================================================== --- branches/transforms/lib/matplotlib/widgets.py 2007-12-07 19:09:52 UTC (rev 4668) +++ branches/transforms/lib/matplotlib/widgets.py 2007-12-07 19:18:02 UTC (rev 4669) @@ -664,8 +664,8 @@ self.vertOn = True self.useblit = useblit - self.lineh = ax.axhline(0, visible=False, **lineprops) - self.linev = ax.axvline(0, visible=False, **lineprops) + self.lineh = ax.axhline(ax.get_ybound()[0], visible=False, **lineprops) + self.linev = ax.axvline(ax.get_xbound()[0], visible=False, **lineprops) self.background = None self.needclear = False @@ -1072,11 +1072,11 @@ # If RectangleSelector is not active : if not self.active: return True - + # If canvas was locked if not self.canvas.widgetlock.available(self): return True - + # If no button was pressed yet ignore the event if it was out # of the axes if self.eventpress == None: @@ -1176,7 +1176,7 @@ def get_active(self): """ to get status of active mode (boolean variable)""" - return self.active + return self.active class Lasso(Widget): def __init__(self, ax, xy, callback=None, useblit=True): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |