From: <md...@us...> - 2007-12-07 19:09:54
|
Revision: 4668 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4668&view=rev Author: mdboom Date: 2007-12-07 11:09:52 -0800 (Fri, 07 Dec 2007) Log Message: ----------- Merged revisions 4634-4652 via svnmerge from http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib ........ r4636 | jrevans | 2007-12-05 19:04:49 -0500 (Wed, 05 Dec 2007) | 2 lines Added a 'data offset' coordinate to the Annotation class. ........ r4637 | jrevans | 2007-12-05 19:09:49 -0500 (Wed, 05 Dec 2007) | 2 lines Submitted the wrong version. This is the correct one. ........ r4638 | jdh2358 | 2007-12-05 21:36:05 -0500 (Wed, 05 Dec 2007) | 1 line changed offset naming for annotations ........ r4640 | mdboom | 2007-12-06 07:48:16 -0500 (Thu, 06 Dec 2007) | 2 lines Import numpy. ........ r4643 | mdboom | 2007-12-06 10:10:15 -0500 (Thu, 06 Dec 2007) | 2 lines Fixing display of float images. ........ r4644 | jrevans | 2007-12-06 11:11:17 -0500 (Thu, 06 Dec 2007) | 2 lines Updated to demonstrate 'offset points' ........ r4645 | dsdale | 2007-12-06 11:23:58 -0500 (Thu, 06 Dec 2007) | 3 lines modified svn:ignore properties to ignore generated files not under revision control ........ r4647 | dsdale | 2007-12-06 12:47:46 -0500 (Thu, 06 Dec 2007) | 2 lines fixed a bug in rcsetup, see bug 1845057 ........ r4648 | dsdale | 2007-12-06 13:08:21 -0500 (Thu, 06 Dec 2007) | 3 lines changed the default backend in rcsetup from WXAgg, which is not certain to be present, to Agg. ........ r4649 | dsdale | 2007-12-06 13:32:44 -0500 (Thu, 06 Dec 2007) | 4 lines fixed a bug in savefig, saving to a nonexistent directory would result in a crash in some circumstances. Closes bug 1699614 ........ r4650 | dsdale | 2007-12-06 13:38:55 -0500 (Thu, 06 Dec 2007) | 2 lines undo that last change, mdboom had a different solution that I overlooked ........ r4651 | mdboom | 2007-12-06 13:47:50 -0500 (Thu, 06 Dec 2007) | 2 lines Fix saving to a file-like object. ........ Modified Paths: -------------- branches/transforms/CHANGELOG branches/transforms/examples/annotation_demo.py branches/transforms/lib/matplotlib/__init__.py branches/transforms/lib/matplotlib/cbook.py branches/transforms/lib/matplotlib/cm.py branches/transforms/lib/matplotlib/rcsetup.py branches/transforms/lib/matplotlib/text.py branches/transforms/src/_backend_agg.cpp Property Changed: ---------------- branches/transforms/ branches/transforms/examples/ branches/transforms/lib/ branches/transforms/lib/matplotlib/mpl-data/ branches/transforms/unit/ Property changes on: branches/transforms ___________________________________________________________________ Name: svn:ignore - build dist docs *.pyc .project matplotlibrc win32_static + build dist docs *.pyc .project matplotlibrc win32_static setup.cfg Name: svnmerge-integrated - /trunk/matplotlib:1-4633 + /trunk/matplotlib:1-4652 Modified: branches/transforms/CHANGELOG =================================================================== --- branches/transforms/CHANGELOG 2007-12-07 19:05:11 UTC (rev 4667) +++ branches/transforms/CHANGELOG 2007-12-07 19:09:52 UTC (rev 4668) @@ -1,3 +1,5 @@ +2007-12-06 fixed a bug in rcsetup, see bug 1845057 - DSD + =============================================================== 2007-11-27 Released 0.91.1 at revision 4517 Property changes on: branches/transforms/examples ___________________________________________________________________ Name: svn:ignore - *.eps *.jpeg *.jpg *.pdf *.png *.ps *.pyc *.svg + matplotlibrc matplotlib.conf *.eps *.jpeg *.jpg *.pdf *.png *.ps *.pyc *.svg Modified: branches/transforms/examples/annotation_demo.py =================================================================== --- branches/transforms/examples/annotation_demo.py 2007-12-07 19:05:11 UTC (rev 4667) +++ branches/transforms/examples/annotation_demo.py 2007-12-07 19:09:52 UTC (rev 4668) @@ -10,6 +10,7 @@ 'axes points' : points from lower left corner of axes 'axes pixels' : pixels from lower left corner of axes 'axes fraction' : 0,1 is lower left of axes and 1,1 is upper right + 'offset points' : Specify an offset (in points) from the xy value 'data' : use the axes data coordinate system Optionally, you can specify arrow properties which draws and arrow @@ -54,6 +55,12 @@ ax.annotate('points', xy=(100, 300), xycoords='figure points') + ax.annotate('offset', xy=(1, 1), xycoords='data', + xytext=(-15, 10), textcoords='offset points', + arrowprops=dict(facecolor='black', shrink=0.05), + horizontalalignment='right', verticalalignment='bottom', + ) + ax.annotate('local max', xy=(3, 1), xycoords='data', xytext=(0.8, 0.95), textcoords='axes fraction', arrowprops=dict(facecolor='black', shrink=0.05), Property changes on: branches/transforms/lib ___________________________________________________________________ Name: svn:ignore + matplotlib.egg-info Modified: branches/transforms/lib/matplotlib/__init__.py =================================================================== --- branches/transforms/lib/matplotlib/__init__.py 2007-12-07 19:05:11 UTC (rev 4667) +++ branches/transforms/lib/matplotlib/__init__.py 2007-12-07 19:09:52 UTC (rev 4668) @@ -615,6 +615,15 @@ if ret['datapath'] is None: ret['datapath'] = get_data_path() + if not ret['text.latex.preamble'] == ['']: + verbose.report(""" +***************************************************************** +You have the following UNSUPPORTED LaTeX preamble customizations: +%s +Please do not ask for support with these customizations active. +***************************************************************** +"""% '\n'.join(ret['text.latex.preamble']), 'helpful') + verbose.report('loaded rc file %s'%fname) return ret Modified: branches/transforms/lib/matplotlib/cbook.py =================================================================== --- branches/transforms/lib/matplotlib/cbook.py 2007-12-07 19:05:11 UTC (rev 4667) +++ branches/transforms/lib/matplotlib/cbook.py 2007-12-07 19:09:52 UTC (rev 4668) @@ -215,7 +215,7 @@ return 1 def is_writable_file_like(obj): - return hasattr(filename, 'write') and callable(filename.write) + return hasattr(obj, 'write') and callable(obj.write) def is_scalar(obj): return is_string_like(obj) or not iterable(obj) @@ -892,7 +892,7 @@ return x, self._mem[i0:self._n:isub] def plot(self, i0=0, isub=1, fig=None): - if fig is None: + if fig is None: from pylab import figure, show fig = figure() Modified: branches/transforms/lib/matplotlib/cm.py =================================================================== --- branches/transforms/lib/matplotlib/cm.py 2007-12-07 19:05:11 UTC (rev 4667) +++ branches/transforms/lib/matplotlib/cm.py 2007-12-07 19:09:52 UTC (rev 4668) @@ -2,6 +2,7 @@ This module contains the instantiations of color mapping classes """ +import numpy as npy import matplotlib as mpl import matplotlib.colors as colors import matplotlib.numerix.npyma as ma @@ -57,7 +58,7 @@ if x.shape[2] == 3: if x.dtype == npy.uint8: alpha = npy.array(alpha*255, npy.uint8) - m, n = npy.shape[:2] + m, n = x.shape[:2] xx = npy.empty(shape=(m,n,4), dtype = x.dtype) xx[:,:,:3] = x xx[:,:,3] = alpha Property changes on: branches/transforms/lib/matplotlib/mpl-data ___________________________________________________________________ Name: svn:ignore + matplotlibrc matplotlib.conf Modified: branches/transforms/lib/matplotlib/rcsetup.py =================================================================== --- branches/transforms/lib/matplotlib/rcsetup.py 2007-12-07 19:05:11 UTC (rev 4667) +++ branches/transforms/lib/matplotlib/rcsetup.py 2007-12-07 19:09:52 UTC (rev 4668) @@ -165,21 +165,6 @@ 'landscape', 'portrait', ]) -def validate_latex_preamble(s): - 'return a list' - preamble_list = validate_stringlist(s) - if not preamble_list == ['']: - verbose.report(""" -***************************************************************** -You have the following UNSUPPORTED LaTeX preamble customizations: -%s -Please do not ask for support with these customizations active. -***************************************************************** -"""% '\n'.join(preamble_list), 'helpful') - return preamble_list - - - def validate_aspect(s): if s in ('auto', 'equal'): return s @@ -290,7 +275,7 @@ # a map from key -> value, converter defaultParams = { - 'backend' : ['WXAgg', validate_backend], + 'backend' : ['Agg', validate_backend], # agg is certainly present 'numerix' : ['numpy', validate_numerix], 'maskedarray' : [False, validate_bool], 'toolbar' : ['toolbar2', validate_toolbar], @@ -353,7 +338,7 @@ 'text.color' : ['k', validate_color], # black 'text.usetex' : [False, validate_bool], 'text.latex.unicode' : [False, validate_bool], - 'text.latex.preamble' : [[''], validate_latex_preamble], + 'text.latex.preamble' : [[''], validate_stringlist], 'text.dvipnghack' : [False, validate_bool], 'text.fontstyle' : ['normal', str], 'text.fontangle' : ['normal', str], Modified: branches/transforms/lib/matplotlib/text.py =================================================================== --- branches/transforms/lib/matplotlib/text.py 2007-12-07 19:05:11 UTC (rev 4667) +++ branches/transforms/lib/matplotlib/text.py 2007-12-07 19:09:52 UTC (rev 4668) @@ -182,6 +182,7 @@ whs = npy.zeros((len(lines), 2)) horizLayout = npy.zeros((len(lines), 4)) + # Find full vertical extent of font, # including ascenders and descenders: tmp, heightt, bl = renderer.get_text_width_height_descent( @@ -986,6 +987,7 @@ 'axes pixels' : pixels from lower left corner of axes 'axes fraction' : 0,1 is lower left of axes and 1,1 is upper right 'data' : use the coordinate system of the object being annotated (default) + 'offset points' : Specify an offset (in points) from the xy value 'polar' : you can specify theta, r for the annotation, even in cartesian plots. Note that if you are using a polar axes, you do not need @@ -1041,6 +1043,26 @@ x = float(self.convert_xunits(x)) y = float(self.convert_yunits(y)) return trans.transform_point((x, y)) + elif s=='offset points': + # convert the data point + dx, dy = self.xy + + # prevent recursion + if self.xycoords == 'offset points': + return self._get_xy(dx, dy, 'data') + + dx, dy = self._get_xy(dx, dy, self.xycoords) + + # convert the offset + dpi = self.figure.dpi.get() + x *= dpi/72. + y *= dpi/72. + + # add the offset to the data point + x += dx + y += dy + + return x, y elif s=='polar': theta, r = x, y x = r*npy.cos(theta) Modified: branches/transforms/src/_backend_agg.cpp =================================================================== --- branches/transforms/src/_backend_agg.cpp 2007-12-07 19:05:11 UTC (rev 4667) +++ branches/transforms/src/_backend_agg.cpp 2007-12-07 19:09:52 UTC (rev 4668) @@ -593,7 +593,6 @@ delete[] strokeCache; return Py::Object(); - } /** @@ -1324,11 +1323,9 @@ throw Py::RuntimeError( Printf("Could not open file %s", file_name).str() ); } else { - if ((fp = PyFile_AsFile(py_fileobj.ptr())) == NULL) { - PyObject* write_method = PyObject_GetAttrString(py_fileobj.ptr(), "write"); - if (!(write_method && PyCallable_Check(write_method))) - throw Py::TypeError("Object does not appear to be a path or a Python file-like object"); - } + PyObject* write_method = PyObject_GetAttrString(py_fileobj.ptr(), "write"); + if (!(write_method && PyCallable_Check(write_method))) + throw Py::TypeError("Object does not appear to be a path or a Python file-like object"); } png_bytep *row_pointers = NULL; Property changes on: branches/transforms/unit ___________________________________________________________________ Name: svn:ignore + *.png This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |