SF.net SVN: matplotlib: [3651] trunk/matplotlib/setupext.py
Revision: 3651 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3651view=rev Author: mdboom Date: 2007-08-01 05:41:17 -0700 (Wed, 01 Aug 2007) Log Message: --- Fix wxagg building for earlier versions of wx Modified Paths: -- trunk/matplotlib/setupext.py Modified: trunk/matplotlib/setupext.py === --- trunk/matplotlib/setupext.py2007-08-01 12:28:24 UTC (rev 3650) +++ trunk/matplotlib/setupext.py2007-08-01 12:41:17 UTC (rev 3651) @@ -810,6 +810,7 @@ add_agg_flags(module) add_ft2font_flags(module) + wxconfig = find_wx_config() add_wx_flags(module, wxconfig) ext_modules.append(module) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3653] trunk/matplotlib/setupext.py
Revision: 3653 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3653view=rev Author: mdboom Date: 2007-08-01 06:06:07 -0700 (Wed, 01 Aug 2007) Log Message: --- Removing test code Modified Paths: -- trunk/matplotlib/setupext.py Modified: trunk/matplotlib/setupext.py === --- trunk/matplotlib/setupext.py2007-08-01 13:03:00 UTC (rev 3652) +++ trunk/matplotlib/setupext.py2007-08-01 13:06:07 UTC (rev 3653) @@ -193,7 +193,6 @@ status, output = commands.getstatusoutput( %s %s %s % (pkg_config_exec, flags, packages)) if status == 0: -output += ' -UFOO' for token in output.split(): attr = _flags.get(token[:2], None) if attr is not None: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3657] trunk/matplotlib/setupext.py
Revision: 3657 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3657view=rev Author: mdboom Date: 2007-08-01 08:06:29 -0700 (Wed, 01 Aug 2007) Log Message: --- Fix erroneous message when wxPython devel headers are not even needed. Modified Paths: -- trunk/matplotlib/setupext.py Modified: trunk/matplotlib/setupext.py === --- trunk/matplotlib/setupext.py2007-08-01 14:22:16 UTC (rev 3656) +++ trunk/matplotlib/setupext.py2007-08-01 15:06:29 UTC (rev 3657) @@ -373,7 +373,7 @@ p = os.path.join(d, 'freetype2/lib') if os.path.exists(p): module.library_dirs.append(p) -module.libraries.append('z') +module.libraries.append('z') add_base_flags(module) if sys.platform == 'win32' and win32_compiler == 'mingw32': @@ -470,7 +470,10 @@ except ImportError: explanation = 'wxPython not found' else: -if sys.platform == 'win32' and win32_compiler == 'mingw32': +if getattr(wx, '__version__', '0.0')[0:3] = '2.8': +print_status(wxPython, wx.__version__) +return True +elif sys.platform == 'win32' and win32_compiler == 'mingw32': explanation = The wxAgg extension can not be built using the mingw32 compiler on Windows, since the default wxPython binary is built using MS Visual Studio else: wxconfig = find_wx_config() @@ -491,15 +494,14 @@ gotit = True if gotit: -if getattr(wx, '__version__', '0.0')[0:3] '2.8': -module = Extension(test, []) -add_wx_flags(module, wxconfig) -if not find_include_file( -module.include_dirs, -os.path.join(wx, wxPython, wxPython.h)): -explanation = (Could not find wxPython headers in any of %s % +module = Extension(test, []) +add_wx_flags(module, wxconfig) +if not find_include_file( +module.include_dirs, +os.path.join(wx, wxPython, wxPython.h)): +explanation = (Could not find wxPython headers in any of %s % , .join(['%s' % x for x in module.include_dirs])) -gotit = False +gotit = False if gotit: print_status(wxPython, wx.__version__) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3659] trunk/matplotlib/lib/matplotlib/mathtext.py
Revision: 3659 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3659view=rev Author: mdboom Date: 2007-08-01 08:35:54 -0700 (Wed, 01 Aug 2007) Log Message: --- Use numpy.inf Modified Paths: -- trunk/matplotlib/lib/matplotlib/mathtext.py Modified: trunk/matplotlib/lib/matplotlib/mathtext.py === --- trunk/matplotlib/lib/matplotlib/mathtext.py 2007-08-01 15:07:29 UTC (rev 3658) +++ trunk/matplotlib/lib/matplotlib/mathtext.py 2007-08-01 15:35:54 UTC (rev 3659) @@ -135,6 +135,7 @@ from sets import Set from unicodedata import category from warnings import warn +import numpy from matplotlib import verbose from matplotlib.pyparsing import Literal, Word, OneOrMore, ZeroOrMore, \ @@ -607,7 +608,11 @@ r'\backslash': [('cal', '\x6e'), ('ex', '\xb2'), ('ex', '\x2f'), ('ex', '\xc2'), ('ex', '\x2d')], r'/' : [('rm', '/'), ('ex', '\xb1'), ('ex', '\x2e'), -('ex', '\xcb'), ('ex', '\x2c')] +('ex', '\xcb'), ('ex', '\x2c')], +r'\widehat' : [('rm', '\x5e'), ('ex', '\x62'), ('ex', '\x63'), +('ex', '\x64')], +r'\widetilde': [('rm', '\x7e'), ('ex', '\x65'), ('ex', '\x66'), +('ex', '\x67')] } for alias, target in [('\leftparen', '('), @@ -1162,7 +1167,7 @@ List.__init__(self, elements) self.vpack() -def vpack(self, h=0., m='additional', l=float('inf')): +def vpack(self, h=0., m='additional', l=float(numpy.inf)): The main duty of vpack is to compute the dimensions of the resulting boxes, and to adjust the glue if one of those dimensions is pre-specified. @@ -1395,7 +1400,7 @@ self.super = None Hlist.__init__(self, []) -class AutoSizedDelim(Hlist): +class AutoHeightChar(Hlist): A class that will create a character as close to the given height and depth as possible. When using a font with multiple height versions of some characters (such as the BaKoMa fonts), the correct glyph will @@ -1425,6 +1430,34 @@ shift = (depth - char.depth) Hlist.__init__(self, [char]) self.shift_amount = shift + +class AutoWidthChar(Hlist): +A class that will create a character as close to the given width +as possible. When using a font with multiple width versions +of some characters (such as the BaKoMa fonts), the correct glyph will +be selected, otherwise this will always just return a scaled version +of the glyph. +def __init__(self, c, width, state, always=False): +alternatives = state.font_output.get_sized_alternatives_for_symbol( +state.font, c) + +state = state.copy() +big_enough = False +for fontname, sym in alternatives: +state.font = fontname +char = Char(sym, state) +if char.width width: +big_enough = True +break + +# If the largest option is still not big enough, just do +# simple scale on it. +if not big_enough: +factor = width / char.width +state.fontsize *= factor +char = Char(sym, state) + +Hlist.__init__(self, [char]) class Ship(object): Once the boxes have been set up, this sends them to output. @@ -1653,7 +1686,7 @@ bslash = Literal('\\') accent = oneOf(hat check dot breve acute ddot grave tilde bar - vec \ ` ' ~ . ^) + vec \ ` ' ~ . ^ widehat widetilde) function = oneOf(arccos csc ker min arcsin deg lg Pr arctan det lim sec arg dim liminf sin cos exp limsup sinh @@ -1920,8 +1953,10 @@ r\' : r'\combiningacuteaccent', r'\~' : r'\combiningtilde', r'\.' : r'\combiningdotabove', -r'\^' : r'\circumflexaccent', +r'\^' : r'\circumflexaccent' } + +_wide_accents = Set(r\widehat \widetilde.split()) def accent(self, s, loc, toks): assert(len(toks)==1) @@ -1931,7 +1966,10 @@ if len(toks[0]) != 2: raise ParseFatalException(Error parsing accent) accent, sym = toks[0] -accent = Accent(self._accent_map[accent], self.get_state()) +if accent in self._wide_accents: +accent = AutoWidthChar(accent, sym.width, state) +else: +accent = Accent(self._accent_map[accent], state) centered = HCentered([accent]) centered.hpack(sym.width, 'exactly') centered.shift_amount = accent._metrics.xmin @@ -2154,7 +2192,7 @@ # the height so it doesn't seem cramped height = body.height - body.shift_amount + thickness * 5.0 depth = body.depth + body.shift_amount -check
SF.net SVN: matplotlib: [3661] trunk/matplotlib/setup.py
Revision: 3661 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3661view=rev Author: mdboom Date: 2007-08-01 09:21:11 -0700 (Wed, 01 Aug 2007) Log Message: --- Only display the raw version (not the SVN revision, which only refers to one file and is basically wrong.) Modified Paths: -- trunk/matplotlib/setup.py Modified: trunk/matplotlib/setup.py === --- trunk/matplotlib/setup.py 2007-08-01 15:56:34 UTC (rev 3660) +++ trunk/matplotlib/setup.py 2007-08-01 16:21:11 UTC (rev 3661) @@ -108,14 +108,12 @@ BUILD_NXUTILS = 1 for line in file('lib/matplotlib/__init__.py').readlines(): -if (line.startswith('__version__') or -line.startswith('__revision__') or -line.startswith('__date__')): +if (line.startswith('__version__')): exec(line.strip()) print_line() print_raw(BUILDING MATPLOTLIB) -print_status('matplotlib', '%s (r%s)' % (__version__, __revision__.split()[-2])) +print_status('matplotlib', __version__) print_status('python', sys.version) print_status('platform', sys.platform) if sys.platform == 'win32': This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3662] trunk/matplotlib/src/_ttconv.cpp
Revision: 3662 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3662view=rev Author: mdboom Date: 2007-08-01 10:28:58 -0700 (Wed, 01 Aug 2007) Log Message: --- Convert _ttconv.cpp to use raw Python/C API, rather than CXX. Modified Paths: -- trunk/matplotlib/src/_ttconv.cpp Modified: trunk/matplotlib/src/_ttconv.cpp === --- trunk/matplotlib/src/_ttconv.cpp2007-08-01 16:21:11 UTC (rev 3661) +++ trunk/matplotlib/src/_ttconv.cpp2007-08-01 17:28:58 UTC (rev 3662) @@ -1,181 +1,204 @@ -#include CXX/Extensions.hxx -#include CXX/Objects.hxx -#include ttconv/pprdrv.h +/* + _ttconv.c -class ttconv_module : public Py::ExtensionModulettconv_module -{ -public: - ttconv_module() -: Py::ExtensionModulettconv_module( ttconv ) - { -add_varargs_method(convert_ttf_to_ps, - ttconv_module::convert_ttf_to_ps, - ttconv_module::convert_ttf_to_ps__doc__); -add_varargs_method(get_pdf_charprocs, - ttconv_module::get_pdf_charprocs, - ttconv_module::get_pdf_charprocs__doc__); + Python wrapper for TrueType conversion library in ../ttconv. + */ -initialize( The ttconv module ); - } +#include Python.h +#include ttconv/pprdrv.h +#include vector - Py::Object - convert_ttf_to_ps(const Py::Tuple args); - static char convert_ttf_to_ps__doc__[]; - - Py::Object - get_pdf_charprocs(const Py::Tuple args); - static char get_pdf_charprocs__doc__[]; -}; - -char ttconv_module::convert_ttf_to_ps__doc__[] = -convert_ttf_to_ps(filename, output, fonttype, glyph_ids)\n -\n -Converts the Truetype font into a Type 3 or Type 42 Postscript font, -optionally subsetting the font to only the desired set of characters.\n -\n -filename is the path to a TTF font file.\n -output is a Python file-like object with a write method that the Postscript -font data will be written to.\n -fonttype may be either 3 or 42. Type 3 is a \raw Postscript\ font. -Type 42 is an embedded Truetype font. Glyph subsetting is not supported -for Type 42 fonts.\n -glyph_ids (optional) is a list of glyph ids (integers) to keep when -subsetting to a Type 3 font. If glyph_ids is not provided or is None, -then all glyphs will be included. If any of the glyphs specified are -composite glyphs, then the component glyphs will also be included. -; - /** * An implementation of TTStreamWriter that writes to a Python * file-like object. */ class PythonFileWriter : public TTStreamWriter { - Py::Callable _write_method; + PyObject* _write_method; public: - PythonFileWriter(const Py::Object file_like_object) { -_write_method = file_like_object.getAttr( write ); + PythonFileWriter() { +_write_method = NULL; } + ~PythonFileWriter() { +if (_write_method) + Py_DECREF(_write_method); + } + + void set(PyObject* write_method) { +if (_write_method) + Py_DECREF(_write_method); +_write_method = write_method; +if (_write_method) + Py_INCREF(_write_method); + } + virtual void write(const char* a) { -Py::Tuple args(1); -args[0] = Py::String(a); -_write_method.apply(args); +if (_write_method) + PyObject_CallFunction(_write_method, s, a); } }; -Py::Object -ttconv_module::convert_ttf_to_ps(const Py::Tuple args) { - args.verify_length(3, 4); +int fileobject_to_PythonFileWriter(PyObject* object, void* address) { + PythonFileWriter* file_writer = (PythonFileWriter*)address; + PyObject* write_method = PyObject_GetAttrString(object, write); + if (write_method == NULL || ! PyCallable_Check(write_method)) { +PyErr_SetString(PyExc_TypeError, Expected a file-like object with a write method.); +return 0; + } + file_writer-set(write_method); + return 1; +} - std::string fname = Py::String(args[0]).as_std_string(); +int pyiterable_to_vector_int(PyObject* object, void* address) { + std::vectorint* result = (std::vectorint*)address; + PyObject* iterator = PyObject_GetIter(object); + if (! iterator) +return 0; + PyObject* item; + while (item = PyIter_Next(iterator)) { +long value = PyInt_AsLong(item); +if (value == -1 PyErr_Occurred()) + return 0; +result-push_back(value); + } + return 1; +} - PythonFileWriter python_file_writer(args[1]); +static PyObject* +convert_ttf_to_ps(PyObject* self, PyObject* args, PyObject* kwds) { + const char* filename; + PythonFileWriter output; + int fonttype; + std::vectorint glyph_ids; - long font_type = (long)Py::Int(args[2]); - if ( font_type != 3 font_type != 42 ) { -throw Py::ValueError(Font type must be either 3 (raw Postscript) or 42 (embedded Truetype)); + static char *kwlist[] = { filename, output, fonttype, glyph_ids, NULL }; + if (! PyArg_ParseTupleAndKeywords + (args, kwds, + sOi|O:convert_ttf_to_ps, kwlist, + filename
SF.net SVN: matplotlib: [3665] trunk/matplotlib/src/_ttconv.cpp
Revision: 3665 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3665view=rev Author: mdboom Date: 2007-08-02 11:49:17 -0700 (Thu, 02 Aug 2007) Log Message: --- Improved exception handling. Remove compiler warning. Modified Paths: -- trunk/matplotlib/src/_ttconv.cpp Modified: trunk/matplotlib/src/_ttconv.cpp === --- trunk/matplotlib/src/_ttconv.cpp2007-08-02 18:37:32 UTC (rev 3664) +++ trunk/matplotlib/src/_ttconv.cpp2007-08-02 18:49:17 UTC (rev 3665) @@ -8,6 +8,10 @@ #include ttconv/pprdrv.h #include vector +class PythonExceptionOccurred { + +}; + /** * An implementation of TTStreamWriter that writes to a Python * file-like object. @@ -35,33 +39,40 @@ virtual void write(const char* a) { if (_write_method) - PyObject_CallFunction(_write_method, s, a); + if (! PyObject_CallFunction(_write_method, s, a)) + throw PythonExceptionOccurred(); } }; int fileobject_to_PythonFileWriter(PyObject* object, void* address) { PythonFileWriter* file_writer = (PythonFileWriter*)address; + PyObject* write_method = PyObject_GetAttrString(object, write); if (write_method == NULL || ! PyCallable_Check(write_method)) { PyErr_SetString(PyExc_TypeError, Expected a file-like object with a write method.); return 0; } + file_writer-set(write_method); + return 1; } int pyiterable_to_vector_int(PyObject* object, void* address) { std::vectorint* result = (std::vectorint*)address; + PyObject* iterator = PyObject_GetIter(object); if (! iterator) return 0; + PyObject* item; - while (item = PyIter_Next(iterator)) { + while ( (item = PyIter_Next(iterator)) ) { long value = PyInt_AsLong(item); if (value == -1 PyErr_Occurred()) return 0; result-push_back(value); } + return 1; } @@ -96,6 +107,8 @@ } catch (TTException e) { PyErr_SetString(PyExc_RuntimeError, e.getMessage()); return NULL; + } catch (PythonExceptionOccurred e) { +return NULL; } catch (...) { PyErr_SetString(PyExc_RuntimeError, Unknown C++ exception); return NULL; @@ -116,7 +129,8 @@ virtual void add_pair(const char* a, const char* b) { PyObject* value = PyString_FromString(b); if (value) - PyDict_SetItemString(_dict, a, value); + if (PyDict_SetItemString(_dict, a, value)) + throw PythonExceptionOccurred(); } }; @@ -146,6 +160,8 @@ } catch (TTException e) { PyErr_SetString(PyExc_RuntimeError, e.getMessage()); return NULL; + } catch (PythonExceptionOccurred e) { +return NULL; } catch (...) { PyErr_SetString(PyExc_RuntimeError, Unknown C++ exception); return NULL; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3667] trunk/matplotlib/lib/matplotlib/mathtext.py
Revision: 3667 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3667view=rev Author: mdboom Date: 2007-08-02 12:07:02 -0700 (Thu, 02 Aug 2007) Log Message: --- Small bugfix with auto-sized delimiters Modified Paths: -- trunk/matplotlib/lib/matplotlib/mathtext.py Modified: trunk/matplotlib/lib/matplotlib/mathtext.py === --- trunk/matplotlib/lib/matplotlib/mathtext.py 2007-08-02 18:59:29 UTC (rev 3666) +++ trunk/matplotlib/lib/matplotlib/mathtext.py 2007-08-02 19:07:02 UTC (rev 3667) @@ -1412,20 +1412,15 @@ state = state.copy() target_total = height + depth -big_enough = False for fontname, sym in alternatives: state.font = fontname char = Char(sym, state) -if char.height + char.depth target_total: -big_enough = True +if char.height + char.depth = target_total: break -# If the largest option is still not big enough, just do -# simple scale on it. -if not big_enough: -factor = target_total / (char.height + char.depth) -state.fontsize *= factor -char = Char(sym, state) +factor = target_total / (char.height + char.depth) +state.fontsize *= factor +char = Char(sym, state) shift = (depth - char.depth) Hlist.__init__(self, [char]) @@ -1442,20 +1437,15 @@ state.font, c) state = state.copy() -big_enough = False for fontname, sym in alternatives: state.font = fontname char = char_class(sym, state) -if char.width width: -big_enough = True +if char.width = width: break -# If the largest option is still not big enough, just do -# simple scale on it. -if not big_enough: -factor = width / char.width -state.fontsize *= factor -char = char_class(sym, state) +factor = width / char.width +state.fontsize *= factor +char = char_class(sym, state) Hlist.__init__(self, [char]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3668] trunk/matplotlib
Revision: 3668 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3668view=rev Author: mdboom Date: 2007-08-02 14:32:30 -0700 (Thu, 02 Aug 2007) Log Message: --- Attempting to reduce compiler warnings for gcc-4.2 (which I don't have, but Darren Dale has reported some new warnings). Modified Paths: -- trunk/matplotlib/src/_ttconv.cpp trunk/matplotlib/src/ft2font.cpp trunk/matplotlib/ttconv/pprdrv_tt.cpp trunk/matplotlib/ttconv/truetype.h Modified: trunk/matplotlib/src/_ttconv.cpp === --- trunk/matplotlib/src/_ttconv.cpp2007-08-02 19:07:02 UTC (rev 3667) +++ trunk/matplotlib/src/_ttconv.cpp2007-08-02 21:32:30 UTC (rev 3668) @@ -83,10 +83,10 @@ int fonttype; std::vectorint glyph_ids; - static char *kwlist[] = { filename, output, fonttype, glyph_ids, NULL }; + static const char *kwlist[] = { filename, output, fonttype, glyph_ids, NULL }; if (! PyArg_ParseTupleAndKeywords (args, kwds, - sOi|O:convert_ttf_to_ps, kwlist, + sOi|O:convert_ttf_to_ps, (char **)kwlist, filename, fileobject_to_PythonFileWriter, output, @@ -140,10 +140,10 @@ std::vectorint glyph_ids; PyObject* result; - static char *kwlist[] = { filename, glyph_ids, NULL }; + static const char *kwlist[] = { filename, glyph_ids, NULL }; if (! PyArg_ParseTupleAndKeywords (args, kwds, - s|O:convert_ttf_to_ps, kwlist, + s|O:convert_ttf_to_ps, (char **)kwlist, filename, pyiterable_to_vector_int, glyph_ids)) Modified: trunk/matplotlib/src/ft2font.cpp === --- trunk/matplotlib/src/ft2font.cpp2007-08-02 19:07:02 UTC (rev 3667) +++ trunk/matplotlib/src/ft2font.cpp2007-08-02 21:32:30 UTC (rev 3668) @@ -1370,8 +1370,8 @@ std::string tagname = Py::String(args[0]); int tag; - char *tags[] = {head, maxp, OS/2, hhea, - vhea, post, pclt, NULL}; + static const char *tags[] = {head, maxp, OS/2, hhea, + vhea, post, pclt, NULL}; for (tag=0; tags[tag] != NULL; tag++) if (strcmp(tagname.c_str(), tags[tag]) == 0) Modified: trunk/matplotlib/ttconv/pprdrv_tt.cpp === --- trunk/matplotlib/ttconv/pprdrv_tt.cpp 2007-08-02 19:07:02 UTC (rev 3667) +++ trunk/matplotlib/ttconv/pprdrv_tt.cpp 2007-08-02 21:32:30 UTC (rev 3668) @@ -107,7 +107,7 @@ ** is always 4 characters, though the last characters may be ** padding spaces. ---*/ -BYTE *GetTable(struct TTFONT *font, char *name) +BYTE *GetTable(struct TTFONT *font, const char *name) { BYTE *ptr; ULONG x; @@ -654,7 +654,7 @@ */ void ttfont_sfnts(TTStreamWriter stream, struct TTFONT *font) { -char *table_names[]= /* The names of all tables */ +const char *table_names[]= /* The names of all tables */ { /* which it is worth while */ cvt , /* to include in a Type 42 */ fpgm, /* PostScript font. */ @@ -828,7 +828,7 @@ ** this array will instead convert PostScript character names ** to executable proceedures. --*/ -char *Apple_CharStrings[]={ +const char *Apple_CharStrings[]={ .notdef,.null,nonmarkingreturn,space,exclam,quotedbl,numbersign, dollar,percent,ampersand,quotesingle,parenleft,parenright, asterisk,plus, comma,hyphen,period,slash,zero,one,two, @@ -871,7 +871,7 @@ ** This routine is called by the one below. ** It is also called from pprdrv_tt2.c */ -char *ttfont_CharStrings_getname(struct TTFONT *font, int charindex) +const char *ttfont_CharStrings_getname(struct TTFONT *font, int charindex) { int GlyphIndex; static char temp[80]; @@ -1227,7 +1227,7 @@ i != glyph_ids.end(); ++i) { StringStreamWriter writer; tt_type3_charproc(writer, font, *i); - char* name = ttfont_CharStrings_getname(font, *i); + const char* name = ttfont_CharStrings_getname(font, *i); dict.add_pair(name, writer.str().c_str()); } } Modified: trunk/matplotlib/ttconv/truetype.h === --- trunk/matplotlib/ttconv/truetype.h 2007-08-02 19:07:02 UTC (rev 3667) +++ trunk/matplotlib/ttconv/truetype.h 2007-08-02 21:32:30 UTC (rev 3668) @@ -51,13 +51,13 @@ font_type_enum target_type; /* 42 or 3 for PS, or -3 for PDF */ ULONG numTables; /* number of tables present */ -char *PostName;/* Font's PostScript name */ -char *FullName;/* Font's full name */ -char *FamilyName; /* Font's family name
SF.net SVN: matplotlib: [3669] trunk/matplotlib
Revision: 3669 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3669view=rev Author: mdboom Date: 2007-08-02 15:49:01 -0700 (Thu, 02 Aug 2007) Log Message: --- Reverting last change since it breaks on gcc-4.2 Modified Paths: -- trunk/matplotlib/src/_ttconv.cpp trunk/matplotlib/src/ft2font.cpp trunk/matplotlib/ttconv/pprdrv_tt.cpp trunk/matplotlib/ttconv/truetype.h Modified: trunk/matplotlib/src/_ttconv.cpp === --- trunk/matplotlib/src/_ttconv.cpp2007-08-02 21:32:30 UTC (rev 3668) +++ trunk/matplotlib/src/_ttconv.cpp2007-08-02 22:49:01 UTC (rev 3669) @@ -83,10 +83,10 @@ int fonttype; std::vectorint glyph_ids; - static const char *kwlist[] = { filename, output, fonttype, glyph_ids, NULL }; + static char *kwlist[] = { filename, output, fonttype, glyph_ids, NULL }; if (! PyArg_ParseTupleAndKeywords (args, kwds, - sOi|O:convert_ttf_to_ps, (char **)kwlist, + sOi|O:convert_ttf_to_ps, kwlist, filename, fileobject_to_PythonFileWriter, output, @@ -140,10 +140,10 @@ std::vectorint glyph_ids; PyObject* result; - static const char *kwlist[] = { filename, glyph_ids, NULL }; + static char *kwlist[] = { filename, glyph_ids, NULL }; if (! PyArg_ParseTupleAndKeywords (args, kwds, - s|O:convert_ttf_to_ps, (char **)kwlist, + s|O:convert_ttf_to_ps, kwlist, filename, pyiterable_to_vector_int, glyph_ids)) Modified: trunk/matplotlib/src/ft2font.cpp === --- trunk/matplotlib/src/ft2font.cpp2007-08-02 21:32:30 UTC (rev 3668) +++ trunk/matplotlib/src/ft2font.cpp2007-08-02 22:49:01 UTC (rev 3669) @@ -1370,8 +1370,8 @@ std::string tagname = Py::String(args[0]); int tag; - static const char *tags[] = {head, maxp, OS/2, hhea, - vhea, post, pclt, NULL}; + char *tags[] = {head, maxp, OS/2, hhea, + vhea, post, pclt, NULL}; for (tag=0; tags[tag] != NULL; tag++) if (strcmp(tagname.c_str(), tags[tag]) == 0) Modified: trunk/matplotlib/ttconv/pprdrv_tt.cpp === --- trunk/matplotlib/ttconv/pprdrv_tt.cpp 2007-08-02 21:32:30 UTC (rev 3668) +++ trunk/matplotlib/ttconv/pprdrv_tt.cpp 2007-08-02 22:49:01 UTC (rev 3669) @@ -107,7 +107,7 @@ ** is always 4 characters, though the last characters may be ** padding spaces. ---*/ -BYTE *GetTable(struct TTFONT *font, const char *name) +BYTE *GetTable(struct TTFONT *font, char *name) { BYTE *ptr; ULONG x; @@ -654,7 +654,7 @@ */ void ttfont_sfnts(TTStreamWriter stream, struct TTFONT *font) { -const char *table_names[]= /* The names of all tables */ +char *table_names[]= /* The names of all tables */ { /* which it is worth while */ cvt , /* to include in a Type 42 */ fpgm, /* PostScript font. */ @@ -828,7 +828,7 @@ ** this array will instead convert PostScript character names ** to executable proceedures. --*/ -const char *Apple_CharStrings[]={ +char *Apple_CharStrings[]={ .notdef,.null,nonmarkingreturn,space,exclam,quotedbl,numbersign, dollar,percent,ampersand,quotesingle,parenleft,parenright, asterisk,plus, comma,hyphen,period,slash,zero,one,two, @@ -871,7 +871,7 @@ ** This routine is called by the one below. ** It is also called from pprdrv_tt2.c */ -const char *ttfont_CharStrings_getname(struct TTFONT *font, int charindex) +char *ttfont_CharStrings_getname(struct TTFONT *font, int charindex) { int GlyphIndex; static char temp[80]; @@ -1227,7 +1227,7 @@ i != glyph_ids.end(); ++i) { StringStreamWriter writer; tt_type3_charproc(writer, font, *i); - const char* name = ttfont_CharStrings_getname(font, *i); + char* name = ttfont_CharStrings_getname(font, *i); dict.add_pair(name, writer.str().c_str()); } } Modified: trunk/matplotlib/ttconv/truetype.h === --- trunk/matplotlib/ttconv/truetype.h 2007-08-02 21:32:30 UTC (rev 3668) +++ trunk/matplotlib/ttconv/truetype.h 2007-08-02 22:49:01 UTC (rev 3669) @@ -51,13 +51,13 @@ font_type_enum target_type; /* 42 or 3 for PS, or -3 for PDF */ ULONG numTables; /* number of tables present */ -const char *PostName; /* Font's PostScript name */ -const char *FullName; /* Font's full name */ -const char *FamilyName;/* Font's family name */ -const char *Style; /* Font's style string */ -const
SF.net SVN: matplotlib: [3675] trunk/matplotlib/lib/matplotlib/backends/ backend_svg.py
Revision: 3675 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3675view=rev Author: mdboom Date: 2007-08-06 11:50:00 -0700 (Mon, 06 Aug 2007) Log Message: --- Fix bug when rendering special XML characters (such as ) in SVG Modified Paths: -- trunk/matplotlib/lib/matplotlib/backends/backend_svg.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_svg.py === --- trunk/matplotlib/lib/matplotlib/backends/backend_svg.py 2007-08-06 18:49:19 UTC (rev 3674) +++ trunk/matplotlib/lib/matplotlib/backends/backend_svg.py 2007-08-06 18:50:00 UTC (rev 3675) @@ -11,6 +11,8 @@ from matplotlib.ft2font import FT2Font, KERNING_UNFITTED, KERNING_DEFAULT, KERNING_UNSCALED from matplotlib.mathtext import math_parse_s_ft2font_svg +from xml.sax.saxutils import escape as escape_xml_text + backend_version = __version__ def new_figure_manager(num, *args, **kwargs): @@ -239,7 +241,7 @@ font = self._get_font(prop) -thetext = '%s' % s +thetext = escape_xml_text(s) fontfamily = font.family_name fontstyle = font.style_name fontsize = prop.get_size_in_points() @@ -369,10 +371,7 @@ curr_x,curr_y = 0.0,0.0 for font, fontsize, thetext, new_x, new_y_mtc, metrics in svg_glyphs: -if rcParams[mathtext.mathtext2]: -new_y = new_y_mtc - height -else: -new_y = - new_y_mtc +new_y = - new_y_mtc svg.append('tspan style=font-size: %f; font-family: %s' % (fontsize, font.family_name)) @@ -387,6 +386,8 @@ if dy != 0.0: svg.append(' dy=%f' % dy) +thetext = escape_xml_text(thetext) + svg.append('%s/tspan\n' % thetext) curr_x = new_x + xadvance This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3681] trunk/matplotlib/src/ft2font.cpp
Revision: 3681 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3681view=rev Author: mdboom Date: 2007-08-07 10:39:57 -0700 (Tue, 07 Aug 2007) Log Message: --- Fix bug with PDF non-math text Modified Paths: -- trunk/matplotlib/src/ft2font.cpp Modified: trunk/matplotlib/src/ft2font.cpp === --- trunk/matplotlib/src/ft2font.cpp2007-08-07 15:29:25 UTC (rev 3680) +++ trunk/matplotlib/src/ft2font.cpp2007-08-07 17:39:57 UTC (rev 3681) @@ -56,7 +56,7 @@ setattr(height, Py::Int( face-glyph-metrics.height) ); setattr(horiBearingX, Py::Int( face-glyph-metrics.horiBearingX / HORIZ_HINTING) ); setattr(horiBearingY, Py::Int( face-glyph-metrics.horiBearingY) ); - setattr(horiAdvance, Py::Int( face-glyph-metrics.horiAdvance / HORIZ_HINTING) ); + setattr(horiAdvance, Py::Int( face-glyph-metrics.horiAdvance) ); setattr(linearHoriAdvance, Py::Int( face-glyph-linearHoriAdvance / HORIZ_HINTING) ); setattr(vertBearingX, Py::Int( face-glyph-metrics.vertBearingX) ); @@ -697,7 +697,7 @@ FT_Vector delta; if (!FT_Get_Kerning( face, left, right, mode, delta )) { -return Py::Int(delta.x / HORIZ_HINTING); +return Py::Int(delta.x); } else { return Py::Int(0); @@ -775,7 +775,7 @@ FT_Vector delta; FT_Get_Kerning( face, previous, glyph_index, FT_KERNING_DEFAULT, delta ); - pen.x += delta.x / HORIZ_HINTING; + pen.x += delta.x; } error = FT_Load_Glyph( face, glyph_index, flags ); if ( error ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3683] trunk/matplotlib/lib/matplotlib
Revision: 3683 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3683view=rev Author: mdboom Date: 2007-08-08 09:44:38 -0700 (Wed, 08 Aug 2007) Log Message: --- Improve font manager so default font names like serif, sans-serif etc. are looked for across all fonts in that mapping, not just a single hard-coded one. Add DejaVu fonts as an alternative to Vera fonts if present. Fix how mathtext non-Computer Modern fonts are specified. Modified Paths: -- trunk/matplotlib/lib/matplotlib/font_manager.py trunk/matplotlib/lib/matplotlib/rcsetup.py Modified: trunk/matplotlib/lib/matplotlib/font_manager.py === --- trunk/matplotlib/lib/matplotlib/font_manager.py 2007-08-07 17:47:30 UTC (rev 3682) +++ trunk/matplotlib/lib/matplotlib/font_manager.py 2007-08-08 16:44:38 UTC (rev 3683) @@ -477,24 +477,6 @@ except: continue add_filename(fontdict, prop, fpath) - -# Default font algorithm needs improvement -if prop.name.lower() in ['bitstream vera serif', 'times']: -prop.name = 'serif' -add_filename(fontdict, prop, fpath) -elif prop.name.lower() in ['bitstream vera sans', 'helvetica']: -prop.name = 'sans-serif' -add_filename(fontdict, prop, fpath) -elif prop.name.lower() in ['zapf chancery', 'itc zapf chancery']: -prop.name = 'cursive' -add_filename(fontdict, prop, fpath) -elif prop.name.lower() in ['western', 'itc avant garde gothic']: -prop.name = 'fantasy' -add_filename(fontdict, prop, fpath) -elif prop.name.lower() in ['bitstream vera sans mono', 'courier']: -prop.name = 'monospace' -add_filename(fontdict, prop, fpath) - return fontdict def setWeights(font): @@ -868,6 +850,13 @@ break verbose.report('loaded ttfcache file %s'%ttfcache) +def flatten(d, path): +if isinstance(d, dict): +for key, val in d.items(): +flatten(val, path + [key]) +elif isinstance(d, str): +print path, os.path.basename(d) +flatten(self.ttfdict, []) #self.ttfdict = createFontDict(self.ttffiles) # Load AFM fonts for PostScript @@ -928,74 +917,99 @@ else: fontdict = self.ttfdict -name= prop.get_family()[0] -style = prop.get_style() -variant = prop.get_variant() -weight = weight_as_number(prop.get_weight()) -stretch = prop.get_stretch() -size= str(prop.get_size_in_points()) +original_name = prop.get_family()[0] +style = prop.get_style() +variant = prop.get_variant() +weight= weight_as_number(prop.get_weight()) +stretch = prop.get_stretch() +size = str(prop.get_size_in_points()) -try: -fname = fontdict[name][style][variant][weight][stretch][size] -verbose.report('\tfindfont cached %(name)s, %(style)s, %(variant)s, %(weight)s, %(stretch)s, %(size)s'%locals(), 'debug') -verbose.report('findfont returning %s'%fname, 'debug') -return fname -except KeyError: -pass +def lookup_name(name): +try: +fname = fontdict[name][style][variant][weight][stretch][size] +verbose.report('\tfindfont cached %(name)s, %(style)s, %(variant)s, %(weight)s, %(stretch)s, %(size)s'%locals(), 'debug') +verbose.report('findfont returning %s'%fname, 'debug') +return fname +except KeyError: +pass -for name in prop.get_family(): +fname = None font = fontdict +print font.keys() if font.has_key(name): font = font[name] else: verbose.report('\tfindfont failed %(name)s'%locals(), 'debug') -continue +return None +print font.keys() if font.has_key(style): font = font[style] -elif style == 'italics' and font.has_key('oblique'): +elif style == 'italic' and font.has_key('oblique'): font = font['oblique'] +elif style == 'oblique' and font.has_key('italic'): +font = font['italic'] else: verbose.report('\tfindfont failed %(name)s, %(style)s'%locals(), 'debug') -continue +return None if font.has_key(variant): font = font[variant] else: verbose.report('\tfindfont failed %(name)s, %(style)s, %(variant)s'%locals(), 'debug') -continue +return None
SF.net SVN: matplotlib: [3684] trunk/matplotlib/lib/matplotlib/backends/ backend_pdf.py
Revision: 3684 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3684view=rev Author: mdboom Date: 2007-08-08 09:46:54 -0700 (Wed, 08 Aug 2007) Log Message: --- Add support for fonts with more than 256 codepoints in PDF backend. This currently only works when pdf.fonttype == 42. (It doesn't seem possible to have a CID-keyed Type 3 font in PDF, so some hacky solution will have to be developed.) 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-08-08 16:44:38 UTC (rev 3683) +++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2007-08-08 16:46:54 UTC (rev 3684) @@ -28,7 +28,7 @@ from matplotlib.font_manager import fontManager from matplotlib.afm import AFM from matplotlib.dviread import Dvi -from matplotlib.ft2font import FT2Font, FIXED_WIDTH, ITALIC, LOAD_NO_SCALE, LOAD_NO_HINTING +from matplotlib.ft2font import FT2Font, FIXED_WIDTH, ITALIC, LOAD_NO_SCALE from matplotlib.mathtext import math_parse_s_pdf from matplotlib.transforms import Bbox from matplotlib import ttconv @@ -491,124 +491,52 @@ # boxes and the like if value 0: return floor(value) else: return ceil(value) - -# You are lost in a maze of TrueType tables, all different... -ps_name = Name(font.get_sfnt()[(1,0,0,6)]) -pclt = font.get_sfnt_table('pclt') \ -or { 'capHeight': 0, 'xHeight': 0 } -post = font.get_sfnt_table('post') \ -or { 'italicAngle': (0,0) } -ff = font.face_flags -sf = font.style_flags - -# Get widths for the 256 characters of PDF encoding WinAnsiEncoding (similar to -# Python encoding cp1252). According to the PDF Reference, a simple font, based on -# single-byte characters, can't manage more than 256 characters, contrary to a -# composite font, based on multi-byte characters. - -from encodings import cp1252 -# The decoding_map was changed to a decoding_table as of Python 2.5. -if hasattr(cp1252, 'decoding_map'): -def decode_char(charcode): -return cp1252.decoding_map[charcode] or 0 -else: -def decode_char(charcode): -return ord(cp1252.decoding_table[charcode]) - -def get_char_width(charcode): -unicode = decode_char(charcode) -width = font.load_char(unicode, flags=LOAD_NO_SCALE|LOAD_NO_HINTING).horiAdvance -return cvt(width) - -firstchar, lastchar = 0, 255 -widths = [ get_char_width(charcode) for charcode in range(firstchar, lastchar+1) ] -font_bbox = [ cvt(x, nearest=False) for x in font.bbox ] - -widthsObject = self.reserveObject('font widths') -fontdescObject = self.reserveObject('font descriptor') -# TODO: WinAnsiEncoding could become a parameter of PdfFile. The PDF encoding -# WinAnsiEncoding matches the Python enconding cp1252 used in method -# RendererPdf.draw_text and RendererPdf.get_text_width_height to encode Unicode strings. -fontdict = { 'Type': Name('Font'), - 'BaseFont': ps_name, - 'FirstChar': firstchar, - 'LastChar': lastchar, - 'Widths': widthsObject, - 'FontDescriptor': fontdescObject } - -if fonttype == 3: + +def embedTTFType3(font, characters, descriptor): +The Type 3-specific part of embedding a Truetype font +widthsObject = self.reserveObject('font widths') +fontdescObject = self.reserveObject('font descriptor') +fontdictObject = self.reserveObject('font dictionary') charprocsObject = self.reserveObject('character procs') differencesArray = [] -fontdict['Subtype'] = Name('Type3') -fontdict['Name'] = ps_name -fontdict['FontBBox'] = font_bbox -fontdict['FontMatrix'] = [ .001, 0, 0, .001, 0, 0 ] -fontdict['CharProcs'] = charprocsObject -fontdict['Encoding'] = { -'Type': Name('Encoding'), -'Differences': differencesArray} -elif fonttype == 42: -fontdict['Subtype'] = Name('TrueType') -fontdict['Encoding'] = Name('WinAnsiEncoding') +firstchar, lastchar = 0, 255 + +fontdict = { +'Type': Name('Font'), +'BaseFont': ps_name, +'FirstChar' : firstchar, +'LastChar': lastchar, +'FontDescriptor' : fontdescObject, +'Subtype' : Name('Type3'), +'Name
SF.net SVN: matplotlib: [3688] trunk/matplotlib/examples/mathtext_demo.py
Revision: 3688 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3688view=rev Author: mdboom Date: 2007-08-08 11:48:49 -0700 (Wed, 08 Aug 2007) Log Message: --- Fix mathtext_demo to use markup=tex kwarg. Modified Paths: -- trunk/matplotlib/examples/mathtext_demo.py Modified: trunk/matplotlib/examples/mathtext_demo.py === --- trunk/matplotlib/examples/mathtext_demo.py 2007-08-08 17:41:30 UTC (rev 3687) +++ trunk/matplotlib/examples/mathtext_demo.py 2007-08-08 18:48:49 UTC (rev 3688) @@ -13,8 +13,8 @@ x = npy.arange(0.0, 3.0, 0.1) ax.grid(True) -ax.set_xlabel(r'$\Delta_i^j$', fontsize=20) -ax.set_ylabel(r'$\Delta_{i+1}^j$', fontsize=20) +ax.set_xlabel(r'$\Delta_i^j$', fontsize=20, markup=tex) +ax.set_ylabel(r'$\Delta_{i+1}^j$', fontsize=20, markup=tex) tex = r'$\mathcal{R}\prod_{i=\alpha_{i+1}}^\infty a_i\sin(2 \pi f x_i)$' ax.text(1, 1.6, tex, fontsize=20, va='bottom', markup=tex) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3695] trunk/matplotlib/lib/matplotlib/backends/ backend_pdf.py
Revision: 3695 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3695view=rev Author: mdboom Date: 2007-08-09 08:14:59 -0700 (Thu, 09 Aug 2007) Log Message: --- Minor PDF filesize improvement. 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-08-09 15:14:28 UTC (rev 3694) +++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2007-08-09 15:14:59 UTC (rev 3695) @@ -508,6 +508,7 @@ charprocsObject = self.reserveObject('character procs') differencesArray = [] firstchar, lastchar = 0, 255 +bbox = [cvt(x, nearest=False) for x in font.bbox] fontdict = { 'Type': Name('Font'), @@ -517,7 +518,7 @@ 'FontDescriptor' : fontdescObject, 'Subtype' : Name('Type3'), 'Name': descriptor['FontName'], -'FontBBox': [cvt(x, nearest=False) for x in font.bbox], +'FontBBox': bbox, 'FontMatrix' : [ .001, 0, 0, .001, 0, 0 ], 'CharProcs' : charprocsObject, 'Encoding': { @@ -575,15 +576,18 @@ charprocs = {} charprocsRef = {} for charname, stream in rawcharprocs.items(): +charprocDict = { 'Length': len(stream) } +# The 2-byte characters are used as XObjects, so they +# need extra info in their dictionary +if charname in two_byte_chars: +charprocDict['Type'] = Name('XObject') +charprocDict['Subtype'] = Name('Form') +charprocDict['BBox'] = bbox charprocObject = self.reserveObject('charProc for %s' % name) -self.beginStream(charprocObject.id, - None, - {'Length': len(stream), - 'Type': Name('XObject'), - 'Subtype': Name('Form'), - 'BBox': [cvt(x, nearest=False) for x in font.bbox]}) +self.beginStream(charprocObject.id, None, charprocDict) self.currentstream.write(stream) self.endStream() + # Send the glyphs with ccode 255 to the XObject dictionary, # and the others to the font itself if charname in two_byte_chars: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3702] trunk/matplotlib/lib/matplotlib/backends/ backend_cairo.py
Revision: 3702 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3702view=rev Author: mdboom Date: 2007-08-13 05:46:26 -0700 (Mon, 13 Aug 2007) Log Message: --- Removed obsolete comment. Modified Paths: -- trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py === --- trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py 2007-08-12 07:21:47 UTC (rev 3701) +++ trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py 2007-08-13 12:46:26 UTC (rev 3702) @@ -302,7 +302,6 @@ def _draw_mathtext(self, gc, x, y, s, prop, angle): if _debug: print '%s.%s()' % (self.__class__.__name__, _fn_name()) -# mathtext using the gtk/gdk method ctx = gc.ctx width, height, glyphs, rects = math_parse_s_cairo( This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3717] trunk/matplotlib/lib/matplotlib/backends/ backend_gtkcairo.py
Revision: 3717 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3717view=rev Author: mdboom Date: 2007-08-20 05:47:42 -0700 (Mon, 20 Aug 2007) Log Message: --- Take a version check out of the method call. Thanks to Fernando Perez. Modified Paths: -- trunk/matplotlib/lib/matplotlib/backends/backend_gtkcairo.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gtkcairo.py === --- trunk/matplotlib/lib/matplotlib/backends/backend_gtkcairo.py 2007-08-20 12:46:53 UTC (rev 3716) +++ trunk/matplotlib/lib/matplotlib/backends/backend_gtkcairo.py 2007-08-20 12:47:42 UTC (rev 3717) @@ -29,12 +29,14 @@ class RendererGTKCairo (backend_cairo.RendererCairo): -def set_pixmap (self, pixmap): -if gtk.pygtk_version = (2,7,0): +if gtk.pygtk_version = (2,7,0): +def set_pixmap (self, pixmap): self.ctx = pixmap.cairo_create() -else: +self.ctx.save() # restore, save - when call new_gc() +else: +def set_pixmap (self, pixmap): self.ctx = cairo.gtk.gdk_cairo_create (pixmap) -self.ctx.save() # restore, save - when call new_gc() +self.ctx.save() # restore, save - when call new_gc() class FigureCanvasGTKCairo(FigureCanvasGTK): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3722] trunk/matplotlib/lib/matplotlib
Revision: 3722 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3722view=rev Author: mdboom Date: 2007-08-21 08:19:04 -0700 (Tue, 21 Aug 2007) Log Message: --- Prevent the mathtext cache from getting out of hand, by clearing it after every plot. Modified Paths: -- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py trunk/matplotlib/lib/matplotlib/backends/backend_agg2.py trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py trunk/matplotlib/lib/matplotlib/backends/backend_ps.py trunk/matplotlib/lib/matplotlib/backends/backend_qt.py trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py trunk/matplotlib/lib/matplotlib/backends/backend_svg.py trunk/matplotlib/lib/matplotlib/mathtext.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py === --- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2007-08-21 15:13:49 UTC (rev 3721) +++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2007-08-21 15:19:04 UTC (rev 3722) @@ -83,7 +83,7 @@ from matplotlib.figure import Figure from matplotlib.font_manager import findfont from matplotlib.ft2font import FT2Font, LOAD_DEFAULT -from matplotlib.mathtext import math_parse_s_ft2font +from matplotlib.mathtext import MathTextParser from matplotlib.transforms import lbwh_to_bbox from _backend_agg import RendererAgg as _RendererAgg @@ -125,8 +125,8 @@ self.copy_from_bbox = self._renderer.copy_from_bbox self.restore_region = self._renderer.restore_region +self.mathtext_parser = MathTextParser('Agg') - self.bbox = lbwh_to_bbox(0,0, self.width, self.height) if __debug__: verbose.report('RendererAgg.__init__ done', 'debug-annoying') @@ -173,7 +173,7 @@ if __debug__: verbose.report('RendererAgg.draw_mathtext', 'debug-annoying') -width, height, fonts, used_characters = math_parse_s_ft2font( +width, height, fonts, used_characters = self.mathtext_parser.parse( s, self.dpi.get(), prop) if angle == 90: @@ -230,7 +230,7 @@ return n,m if ismath: -width, height, fonts, used_characters = math_parse_s_ft2font( +width, height, fonts, used_characters = self.mathtext_parser.parse( s, self.dpi.get(), prop) return width, height font = self._get_agg_font(prop) Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg2.py === --- trunk/matplotlib/lib/matplotlib/backends/backend_agg2.py2007-08-21 15:13:49 UTC (rev 3721) +++ trunk/matplotlib/lib/matplotlib/backends/backend_agg2.py2007-08-21 15:19:04 UTC (rev 3722) @@ -16,7 +16,7 @@ from matplotlib.cbook import enumerate, is_string_like, exception_to_str from matplotlib.figure import Figure from matplotlib.ft2font import FT2Font -from matplotlib.mathtext import math_parse_s_ft2font +from matplotlib.mathtext import MathTextParser from _backend_agg import RendererAgg as _RendererAgg Modified: trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py === --- trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py 2007-08-21 15:13:49 UTC (rev 3721) +++ trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py 2007-08-21 15:19:04 UTC (rev 3722) @@ -38,7 +38,7 @@ FigureManagerBase, FigureCanvasBase from matplotlib.cbookimport enumerate, izip from matplotlib.figure import Figure -from matplotlib.mathtext import math_parse_s_cairo +from matplotlib.mathtext import MathTextParser from matplotlib.transforms import Bbox from matplotlib.font_manager import ttfFontProperty from matplotlib import rcParams @@ -92,8 +92,8 @@ self.dpi = dpi self.text_ctx = cairo.Context ( cairo.ImageSurface (cairo.FORMAT_ARGB32,1,1)) +self.mathtext_parser = MathTextParser('Cairo') - def set_ctx_from_surface (self, surface): self.ctx = cairo.Context (surface) self.ctx.save() # restore, save - when call new_gc() @@ -304,7 +304,7 @@ if _debug: print '%s.%s()' % (self.__class__.__name__, _fn_name()) ctx = gc.ctx -width, height, glyphs, rects = math_parse_s_cairo( +width, height, glyphs, rects = self.mathtext_parser.parse( s, self.dpi.get(), prop) ctx.save() @@ -352,7 +352,7 @@ def get_text_width_height(self, s, prop, ismath): if _debug: print '%s.%s()' % (self.__class__.__name__, _fn_name()) if ismath: -width, height, fonts, used_characters = math_parse_s_cairo
SF.net SVN: matplotlib: [3723] trunk/matplotlib/src/_ttconv.cpp
Revision: 3723 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3723view=rev Author: mdboom Date: 2007-08-21 08:24:26 -0700 (Tue, 21 Aug 2007) Log Message: --- Fix docstring Modified Paths: -- trunk/matplotlib/src/_ttconv.cpp Modified: trunk/matplotlib/src/_ttconv.cpp === --- trunk/matplotlib/src/_ttconv.cpp2007-08-21 15:19:04 UTC (rev 3722) +++ trunk/matplotlib/src/_ttconv.cpp2007-08-21 15:24:26 UTC (rev 3723) @@ -195,12 +195,12 @@ get_pdf_charprocs(filename, glyph_ids)\n \n Given a Truetype font file, returns a dictionary containing the PDF Type 3\n - representation of its path. Useful for subsetting a Truetype font inside\n + representation of its paths. Useful for subsetting a Truetype font inside\n of a PDF file.\n \n filename is the path to a TTF font file.\n glyph_ids is a list of the numeric glyph ids to include.\n - The return value is a dictionary where the keys are glyph names and \n + The return value is a dictionary where the keys are glyph names and\n the values are the stream content needed to render that glyph. This\n is useful to generate the CharProcs dictionary in a PDF Type 3 font.\n }, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3724] trunk/matplotlib
Revision: 3724 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3724view=rev Author: mdboom Date: 2007-08-21 10:25:57 -0700 (Tue, 21 Aug 2007) Log Message: --- Making parser more robust -- will only accept valid symbol names. (Re-)adding \hspace{ } command. Modified Paths: -- trunk/matplotlib/examples/mathtext_examples.py trunk/matplotlib/lib/matplotlib/_mathtext_data.py trunk/matplotlib/lib/matplotlib/mathtext.py Modified: trunk/matplotlib/examples/mathtext_examples.py === --- trunk/matplotlib/examples/mathtext_examples.py 2007-08-21 15:24:26 UTC (rev 3723) +++ trunk/matplotlib/examples/mathtext_examples.py 2007-08-21 17:25:57 UTC (rev 3724) @@ -9,7 +9,7 @@ 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$', +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)$', Modified: trunk/matplotlib/lib/matplotlib/_mathtext_data.py === --- trunk/matplotlib/lib/matplotlib/_mathtext_data.py 2007-08-21 15:24:26 UTC (rev 3723) +++ trunk/matplotlib/lib/matplotlib/_mathtext_data.py 2007-08-21 17:25:57 UTC (rev 3724) @@ -1763,7 +1763,6 @@ 'Theta': 920, 'origof': 8886, 'blacksquare': 9632, -'hspace': 8202, 'solbar': 9023, 'neg': 172, 'sum': 8721, Modified: trunk/matplotlib/lib/matplotlib/mathtext.py === --- trunk/matplotlib/lib/matplotlib/mathtext.py 2007-08-21 15:24:26 UTC (rev 3723) +++ trunk/matplotlib/lib/matplotlib/mathtext.py 2007-08-21 17:25:57 UTC (rev 3724) @@ -1750,12 +1750,10 @@ _overunder_symbols = Set(r''' \sum \prod \coprod \bigcap \bigcup \bigsqcup \bigvee \bigwedge \bigodot \bigotimes \bigoplus \biguplus - '''.split() -) + '''.split()) _overunder_functions = Set( -rlim liminf limsup sup max min.split() -) +rlim liminf limsup sup max min.split()) _dropsub_symbols = Set(r'''\int \oint'''.split()) @@ -1769,11 +1767,13 @@ autoDelim = Forward().setParseAction(self.auto_sized_delimiter) self._expression = Forward().setParseAction(self.finish).setName(finish) +float= Regex(r-?[0-9]+\.?[0-9]*) + lbrace = Literal('{').suppress() rbrace = Literal('}').suppress() start_group = (Optional(latexfont) + lbrace) start_group.setParseAction(self.start_group) -end_group= rbrace +end_group= rbrace.copy() end_group.setParseAction(self.end_group) bslash = Literal('\\') @@ -1786,15 +1786,9 @@ cosh gcd ln sup cot hom log tan coth inf max tanh) -number = Combine(Word(nums) + Optional(Literal('.')) + Optional( Word(nums) )) - fontname = oneOf(rm cal it tt sf bf) latex2efont = oneOf(mathrm mathcal mathit mathtt mathsf mathbf) -texsym = Combine(bslash + Word(alphanums) + NotAny({)) - -char = Word(alphanums + ' ', exact=1).leaveWhitespace() - space=(FollowedBy(bslash) + (Literal(r'\ ') | Literal(r'\/') @@ -1806,19 +1800,18 @@ ) ).setParseAction(self.space).setName('space') -symbol = Regex(( + )|(.join( - [ - r\\(?!quad)(?!qquad)(?!left[^a-z])(?!right[^a-z])[a-zA-Z0-9]+(?!{), - r[a-zA-Z0-9 ], - r[+\-*/], - r[=], - r[:,.;!'@[()], - r\\[$%{}], - ]) - + ) - ).setParseAction(self.symbol).leaveWhitespace() +customspace =(Literal(r'\hspace') + + lbrace + + float + + rbrace + ).setParseAction(self.customspace).setName('customspace') -rightBracket = Literal([).setParseAction(self.symbol).leaveWhitespace() +symbol =(Regex(r[a-zA-Z0-9 +\-*/=:,.;!'@()[\]]) + ^ Combine( + bslash ++ oneOf(tex2uni.keys()) +) + ).setParseAction(self.symbol).leaveWhitespace() accent = Group( Combine(bslash + accent) @@ -1873,13 +1866,13 @@ placeable (accent ^ function ^ symbol - ^ rightBracket ^ group
SF.net SVN: matplotlib: [3740] trunk/matplotlib/lib/matplotlib/mathtext.py
Revision: 3740 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3740view=rev Author: mdboom Date: 2007-08-27 12:32:38 -0700 (Mon, 27 Aug 2007) Log Message: --- Better mathtext error messages. Fix bug when using \sqrt without explicit root. Modified Paths: -- trunk/matplotlib/lib/matplotlib/mathtext.py Modified: trunk/matplotlib/lib/matplotlib/mathtext.py === --- trunk/matplotlib/lib/matplotlib/mathtext.py 2007-08-27 18:51:22 UTC (rev 3739) +++ trunk/matplotlib/lib/matplotlib/mathtext.py 2007-08-27 19:32:38 UTC (rev 3740) @@ -1932,7 +1932,14 @@ def parse(self, s, fonts_object, fontsize, dpi): self._state_stack = [self.State(fonts_object, 'default', fontsize, dpi)] -self._expression.parseString(s) +try: +self._expression.parseString(s) +except ParseException, err: +raise ValueError(\n.join([ +, +err.line, + * (err.column - 1) + ^, +str(err)])) return self._expr # The state of the parser is maintained in a stack. Upon @@ -2155,7 +2162,7 @@ super = next1 sub = next2 else: -raise ParseFatalException(Subscript/superscript sequence is too long.) +raise ParseFatalException(Subscript/superscript sequence is too long. Use braces { } to remove ambiguity.) state = self.get_state() rule_thickness = state.font_output.get_underline_thickness( @@ -2277,7 +2284,7 @@ state.font, state.fontsize, state.dpi) if root is None: -root = Box() +root = Box(0., 0., 0.) else: if not isinstance(root, ParseResults): raise ParseFatalException( This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3761] trunk/matplotlib/lib/matplotlib/backends/ backend_agg.py
Revision: 3761 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3761view=rev Author: mdboom Date: 2007-08-31 08:09:27 -0700 (Fri, 31 Aug 2007) Log Message: --- Fix typo. Modified Paths: -- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py === --- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2007-08-30 19:14:55 UTC (rev 3760) +++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2007-08-31 15:09:27 UTC (rev 3761) @@ -172,7 +172,7 @@ if __debug__: verbose.report('RendererAgg.draw_mathtext', 'debug-annoying') -ox, oy, width, height, descent, fonts, used_characters = \ +ox, oy, width, height, descent, font_image, used_characters = \ self.mathtext_parser.parse(s, self.dpi.get(), prop) if angle == 90: @@ -183,10 +183,9 @@ else: x = int(x) + ox y = int(y) - height + oy -for font in fonts: -if angle == 90: -font.horiz_image_to_vert_image() # -- Rotate -self._renderer.draw_text( font, x, y + 1, gc) +if angle == 90: +font_image.rotate() # -- Rotate 90 deg +self._renderer.draw_text_image(font_image, x, y + 1, gc) if 0: self._renderer.draw_rectangle(gc, None, int(x), @@ -212,7 +211,7 @@ #print x, y, int(x), int(y) -self._renderer.draw_text(font, int(x), int(y) + 1, gc) +self._renderer.draw_text_image(font.get_image(), int(x), int(y) + 1, gc) def get_text_width_height_descent(self, s, prop, ismath, rgb=(0,0,0)): @@ -233,9 +232,9 @@ return n,m if ismath: -ox, oy, width, height, descent, fonts, used_characters = \ +ox, oy, width, height, descent, font_image, used_characters = \ self.mathtext_parser.parse(s, self.dpi.get(), prop) -return width, height, depth +return width, height, descent font = self._get_agg_font(prop) font.set_text(s, 0.0, flags=LOAD_DEFAULT) # the width and height of unrotated string w, h = font.get_width_height() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3776] trunk/matplotlib
Revision: 3776 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3776view=rev Author: mdboom Date: 2007-09-04 12:00:18 -0700 (Tue, 04 Sep 2007) Log Message: --- Add support for arbitrary angles of rotation on mathtext in Agg backend. Uses agg to rotate the raster of the text. Modified Paths: -- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py trunk/matplotlib/lib/matplotlib/backends/backend_ps.py trunk/matplotlib/lib/matplotlib/mathtext.py trunk/matplotlib/src/_backend_agg.cpp trunk/matplotlib/src/ft2font.cpp trunk/matplotlib/src/ft2font.h Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py === --- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2007-09-04 18:19:16 UTC (rev 3775) +++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2007-09-04 19:00:18 UTC (rev 3776) @@ -174,17 +174,10 @@ 'debug-annoying') ox, oy, width, height, descent, font_image, used_characters = \ self.mathtext_parser.parse(s, self.dpi.get(), prop) - -if angle == 90: -width, height = height, width -ox, oy = oy, ox -x = int(x) - width + ox -y = int(y) - height + oy -font_image.rotate() -else: -x = int(x) + ox -y = int(y) - height + oy -self._renderer.draw_text_image(font_image, x, y + 1, gc) + +x = int(x) + ox +y = int(y) - oy +self._renderer.draw_text_image(font_image, x, y + 1, angle, gc) if 0: self._renderer.draw_rectangle(gc, None, int(x), @@ -205,12 +198,14 @@ if len(s) == 1 and ord(s) 127: font.load_char(ord(s), flags=LOAD_DEFAULT) else: -font.set_text(s, angle, flags=LOAD_DEFAULT) +font.set_text(s, 0, flags=LOAD_DEFAULT) font.draw_glyphs_to_bitmap() #print x, y, int(x), int(y) -self._renderer.draw_text_image(font.get_image(), int(x), int(y) + 1, gc) +# We pass '0' for angle here, since is has already been rotated +# (in vector space) in the above call to font.set_text. +self._renderer.draw_text_image(font.get_image(), int(x), int(y) + 1, angle, gc) def get_text_width_height_descent(self, s, prop, ismath, rgb=(0,0,0)): @@ -229,7 +224,7 @@ Z = texmanager.get_rgba(s, size, self.dpi.get(), rgb) m,n,tmp = Z.shape # TODO: descent of TeX text (I am imitating backend_ps here -JKS) -return n, m, m +return n, m, 0 if ismath: ox, oy, width, height, descent, fonts, used_characters = \ Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py === --- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2007-09-04 18:19:16 UTC (rev 3775) +++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2007-09-04 19:00:18 UTC (rev 3776) @@ -275,10 +275,9 @@ l,b,r,t = texmanager.get_ps_bbox(s, fontsize) w = (r-l) h = (t-b) -#print s, w, h # TODO: We need a way to get a good baseline from # text.usetex -return w, h, h +return w, h, 0 if ismath: width, height, descent, pswriter, used_characters = \ Modified: trunk/matplotlib/lib/matplotlib/mathtext.py === --- trunk/matplotlib/lib/matplotlib/mathtext.py 2007-09-04 18:19:16 UTC (rev 3775) +++ trunk/matplotlib/lib/matplotlib/mathtext.py 2007-09-04 19:00:18 UTC (rev 3776) @@ -541,7 +541,7 @@ self.font = font self.charmap = font.get_charmap() self.glyphmap = dict( -[(glyphind, ccode) for ccode, glyphind in self.charmap.items()]) +[(glyphind, ccode) for ccode, glyphind in self.charmap.iteritems()]) def __repr__(self): return repr(self.font) @@ -671,7 +671,7 @@ def __init__(self, *args, **kwargs): TruetypeFonts.__init__(self, *args, **kwargs) if not len(self.fontmap): -for key, val in self._fontmap.items(): +for key, val in self._fontmap.iteritems(): fullpath = os.path.join(self.basepath, val + .ttf) self.fontmap[key] = fullpath self.fontmap[val] = fullpath Modified: trunk/matplotlib/src/_backend_agg.cpp === --- trunk/matplotlib/src/_backend_agg.cpp 2007-09-04 18:19:16 UTC (rev 3775) +++ trunk/matplotlib/src/_backend_agg.cpp 2007-09-04 19:00:18 UTC (rev 3776) @@ -16,6 +16,9 @@ #include agg_scanline_storage_aa.h #include
SF.net SVN: matplotlib: [3785] trunk/matplotlib/src/ft2font.cpp
Revision: 3785 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3785view=rev Author: mdboom Date: 2007-09-05 07:46:14 -0700 (Wed, 05 Sep 2007) Log Message: --- Fix segfault in FT2Font::clear() Modified Paths: -- trunk/matplotlib/src/ft2font.cpp Modified: trunk/matplotlib/src/ft2font.cpp === --- trunk/matplotlib/src/ft2font.cpp2007-09-05 14:03:09 UTC (rev 3784) +++ trunk/matplotlib/src/ft2font.cpp2007-09-05 14:46:14 UTC (rev 3785) @@ -75,6 +75,7 @@ if (width != _width || height != _height) { if (numBytes _width*_height) { delete [] _buffer; + _buffer = NULL; _buffer = new unsigned char [numBytes]; } @@ -781,6 +782,7 @@ args.verify_length(0); delete image; + image = NULL; angle = 0.0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3831] branches/transforms
Revision: 3831 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3831view=rev Author: mdboom Date: 2007-09-11 10:57:47 -0700 (Tue, 11 Sep 2007) Log Message: --- Merged revisions 3824-3830 via svnmerge from http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib r3825 | pkienzle | 2007-09-10 14:45:32 -0400 (Mon, 10 Sep 2007) | 1 line Windows needs binary open flag for font files r3827 | jouni | 2007-09-10 16:31:01 -0400 (Mon, 10 Sep 2007) | 2 lines Better bounding boxes for pdf usetex, including descents. r3828 | jouni | 2007-09-10 16:55:29 -0400 (Mon, 10 Sep 2007) | 2 lines Bugfixes in pdf usetex r3829 | mdboom | 2007-09-11 08:46:27 -0400 (Tue, 11 Sep 2007) | 3 lines Fix bug in PDF clip routine that resulted in the cryptic error message There are too many arguments in Adobe Acrobat. Modified Paths: -- branches/transforms/lib/matplotlib/backends/backend_pdf.py branches/transforms/lib/matplotlib/dviread.py branches/transforms/ttconv/pprdrv_tt.cpp Property Changed: branches/transforms/ Property changes on: branches/transforms ___ Name: svnmerge-integrated - /trunk/matplotlib:1-3823 + /trunk/matplotlib:1-3830 Modified: branches/transforms/lib/matplotlib/backends/backend_pdf.py === --- branches/transforms/lib/matplotlib/backends/backend_pdf.py 2007-09-11 17:56:13 UTC (rev 3830) +++ branches/transforms/lib/matplotlib/backends/backend_pdf.py 2007-09-11 17:57:47 UTC (rev 3831) @@ -519,12 +519,13 @@ ul_position, ul_thickness = font.get_ps_font_info() if fontinfo.encodingfile is not None: -differencesArray = [ Name(ch) for ch in - dviread.Encoding(fontinfo.encodingfile) ] +enc = dviread.Encoding(fontinfo.encodingfile) +widths = [ afmdata.get_width_from_char_name(ch) + for ch in enc ] +differencesArray = [ Name(ch) for ch in enc ] differencesArray = [ 0 ] + differencesArray firstchar = 0 lastchar = len(differencesArray) - 2 -widths = [ 100 for x in range(firstchar,lastchar+1) ] # XXX TODO else: widths = [ None for i in range(256) ] for ch in range(256): @@ -1434,7 +1435,7 @@ fontsize = prop.get_size_in_points() dvifile = texmanager.make_dvi(s, fontsize) dvi = dviread.Dvi(dvifile, 72) -text, boxes = iter(dvi).next() +page = iter(dvi).next() dvi.close() if angle == 0: # avoid rounding errors in common case @@ -1448,7 +1449,7 @@ # Gather font information and do some setup for combining # characters into strings. oldfontnum, seq = None, [] -for x1, y1, fontnum, glyph, width in text: +for x1, y1, fontnum, glyph, width in page.text: if fontnum != oldfontnum: texname, fontsize = dvi.fontinfo(fontnum) fontinfo = self.tex_font_mapping(texname) @@ -1462,8 +1463,8 @@ seq += [('end',)] # Find consecutive text strings with constant x coordinate and -# combine into one string (if needed kern would be less than -# 0.1 points) or several strings interspersed with kerns. +# combine into a sequence of strings and kerns, or just one +# string (if any kerns would be less than 0.1 points). i, curx = 0, 0 while i len(seq)-1: elt, next = seq[i:i+2] @@ -1503,7 +1504,7 @@ boxgc = self.new_gc() boxgc.copy_properties(gc) boxgc.set_linewidth(0) -for x1, y1, h, w in boxes: +for x1, y1, h, w in page.boxes: (x1, y1), (x2, y2), (x3, y3), (x4, y4) = \ mytrans(x1, y1), mytrans(x1+w, y1), \ mytrans(x1+w, y1+h), mytrans(x1, y1+h) @@ -1653,14 +1654,9 @@ fontsize = prop.get_size_in_points() dvifile = texmanager.make_dvi(s, fontsize) dvi = dviread.Dvi(dvifile, 72) -text, boxes = iter(dvi).next() -# TODO: better bounding box -- this is not quite right: -l = min(p[0] for p in text+boxes) -r = max(p[0] for p in text+boxes) + fontsize -b = min(p[1] for p in text+boxes) -t = max(p[1] for p in text+boxes) + fontsize -# (not to even mention finding the baseline) -return r-l, t-b, t-b +page = iter(dvi).next() +dvi.close() +return page.width, page.height, page.descent if ismath: w, h, d, glyphs, rects, used_characters = \ self.mathtext_parser.parse(s, 72, prop) @@ -1837,7 +1833,7 @@ cmds.extend(self.pop
SF.net SVN: matplotlib: [3846] branches/transforms/lib/matplotlib
Revision: 3846 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3846view=rev Author: mdboom Date: 2007-09-13 05:44:16 -0700 (Thu, 13 Sep 2007) Log Message: --- Minor changes -- committing so I can merge again. Modified Paths: -- branches/transforms/lib/matplotlib/affine.py branches/transforms/lib/matplotlib/patches.py branches/transforms/lib/matplotlib/text.py Modified: branches/transforms/lib/matplotlib/affine.py === --- branches/transforms/lib/matplotlib/affine.py2007-09-13 06:29:14 UTC (rev 3845) +++ branches/transforms/lib/matplotlib/affine.py2007-09-13 12:44:16 UTC (rev 3846) @@ -4,7 +4,7 @@ 2007 Michael Droettboom -import numpy as N +import numpy as npy from numpy.linalg import inv from sets import Set @@ -37,7 +37,7 @@ class Bbox(TransformNode): def __init__(self, points): TransformNode.__init__(self) - self._points = N.asarray(points, N.float_) + self._points = npy.asarray(points, npy.float_) self.track = False [EMAIL PROTECTED] @@ -52,7 +52,7 @@ [EMAIL PROTECTED] def from_lbrt(*args): - points = N.array(args, dtype=N.float_).reshape(2, 2) + points = npy.array(args, dtype=npy.float_).reshape(2, 2) return Bbox(points) from_lbrt = staticmethod(from_lbrt) @@ -72,12 +72,15 @@ return 'Bbox(%s)' % repr(self._points) __str__ = __repr__ +def __array__(self): + return self._points + # JDH: the update method will update the box limits from the # existing limits and the new data; it appears here you are just # using the new data. We use an ignore flag to specify whether # you want to include the existing data or not in the update def update_from_data(self, x, y, ignore=True): - self._points = N.array([[x.min(), y.min()], [x.max(), y.max()]], N.float_) + self._points = npy.array([[x.min(), y.min()], [x.max(), y.max()]], npy.float_) self.invalidate() # MGDTODO: Probably a more efficient ways to do this... @@ -150,7 +153,7 @@ self.xmax - self.xmin, self.ymax - self.ymin) def _set_bounds(self, bounds): l,b,w,h = bounds - self._points = N.array([[l, b], [l+w, b+h]], N.float_) + self._points = npy.array([[l, b], [l+w, b+h]], npy.float_) self.invalidate() bounds = property(_get_bounds, _set_bounds) @@ -165,7 +168,7 @@ height = self.height deltaw = (sw * width - width) / 2.0 deltah = (sh * height - height) / 2.0 - a = N.array([[-deltaw, -deltah], [deltaw, deltah]]) + a = npy.array([[-deltaw, -deltah], [deltaw, deltah]]) return Bbox(self._points + a) def contains(self, x, y): @@ -215,7 +218,7 @@ raise TypeError(Can not add Transform to object of type '%s' % type(other)) def transform_point(self, point): - return self.__call__([point])[0] + return self.__call__(npy.asarray([point]))[0] def has_inverse(self): raise NotImplementedError() @@ -229,8 +232,6 @@ def is_affine(self): return False -# MGDTODO: Separate out Affine2DBase / Affine2DConcrete so BlendedAffine and CompositeAffine don't have translate/scale/rotate members - class Affine2DBase(Transform): input_dims = 2 output_dims = 2 @@ -246,7 +247,7 @@ [EMAIL PROTECTED] def _concat(a, b): -return N.dot(b, a) +return npy.dot(b, a) _concat = staticmethod(_concat) def to_values(self): @@ -255,7 +256,7 @@ [EMAIL PROTECTED] def matrix_from_values(a, b, c, d, e, f): - affine = N.zeros((3,3), N.float_) + affine = npy.zeros((3,3), npy.float_) affine[0,] = a, c, e affine[1,] = b, d, f affine[2,2] = 1 @@ -267,7 +268,7 @@ def __call__(self, points): -Applies the transformation to a set of 2D points and +Applies the transformation to an array of 2D points and returns the result. points must be a numpy array of shape (N, 2), where N is the @@ -277,9 +278,9 @@ # the points to an array in the first place. If we can use # more arrays upstream, that should help here. mtx = self.get_matrix() - points = N.asarray(points, N.float_) + points = npy.asarray(points, npy.float_) points = points.transpose() - points = N.dot(mtx[0:2, 0:2], points) + points = npy.dot(mtx[0:2, 0:2], points) points = points + mtx[0:2, 2:] return points.transpose() @@ -311,7 +312,7 @@ Affine2DBase.__init__(self) if matrix is None: - matrix = N.identity(3) + matrix = npy.identity(3) else: assert matrix.shape == (3, 3) self._mtx = matrix @@ -348,19 +349,19 @@ [EMAIL PROTECTED] def identity(): -return
SF.net SVN: matplotlib: [3847] branches/transforms
Revision: 3847 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3847view=rev Author: mdboom Date: 2007-09-13 05:50:05 -0700 (Thu, 13 Sep 2007) Log Message: --- Merged revisions 3836-3846 via svnmerge from http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib r3844 | jdh2358 | 2007-09-12 16:37:41 -0400 (Wed, 12 Sep 2007) | 1 line fixed a bar units bug r3845 | jouni | 2007-09-13 02:29:14 -0400 (Thu, 13 Sep 2007) | 3 lines More work on dviread and usetex in pdf. It is more usable now, so I am renaming the method from _draw_tex to draw_tex. Modified Paths: -- branches/transforms/API_CHANGES branches/transforms/CHANGELOG branches/transforms/lib/matplotlib/artist.py branches/transforms/lib/matplotlib/axes.py branches/transforms/lib/matplotlib/axis.py branches/transforms/lib/matplotlib/backends/backend_pdf.py branches/transforms/lib/matplotlib/dviread.py branches/transforms/lib/matplotlib/mlab.py branches/transforms/lib/matplotlib/patches.py Added Paths: --- branches/transforms/examples/units/bar_demo2.py Property Changed: branches/transforms/ Property changes on: branches/transforms ___ Name: svnmerge-integrated - /trunk/matplotlib:1-3835 + /trunk/matplotlib:1-3846 Modified: branches/transforms/API_CHANGES === --- branches/transforms/API_CHANGES 2007-09-13 12:44:16 UTC (rev 3846) +++ branches/transforms/API_CHANGES 2007-09-13 12:50:05 UTC (rev 3847) @@ -1,3 +1,5 @@ +Made skiprows=1 the default on csv2rec + The gd and paint backends have been deleted. The errorbar method and function now accept additional kwargs Modified: branches/transforms/CHANGELOG === --- branches/transforms/CHANGELOG 2007-09-13 12:44:16 UTC (rev 3846) +++ branches/transforms/CHANGELOG 2007-09-13 12:50:05 UTC (rev 3847) @@ -1,3 +1,10 @@ +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 Copied: branches/transforms/examples/units/bar_demo2.py (from rev 3845, trunk/matplotlib/examples/units/bar_demo2.py) === --- branches/transforms/examples/units/bar_demo2.py (rev 0) +++ branches/transforms/examples/units/bar_demo2.py 2007-09-13 12:50:05 UTC (rev 3847) @@ -0,0 +1,34 @@ + +plot using a variety of cm vs inches conversions. The example shows +how default unit instrospection works (ax1), how various keywords can +be used to set the x and y units to override the defaults (ax2, ax3, +ax4) and how one can set the xlimits using scalars (ax3, current units +assumed) or units (conversions applied to get the numbers to current +units) + + +from basic_units import cm, inch +from pylab import figure, show, nx + +cms = cm *nx.arange(0, 10, 2) +bottom=0*cm +width=0.8*cm + +fig = figure() + +ax1 = fig.add_subplot(2,2,1) +ax1.bar(cms, cms, bottom=bottom) + +ax2 = fig.add_subplot(2,2,2) +ax2.bar(cms, cms, bottom=bottom, width=width, xunits=cm, yunits=inch) + +ax3 = fig.add_subplot(2,2,3) +ax3.bar(cms, cms, bottom=bottom, width=width, xunits=inch, yunits=cm) +ax3.set_xlim(3, 6) # scalars are interpreted in current units + +ax4 = fig.add_subplot(2,2,4) +ax4.bar(cms, cms, bottom=bottom, width=width, xunits=inch, yunits=inch) +#fig.savefig('simple_conversion_plot.png') +ax4.set_xlim(3*cm, 6*cm) # cm are converted to inches + +show() Modified: branches/transforms/lib/matplotlib/artist.py === --- branches/transforms/lib/matplotlib/artist.py2007-09-13 12:44:16 UTC (rev 3846) +++ branches/transforms/lib/matplotlib/artist.py2007-09-13 12:50:05 UTC (rev 3847) @@ -51,7 +51,7 @@ self._remove_method = None def remove(self): -''' + Remove the artist from the figure if possible. The effect will not be visible until the figure is redrawn, e.g., with ax.draw_idle(). Call ax.relim() to update the axes limits if desired. @@ -60,7 +60,7 @@ was added to axes with autolim=True. Note: there is no support for removing the artist's legend entry. -''' + # There is no method to set the callback. Instead the parent should set # the _remove_method attribute directly. This would be a protected Modified: branches/transforms/lib
SF.net SVN: matplotlib: [3850] branches/transforms/lib/matplotlib/ transforms.py
Revision: 3850 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3850view=rev Author: mdboom Date: 2007-09-14 05:24:20 -0700 (Fri, 14 Sep 2007) Log Message: --- Deleting this file to rename affine.py Removed Paths: - branches/transforms/lib/matplotlib/transforms.py Deleted: branches/transforms/lib/matplotlib/transforms.py === --- branches/transforms/lib/matplotlib/transforms.py2007-09-14 12:23:06 UTC (rev 3849) +++ branches/transforms/lib/matplotlib/transforms.py2007-09-14 12:24:20 UTC (rev 3850) @@ -1,652 +0,0 @@ -# -# The transforms module is broken into two parts, a collection of -# classes written in the extension module _transforms to handle -# efficient transformation of data, and some helper functions in -# transforms to make it easy to instantiate and use those objects. -# Hence the core of this module lives in _transforms. - -# The transforms class is built around the idea of a LazyValue. A -# LazyValue is a base class that defines a method get that returns the -# value. The concrete derived class Value wraps a float, and simply -# returns the value of that float. The concrete derived class BinOp -# allows binary operations on LazyValues, so you can add them, multiply -# them, etc. When you do something like - -# inches = Value(8) -# dpi= Value(72) -# width = inches * dpi - -# width is a BinOp instance (that tells you the width of the figure in -# pixels). Later, if the figure size in changed, ie we call - -# inches.set(10) - -# The width variable is automatically updated because it stores a -# pointer to the inches variable, not the value. Since a BinOp is also -# a lazy value, you can define binary operations on BinOps as well, such -# as - -# middle = Value(0.5) * width - -# Pairs of LazyValue instances can occur as instances of two classes: - -# pt = Point( Value(x), Value(y)) # where x, y are numbers -# pt.x(), pt.y() return Value(x), Value(y)) - -# iv = Interval( Value(x), Value(y)) -# iv.contains(z) returns True if z is in the closed interval -# iv.contains_open(z): same for open interval -# iv.span() returns y-x as a float -# iv.get_bounds() returns (x,y) as a tuple of floats -# iv.set_bounds(x, y) allows input of new floats -# iv.update(seq) updates the bounds to include all elements -# in a sequence of floats -# iv.shift(s) shifts the interval by s, a float - -# The bounding box class Bbox is also heavily used, and is defined by a -# lower left point ll and an upper right point ur. The points ll and ur -# are given by Point(x, y) instances, where x and y are LazyValues. So -# you can represent a point such as - -# ll = Point( Value(0), Value(0) ) # the origin -# ur = Point( width, height )# the upper right of the figure - -# where width and height are defined as above, using the product of the -# figure width in inches and the dpi. This is, in face, how the Figure -# bbox is defined - -# bbox = Bbox(ll, ur) - -# A bbox basically defines an x,y coordinate system, with ll giving the -# lower left of the coordinate system and ur giving the upper right. - -# The bbox methods are - -# ll()- return the lower left Point -# ur()- return the upper right Point -# contains(x,y) - return True if self contains point -# overlaps(bbox) - return True if self overlaps bbox -# overlapsx(bbox) - return True if self overlaps bbox in the x interval -# overlapsy(bbox) - return True if self overlaps bbox in the y interval -# intervalx() - return the x Interval instance -# intervaly() - return the y interval instance -# get_bounds()- get the left, bottom, width, height bounding tuple -# update(xys, ignore) - update the bbox to bound all the xy tuples in -# xys; if ignore is true ignore the current contents of bbox and -# just bound the tuples. If ignore is false, bound self + tuples -# width() - return the width of the bbox -# height()- return the height of the bbox -# xmax() - return the x coord of upper right -# ymax() - return the y coord of upper right -# xmin() - return the x coord of lower left -# ymin() - return the y coord of lower left -# scale(sx,sy)- scale the bbox by sx, sy -# deepcopy() - return a deep copy of self (pointers are lost) - - -# The basic transformation maps one bbox to another, with an optional -# nonlinear transformation of one of coordinates (eg log scaling). - -# The base class for transformations is Transformation, and the concrete -# derived classes are SeparableTransformation and Affine. Earlier -# versions of matplotlib handled transformation of x and y separately -# (ie we assumed all transformations were
SF.net SVN: matplotlib: [3860] branches/transforms
Revision: 3860 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3860view=rev Author: mdboom Date: 2007-09-19 12:48:17 -0700 (Wed, 19 Sep 2007) Log Message: --- Use iterator rather than caching approach for paths Modified Paths: -- branches/transforms/lib/matplotlib/backends/backend_agg.py branches/transforms/src/_backend_agg.cpp branches/transforms/src/_backend_agg.h Modified: branches/transforms/lib/matplotlib/backends/backend_agg.py === --- branches/transforms/lib/matplotlib/backends/backend_agg.py 2007-09-19 19:46:34 UTC (rev 3859) +++ branches/transforms/lib/matplotlib/backends/backend_agg.py 2007-09-19 19:48:17 UTC (rev 3860) @@ -112,8 +112,7 @@ self.dpi = dpi self.width = width self.height = height -if __debug__: verbose.report('RendererAgg.__init__ width=%s, \ -height=%s'%(width, height), 'debug-annoying') +if __debug__: verbose.report('RendererAgg.__init__ width=%s, height=%s'%(width, height), 'debug-annoying') self._renderer = _RendererAgg(int(width), int(height), dpi, debug=False) if __debug__: verbose.report('RendererAgg.__init__ _RendererAgg done', Modified: branches/transforms/src/_backend_agg.cpp === --- branches/transforms/src/_backend_agg.cpp2007-09-19 19:46:34 UTC (rev 3859) +++ branches/transforms/src/_backend_agg.cpp2007-09-19 19:48:17 UTC (rev 3860) @@ -87,15 +87,17 @@ inline void get_next_vertex(const char* vertex_i, const char* vertex_end, double x, double y, size_t next_vertex_stride, - size_t next_axis_stride) { + size_t next_axis_stride, + const char* code_i, size_t code_stride) { if (vertex_i + next_axis_stride = vertex_end) throw Py::ValueError(Error parsing path. Read past end of vertices); x = *(double*)vertex_i; y = *(double*)(vertex_i + next_axis_stride); vertex_i += next_vertex_stride; + code_i += code_stride; } -#define GET_NEXT_VERTEX(x, y) get_next_vertex(vertex_i, vertex_end, x, y, next_vertex_stride, next_axis_stride) +#define GET_NEXT_VERTEX(x, y) get_next_vertex(vertex_i, vertex_end, x, y, next_vertex_stride, next_axis_stride, code_i, code_stride) Py::Object BufferRegion::to_string(const Py::Tuple args) { @@ -103,7 +105,71 @@ return Py::String(PyString_FromStringAndSize((const char*)aggbuf.data,aggbuf.height*aggbuf.stride), true); } +class PathIterator { + PyArrayObject* vertices; + PyArrayObject* codes; + size_t m_iterator; + size_t m_total_vertices; +public: + PathIterator(const Py::Object path_obj) : +vertices(NULL), codes(NULL), m_iterator(0) { +Py::Object vertices_obj = path_obj.getAttr(vertices); +Py::Object codes_obj = path_obj.getAttr(codes); + +vertices = (PyArrayObject*)PyArray_ContiguousFromObject + (vertices_obj.ptr(), PyArray_DOUBLE, 2, 2); +if (!vertices || vertices-nd != 2 || vertices-dimensions[1] != 2) + throw Py::ValueError(Invalid vertices array.); +codes = (PyArrayObject*)PyArray_ContiguousFromObject + (codes_obj.ptr(), PyArray_UINT8, 1, 1); +if (!codes) + throw Py::ValueError(Invalid codes array.); + +if (codes-dimensions[0] != vertices-dimensions[0]) + throw Py::ValueError(Vertices and codes array are not the same length.); + +m_total_vertices = codes-dimensions[0]; + } + + ~PathIterator() { +Py_XDECREF(vertices); +Py_XDECREF(codes); + } + + static const char code_map[]; + + inline unsigned vertex(unsigned idx, double* x, double* y) { +if (idx m_total_vertices) + throw Py::RuntimeError(Requested vertex past end); +double* pv = (double*)(vertices-data + (idx * vertices-strides[0])); +*x = *pv++; +*y = *pv; +// MGDTODO: Range check +return code_map[(unsigned int)*(codes-data + (idx * codes-strides[0]))]; + } + + inline unsigned vertex(double* x, double* y) { +if(m_iterator = m_total_vertices) return agg::path_cmd_stop; +return vertex(m_iterator++, x, y); + } + + inline void rewind(unsigned path_id) { +m_iterator = path_id; + } + + inline unsigned total_vertices() { +return m_total_vertices; + } +}; + +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}; + GCAgg::GCAgg(const Py::Object gc, double dpi, bool snapto) : dpi(dpi), snapto(snapto), isaa(true), linewidth(1.0), alpha(1.0), cliprect
SF.net SVN: matplotlib: [3862] trunk/matplotlib/lib/matplotlib/font_manager .py
Revision: 3862 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3862view=rev Author: mdboom Date: 2007-09-20 05:40:41 -0700 (Thu, 20 Sep 2007) Log Message: --- Removing debugging output in last commit. Modified Paths: -- trunk/matplotlib/lib/matplotlib/font_manager.py Modified: trunk/matplotlib/lib/matplotlib/font_manager.py === --- trunk/matplotlib/lib/matplotlib/font_manager.py 2007-09-20 12:31:26 UTC (rev 3861) +++ trunk/matplotlib/lib/matplotlib/font_manager.py 2007-09-20 12:40:41 UTC (rev 3862) @@ -773,7 +773,6 @@ else: if is_string_like(size): parent_size = fontManager.get_default_size() -print parent_size, parent_size, size scaling = font_scalings.get(size) if scaling is not None: size = parent_size * scaling This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3864] branches/transforms/lib/matplotlib/lines.py
Revision: 3864 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3864view=rev Author: mdboom Date: 2007-09-20 06:57:32 -0700 (Thu, 20 Sep 2007) Log Message: --- Simplification of marker paths. Modified Paths: -- branches/transforms/lib/matplotlib/lines.py Modified: branches/transforms/lib/matplotlib/lines.py === --- branches/transforms/lib/matplotlib/lines.py 2007-09-20 13:50:27 UTC (rev 3863) +++ branches/transforms/lib/matplotlib/lines.py 2007-09-20 13:57:32 UTC (rev 3864) @@ -815,7 +815,7 @@ path, self.get_transform()) -_tickhoriz_path = Path([[0.0, 0.5], [1.0, 0.5]]) +_tickhoriz_path = Path([[0.0, 0.5], [1.0, 0.5]], closed=False) def _draw_tickleft(self, renderer, gc, path): offset = renderer.points_to_pixels(self._markersize) marker_transform = Affine2D().scale(-offset, 1.0) @@ -830,7 +830,7 @@ path, self.get_transform()) -_tickvert_path = Path([[-0.5, 0.0], [-0.5, 1.0]]) +_tickvert_path = Path([[-0.5, 0.0], [-0.5, 1.0]], closed=False) def _draw_tickup(self, renderer, gc, path): offset = renderer.points_to_pixels(self._markersize) marker_transform = Affine2D().scale(1.0, offset) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3869] branches/transforms/lib/matplotlib
Revision: 3869 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3869view=rev Author: mdboom Date: 2007-09-20 11:00:32 -0700 (Thu, 20 Sep 2007) Log Message: --- First baby step in getting arbitrary non-linear transformations into the pipeline. Modified Paths: -- branches/transforms/lib/matplotlib/axes.py branches/transforms/lib/matplotlib/axis.py branches/transforms/lib/matplotlib/backends/backend_agg.py branches/transforms/lib/matplotlib/lines.py branches/transforms/lib/matplotlib/path.py branches/transforms/lib/matplotlib/text.py branches/transforms/lib/matplotlib/transforms.py Modified: branches/transforms/lib/matplotlib/axes.py === --- branches/transforms/lib/matplotlib/axes.py 2007-09-20 14:26:27 UTC (rev 3868) +++ branches/transforms/lib/matplotlib/axes.py 2007-09-20 18:00:32 UTC (rev 3869) @@ -633,10 +633,16 @@ self.transAxes = mtransforms.BboxTransform( mtransforms.Bbox.unit(), self.bbox) # self.set_transform(self.transAxes) -self.transData = mtransforms.BboxTransform( -self.viewLim, self.bbox) +# self.transData = mtransforms.BboxTransform( +# self.viewLim, self.bbox) +self.preDataTransform = mtransforms.BboxTransform( +self.viewLim, mtransforms.Bbox.unit()) +self.dataTransform = mtransforms.TestLogTransform() +# self.dataTransform = mtransforms.Affine2D().scale(1.5) +self.transData = self.preDataTransform + self.dataTransform + mtransforms.BboxTransform( +mtransforms.Bbox.unit(), self.bbox) + - def get_position(self, original=False): 'Return the axes rectangle left, bottom, width, height' if original: Modified: branches/transforms/lib/matplotlib/axis.py === --- branches/transforms/lib/matplotlib/axis.py 2007-09-20 14:26:27 UTC (rev 3868) +++ branches/transforms/lib/matplotlib/axis.py 2007-09-20 18:00:32 UTC (rev 3869) @@ -1032,18 +1032,17 @@ else: bbox = Bbox.union(bboxes) bottom = bbox.ymin - -self.label.set_position( (x, bottom-self.LABELPAD*self.figure.dpi / 72.0)) - +self.label.set_position( (x, bottom - self.LABELPAD*self.figure.dpi / 72.0)) + else: if not len(bboxes2): top = self.axes.bbox.ymax else: bbox = bbox_union(bboxes2) top = bbox.ymax + +self.label.set_position( (x, top+self.LABELPAD*self.figure.dpi / 72.0)) -self.label.set_position( (x, top+self.LABELPAD*self.figure.dpi.get()/72.0)) - def _update_offset_text_position(self, bboxes, bboxes2): Update the offset_text position based on the sequence of bounding Modified: branches/transforms/lib/matplotlib/backends/backend_agg.py === --- branches/transforms/lib/matplotlib/backends/backend_agg.py 2007-09-20 14:26:27 UTC (rev 3868) +++ branches/transforms/lib/matplotlib/backends/backend_agg.py 2007-09-20 18:00:32 UTC (rev 3869) @@ -84,7 +84,8 @@ from matplotlib.font_manager import findfont from matplotlib.ft2font import FT2Font, LOAD_DEFAULT from matplotlib.mathtext import MathTextParser -from matplotlib.transforms import Bbox +from matplotlib.path import Path +from matplotlib.transforms import Affine2D, Bbox from _backend_agg import RendererAgg as _RendererAgg @@ -117,8 +118,8 @@ debug=False) if __debug__: verbose.report('RendererAgg.__init__ _RendererAgg done', 'debug-annoying') -self.draw_path = self._renderer.draw_path -self.draw_markers = self._renderer.draw_markers +#self.draw_path = self._renderer.draw_path +#self.draw_markers = self._renderer.draw_markers self.draw_image = self._renderer.draw_image self.copy_from_bbox = self._renderer.copy_from_bbox self.restore_region = self._renderer.restore_region @@ -129,6 +130,17 @@ if __debug__: verbose.report('RendererAgg.__init__ done', 'debug-annoying') +# MGDTODO: This is a hack for now to allow for arbitrary transformations +def draw_path(self, gc, path, trans, rgbFace=None): +new_path, affine = path.transformed_without_affine(trans) +self._renderer.draw_path(gc, new_path, affine, rgbFace) + +# MGDTODO: This is a hack for now to allow for arbitrary transformations +def draw_markers(self, gc, marker_path, marker_trans, path, trans, rgbFace=None): +assert marker_trans.is_affine() +new_path, affine = path.transformed_without_affine(trans) +self._renderer.draw_markers
SF.net SVN: matplotlib: [3872] branches/transforms/lib/matplotlib
Revision: 3872 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3872view=rev Author: mdboom Date: 2007-09-21 09:52:50 -0700 (Fri, 21 Sep 2007) Log Message: --- Further progress on arbitrary transformations -- zooming and panning now works without any log-scale-specific hacks. (Though the underlying model is slightly wrong.) Added graphviz output support for debugging transformation trees. Masked array handling much more robust. Modified Paths: -- branches/transforms/lib/matplotlib/axes.py branches/transforms/lib/matplotlib/backend_bases.py branches/transforms/lib/matplotlib/lines.py branches/transforms/lib/matplotlib/path.py branches/transforms/lib/matplotlib/transforms.py Modified: branches/transforms/lib/matplotlib/axes.py === --- branches/transforms/lib/matplotlib/axes.py 2007-09-21 15:33:18 UTC (rev 3871) +++ branches/transforms/lib/matplotlib/axes.py 2007-09-21 16:52:50 UTC (rev 3872) @@ -637,10 +637,14 @@ # self.viewLim, self.bbox) self.preDataTransform = mtransforms.BboxTransform( self.viewLim, mtransforms.Bbox.unit()) -self.dataTransform = mtransforms.TestLogTransform() -# self.dataTransform = mtransforms.Affine2D().scale(1.5) +#self.dataTransform = mtransforms.TestPolarTransform() +# self.dataTransform = mtransforms.blended_transform_factory( +# mtransforms.TestLogTransform(), +# mtransforms.Affine2D()) +self.dataTransform = mtransforms.Affine2D() self.transData = self.preDataTransform + self.dataTransform + mtransforms.BboxTransform( mtransforms.Bbox.unit(), self.bbox) +self.transData.make_graphviz(open(trans.dot, w)) def get_position(self, original=False): @@ -1523,7 +1527,7 @@ 'return the xaxis scale string: log or linear' # MGDTODO # return self.scaled[self.transData.get_funcx().get_type()] - return 'linear' + return 'log' def set_xscale(self, value, basex = 10, subsx=None): Modified: branches/transforms/lib/matplotlib/backend_bases.py === --- branches/transforms/lib/matplotlib/backend_bases.py 2007-09-21 15:33:18 UTC (rev 3871) +++ branches/transforms/lib/matplotlib/backend_bases.py 2007-09-21 16:52:50 UTC (rev 3872) @@ -1655,60 +1655,30 @@ #multiple button can get pressed during motion... if self._button_pressed==1: inverse = trans.inverted() -lastx, lasty = inverse.transform_point((lastx, lasty)) -x, y = inverse.transform_point( (event.x, event.y) ) -if a.get_xscale()=='log': -dx=1-lastx/x -else: -dx=x-lastx -if a.get_yscale()=='log': -dy=1-lasty/y -else: -dy=y-lasty - -dx,dy=format_deltas(event,dx,dy) - -if a.get_xscale()=='log': -xmin *= 1-dx -xmax *= 1-dx -else: -xmin -= dx -xmax -= dx -if a.get_yscale()=='log': -ymin *= 1-dy -ymax *= 1-dy -else: -ymin -= dy -ymax -= dy +dx, dy = event.x - lastx, event.y - lasty +dx, dy = format_deltas(event, dx, dy) +delta = npy.array([[dx, dy], [dx, dy]], npy.float_) +bbox = transforms.Bbox(a.bbox.get_points() - delta) +result = bbox.transformed(inverse) elif self._button_pressed==3: try: +inverse = trans.inverted() dx=(lastx-event.x)/float(a.bbox.width) dy=(lasty-event.y)/float(a.bbox.height) -dx,dy=format_deltas(event,dx,dy) -if a.get_aspect() != 'auto': -dx = 0.5*(dx + dy) -dy = dx -alphax = pow(10.0,dx) -alphay = pow(10.0,dy)#use logscaling, avoid singularities and smother scaling... - inverse = trans.inverted() -lastx, lasty = inverse.transform_point( (lastx, lasty) ) -if a.get_xscale()=='log': -xmin = lastx*(xmin/lastx)**alphax -xmax = lastx*(xmax/lastx)**alphax -else: -xmin = lastx+alphax*(xmin-lastx) -xmax = lastx+alphax*(xmax-lastx) -if a.get_yscale()=='log': -ymin = lasty*(ymin/lasty)**alphay -ymax = lasty*(ymax/lasty)**alphay -else
SF.net SVN: matplotlib: [3873] branches/transforms
Revision: 3873 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3873view=rev Author: mdboom Date: 2007-09-21 09:54:32 -0700 (Fri, 21 Sep 2007) Log Message: --- Merged revisions 3870-3872 via svnmerge from http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib r3871 | dsdale | 2007-09-21 11:33:18 -0400 (Fri, 21 Sep 2007) | 2 lines changed cbooks reversed to agree with the python builtin Modified Paths: -- branches/transforms/API_CHANGES branches/transforms/CHANGELOG branches/transforms/lib/matplotlib/cbook.py Property Changed: branches/transforms/ Property changes on: branches/transforms ___ Name: svnmerge-integrated - /trunk/matplotlib:1-3869 + /trunk/matplotlib:1-3872 Modified: branches/transforms/API_CHANGES === --- branches/transforms/API_CHANGES 2007-09-21 16:52:50 UTC (rev 3872) +++ branches/transforms/API_CHANGES 2007-09-21 16:54:32 UTC (rev 3873) @@ -1,3 +1,8 @@ +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. Modified: branches/transforms/CHANGELOG === --- branches/transforms/CHANGELOG 2007-09-21 16:52:50 UTC (rev 3872) +++ branches/transforms/CHANGELOG 2007-09-21 16:54:32 UTC (rev 3873) @@ -1,3 +1,6 @@ +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 Modified: branches/transforms/lib/matplotlib/cbook.py === --- branches/transforms/lib/matplotlib/cbook.py 2007-09-21 16:52:50 UTC (rev 3872) +++ branches/transforms/lib/matplotlib/cbook.py 2007-09-21 16:54:32 UTC (rev 3873) @@ -482,7 +482,7 @@ enumerate() is new in Python 2.3 for i in range(len(seq)-1,-1,-1): -yield i, seq[i] +yield seq[i] # use itertools.izip if available, else use python version This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3884] branches/transforms/lib/matplotlib
Revision: 3884 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3884view=rev Author: mdboom Date: 2007-09-24 09:53:38 -0700 (Mon, 24 Sep 2007) Log Message: --- More progress. (Kind of a broken mess at the moment.) Modified Paths: -- branches/transforms/lib/matplotlib/axes.py branches/transforms/lib/matplotlib/axis.py branches/transforms/lib/matplotlib/ticker.py branches/transforms/lib/matplotlib/transforms.py Added Paths: --- branches/transforms/lib/matplotlib/scale.py Modified: branches/transforms/lib/matplotlib/axes.py === --- branches/transforms/lib/matplotlib/axes.py 2007-09-24 15:11:58 UTC (rev 3883) +++ branches/transforms/lib/matplotlib/axes.py 2007-09-24 16:53:38 UTC (rev 3884) @@ -25,6 +25,7 @@ from matplotlib import patches as mpatches from matplotlib import pbox as mpbox from matplotlib import quiver as mquiver +from matplotlib import scale as mscale from matplotlib import table as mtable from matplotlib import text as mtext from matplotlib import ticker as mticker @@ -449,7 +450,6 @@ **kwargs ): - Build an Axes instance in Figure with rect=[left, bottom, width,height in Figure coords @@ -467,8 +467,8 @@ navigate: True|False navigate_mode: the navigation toolbar button status: 'PAN', 'ZOOM', or None position: [left, bottom, width,height in Figure coords -sharex : an Axes instance to share the x-axis with -sharey : an Axes instance to share the y-axis with +sharex: an Axes instance to share the x-axis with +sharey: an Axes instance to share the y-axis with title: the title string visible: a boolean - whether the axes is visible xlabel: the xlabel @@ -491,7 +491,7 @@ self.set_adjustable('box') self.set_anchor('C') -# must be set before set_figure +# MGDTODO: Check that the axes being shared are scalable self._sharex = sharex self._sharey = sharey if sharex is not None: @@ -508,7 +508,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 @@ -545,8 +545,8 @@ move this out of __init__ because non-separable axes don't use it self.xaxis = maxis.XAxis(self) self.yaxis = maxis.YAxis(self) +self._update_transAxisXY() - def sharex_foreign(self, axforeign): You can share your x-axis view limits with another Axes in the @@ -627,26 +627,17 @@ set the dataLim and viewLim BBox attributes and the transData and transAxes Transformation attributes - self.viewLim = mtransforms.Bbox.unit() self.dataLim = mtransforms.Bbox.unit() - +self.viewLim = mtransforms.Bbox.unit() self.transAxes = mtransforms.BboxTransform( mtransforms.Bbox.unit(), self.bbox) -# self.set_transform(self.transAxes) -# self.transData = mtransforms.BboxTransform( -# self.viewLim, self.bbox) -self.preDataTransform = mtransforms.BboxTransform( -self.viewLim, mtransforms.Bbox.unit()) -#self.dataTransform = mtransforms.TestPolarTransform() -# self.dataTransform = mtransforms.blended_transform_factory( -# mtransforms.TestLogTransform(), -# mtransforms.Affine2D()) -self.dataTransform = mtransforms.Affine2D() -self.transData = self.preDataTransform + self.dataTransform + mtransforms.BboxTransform( -mtransforms.Bbox.unit(), self.bbox) -self.transData.make_graphviz(open(trans.dot, w)) +self.transAxisXY = mtransforms.TransformWrapper() +self.transData = self.transAxisXY + self.transAxes + +def _update_transAxisXY(self): +self.transAxisXY.set(mtransforms.blended_transform_factory( +self.xaxis.get_transform(), self.yaxis.get_transform())) - def get_position(self, original=False): 'Return the axes rectangle left, bottom, width, height' if original: @@ -1525,11 +1516,9 @@ def get_xscale(self): 'return the xaxis scale string: log or linear' - # MGDTODO -# return self.scaled[self.transData.get_funcx().get_type()] - return 'log' + return self.xaxis.get_scale() -def set_xscale(self, value, basex = 10, subsx=None): +def set_xscale(self, value, **kwargs): SET_XSCALE(value, basex=10, subsx=None) @@ -1547,27 +1536,9 @@ ACCEPTS: ['log' | 'linear' ] - -#if subsx is None: subsx = range(2, basex) -assert(value.lower() in ('log', 'linear', )) -if value == 'log
SF.net SVN: matplotlib: [3885] branches/transforms
Revision: 3885 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3885view=rev Author: mdboom Date: 2007-09-24 09:54:37 -0700 (Mon, 24 Sep 2007) Log Message: --- Merged revisions 3873-3884 via svnmerge from http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib r3874 | jouni | 2007-09-22 02:48:49 -0400 (Sat, 22 Sep 2007) | 3 lines Replace some generator expressions by list comprehensions for Python 2.3 compatibility r3879 | dsdale | 2007-09-24 08:56:38 -0400 (Mon, 24 Sep 2007) | 2 lines fix backend_qt* bug with multiple plot windows and show() r3880 | dsdale | 2007-09-24 09:00:12 -0400 (Mon, 24 Sep 2007) | 2 lines backend_qt* bugfix for multiple plot windows and show() r3881 | dsdale | 2007-09-24 09:01:17 -0400 (Mon, 24 Sep 2007) | 2 lines fix backend_wxagg reference in new config module r3882 | dsdale | 2007-09-24 09:03:01 -0400 (Mon, 24 Sep 2007) | 3 lines modifed embedding_in_qt* examples so they can be run from ipython with -q*thread r3883 | dsdale | 2007-09-24 11:11:58 -0400 (Mon, 24 Sep 2007) | 2 lines fix bug in improved support for multiple windows in backend_qt4 Modified Paths: -- branches/transforms/CHANGELOG branches/transforms/examples/embedding_in_qt.py branches/transforms/examples/embedding_in_qt4.py branches/transforms/lib/matplotlib/backends/backend_pdf.py branches/transforms/lib/matplotlib/backends/backend_qt.py branches/transforms/lib/matplotlib/backends/backend_qt4.py branches/transforms/lib/matplotlib/config/mpltraits.py branches/transforms/lib/matplotlib/dviread.py Property Changed: branches/transforms/ Property changes on: branches/transforms ___ Name: svnmerge-integrated - /trunk/matplotlib:1-3872 + /trunk/matplotlib:1-3884 Modified: branches/transforms/CHANGELOG === --- branches/transforms/CHANGELOG 2007-09-24 16:53:38 UTC (rev 3884) +++ branches/transforms/CHANGELOG 2007-09-24 16:54:37 UTC (rev 3885) @@ -1,3 +1,7 @@ +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 Modified: branches/transforms/examples/embedding_in_qt.py === --- branches/transforms/examples/embedding_in_qt.py 2007-09-24 16:53:38 UTC (rev 3884) +++ branches/transforms/examples/embedding_in_qt.py 2007-09-24 16:54:37 UTC (rev 3885) @@ -25,7 +25,7 @@ # Note: color-intensive applications may require a different color allocation # strategy. -QApplication.setColorSpec(QApplication.NormalColor) +#QApplication.setColorSpec(QApplication.NormalColor) app = QApplication(sys.argv) class MyMplCanvas(FigureCanvas): @@ -129,12 +129,8 @@ % {prog: progname, version: progversion}) -def main(): -aw = ApplicationWindow() -aw.setCaption(%s % progname) -qApp.setMainWidget(aw) -aw.show() -sys.exit(qApp.exec_loop()) - - -if __name__ == __main__: main() +aw = ApplicationWindow() +aw.setCaption(%s % progname) +qApp.setMainWidget(aw) +aw.show() +sys.exit(qApp.exec_loop()) Modified: branches/transforms/examples/embedding_in_qt4.py === --- branches/transforms/examples/embedding_in_qt4.py2007-09-24 16:53:38 UTC (rev 3884) +++ branches/transforms/examples/embedding_in_qt4.py2007-09-24 16:54:37 UTC (rev 3885) @@ -122,17 +122,10 @@ % {prog: progname, version: progversion}) -def main(): -# Note: color-intensive applications may require a different color -# allocation strategy. -QtGui.QApplication.setColorSpec(QtGui.QApplication.NormalColor) -qApp = QtGui.QApplication(sys.argv) +qApp = QtGui.QApplication(sys.argv) -aw = ApplicationWindow() -aw.setWindowTitle(%s % progname) -aw.show() -#sys.exit(qApp.exec_()) -qApp.exec_() - - -if __name__ == __main__: main() +aw = ApplicationWindow() +aw.setWindowTitle(%s % progname) +aw.show() +sys.exit(qApp.exec_()) +#qApp.exec_() Modified: branches/transforms/lib/matplotlib/backends/backend_pdf.py === --- branches/transforms/lib/matplotlib/backends/backend_pdf.py 2007-09-24 16:53:38 UTC (rev 3884) +++ branches/transforms/lib/matplotlib/backends/backend_pdf.py 2007-09-24 16:54:37 UTC (rev 3885) @@ -541,10 +541,10 @@ widths[ch] = afmdata.get_width_char(ch, isord=True) except KeyError: pass -not_None = (ch
SF.net SVN: matplotlib: [3889] branches/transforms/lib/matplotlib
Revision: 3889 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3889view=rev Author: mdboom Date: 2007-09-25 10:04:51 -0700 (Tue, 25 Sep 2007) Log Message: --- Automaticall separate affine from non-affine transforms Modified Paths: -- branches/transforms/lib/matplotlib/axes.py branches/transforms/lib/matplotlib/axis.py branches/transforms/lib/matplotlib/backends/backend_agg.py branches/transforms/lib/matplotlib/lines.py branches/transforms/lib/matplotlib/path.py branches/transforms/lib/matplotlib/scale.py branches/transforms/lib/matplotlib/ticker.py branches/transforms/lib/matplotlib/transforms.py Modified: branches/transforms/lib/matplotlib/axes.py === --- branches/transforms/lib/matplotlib/axes.py 2007-09-25 12:15:22 UTC (rev 3888) +++ branches/transforms/lib/matplotlib/axes.py 2007-09-25 17:04:51 UTC (rev 3889) @@ -545,7 +545,7 @@ move this out of __init__ because non-separable axes don't use it self.xaxis = maxis.XAxis(self) self.yaxis = maxis.YAxis(self) -self._update_transAxisXY() +self._update_transScale() def sharex_foreign(self, axforeign): @@ -631,12 +631,28 @@ self.viewLim = mtransforms.Bbox.unit() self.transAxes = mtransforms.BboxTransform( mtransforms.Bbox.unit(), self.bbox) -self.transAxisXY = mtransforms.TransformWrapper() -self.transData = self.transAxisXY + self.transAxes -def _update_transAxisXY(self): -self.transAxisXY.set(mtransforms.blended_transform_factory( +# Transforms the x and y axis separately by a scale factor +# It is assumed that this part will have non-linear components +self.transScale = mtransforms.TransformWrapper(mtransforms.IdentityTransform()) + +# A (possibly non-linear) projection on the (already scaled) data +self.transProjection = mtransforms.IdentityTransform() + +# An affine transformation on the data, generally to limit the +# range of the axes +self.transLimits = mtransforms.BboxTransform( +mtransforms.TransformedBbox(self.viewLim, self.transScale), mtransforms.Bbox.unit()) + +self.transData = self.transScale + self.transProjection + self.transLimits + self.transAxes + + +def _update_transScale(self): +self.transScale.set( +mtransforms.blended_transform_factory( self.xaxis.get_transform(), self.yaxis.get_transform())) + +self.transData.make_graphviz(open(trans.dot, w)) def get_position(self, original=False): 'Return the axes rectangle left, bottom, width, height' @@ -1537,7 +1553,7 @@ ACCEPTS: ['log' | 'linear' ] self.xaxis.set_scale(value, **kwargs) -self._update_transAxisXY() +self._update_transScale() def get_xticks(self): 'Return the x ticks as a list of locations' @@ -1647,7 +1663,7 @@ ACCEPTS: ['log' | 'linear'] self.yaxis.set_scale(value, basey, subsy) -self._update_transAxisXY() +self._update_transScale() def get_yticks(self): 'Return the y ticks as a list of locations' Modified: branches/transforms/lib/matplotlib/axis.py === --- branches/transforms/lib/matplotlib/axis.py 2007-09-25 12:15:22 UTC (rev 3888) +++ branches/transforms/lib/matplotlib/axis.py 2007-09-25 17:04:51 UTC (rev 3889) @@ -508,16 +508,15 @@ self.majorTicks = [] self.minorTicks = [] self.pickradius = pickradius -self._transform = LinearScale(self.axes.viewLim, self.axis).get_transform() -self._scale = 'linear' +self._scale = LinearScale() self.cla() def get_transform(self): -return self._transform - +return self._scale.get_transform() + def get_scale(self): -return self._scale +return self._scale.name def set_scale(self, value, base=10, subs=None): # MGDTODO: Move these settings (ticker etc.) into the scale class itself @@ -528,17 +527,16 @@ self.set_major_formatter(ScalarFormatter()) self.set_minor_locator(NullLocator()) self.set_minor_formatter(NullFormatter()) -self._transform = LinearScale(self.axes.viewLim, self.axis).get_transform() +self._scale = LinearScale() elif value == 'log': self.set_major_locator(LogLocator(base)) self.set_major_formatter(LogFormatterMathtext(base)) self.set_minor_locator(LogLocator(base,subs)) # MGDTODO: Pass base along -self._transform = LogScale(self.axes.viewLim, self.axis).get_transform() +self._scale = LogScale() miny, maxy
SF.net SVN: matplotlib: [3892] branches/transforms/lib/matplotlib
Revision: 3892 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3892view=rev Author: mdboom Date: 2007-09-25 12:53:56 -0700 (Tue, 25 Sep 2007) Log Message: --- Important bugfixes. Modified Paths: -- branches/transforms/lib/matplotlib/lines.py branches/transforms/lib/matplotlib/path.py branches/transforms/lib/matplotlib/transforms.py Modified: branches/transforms/lib/matplotlib/lines.py === --- branches/transforms/lib/matplotlib/lines.py 2007-09-25 19:08:51 UTC (rev 3891) +++ branches/transforms/lib/matplotlib/lines.py 2007-09-25 19:53:56 UTC (rev 3892) @@ -499,7 +499,7 @@ lineFunc(renderer, gc, *self._transformed_path.get_path_and_affine()) # MGDTODO: Deal with markers -if self._marker is not None and False: +if self._marker is not None: gc = renderer.new_gc() self._set_gc_clip(gc) gc.set_foreground(self.get_markeredgecolor()) @@ -507,7 +507,7 @@ gc.set_alpha(self._alpha) funcname = self._markers.get(self._marker, '_draw_nothing') markerFunc = getattr(self, funcname) -markerFunc(renderer, gc, self._path) +markerFunc(renderer, gc, *self._transformed_path.get_path_and_affine()) #renderer.close_group('line2d') Modified: branches/transforms/lib/matplotlib/path.py === --- branches/transforms/lib/matplotlib/path.py 2007-09-25 19:08:51 UTC (rev 3891) +++ branches/transforms/lib/matplotlib/path.py 2007-09-25 19:53:56 UTC (rev 3892) @@ -65,7 +65,10 @@ def __repr__(self): return Path(%s, %s) % (self.vertices, self.codes) - + +def __len__(self): +return len(self._vertices) + def _get_codes(self): return self._codes codes = property(_get_codes) @@ -108,7 +111,7 @@ # This initial rotation is to make sure the polygon always # points-up theta += npy.pi / 2.0 - verts = npy.concatenate((npy.cos(theta), npy.sin(theta))) + verts = npy.concatenate((npy.cos(theta), npy.sin(theta)), 1) path = Path(verts) cls._unit_regular_polygons[numVertices] = path return path Modified: branches/transforms/lib/matplotlib/transforms.py === --- branches/transforms/lib/matplotlib/transforms.py2007-09-25 19:08:51 UTC (rev 3891) +++ branches/transforms/lib/matplotlib/transforms.py2007-09-25 19:53:56 UTC (rev 3892) @@ -24,7 +24,10 @@ _gid = 0 def __init__(self): -self._parents = WeakKeyDictionary() +# MGDTODO: I'd like to use a WeakKeyDictionary here, but it makes +# these instances uncopyable. As it stands, _parents grows +# unboundedly... Not a good idea. +self._parents = Set() self._children = Set() self._id = TransformNode._gid @@ -34,7 +37,7 @@ if not self._do_invalidation(affine_only): self._id = TransformNode._gid TransformNode._gid += 1 -for parent in self._parents.iterkeys(): +for parent in self._parents: parent.invalidate(affine_only) def _do_invalidation(self, affine_only): @@ -42,7 +45,7 @@ def set_children(self, children): for child in children: -getattr(self, child)._parents[self] = None +getattr(self, child)._parents.add(self) self._children = children def make_graphviz(self, fobj): @@ -1034,8 +1037,8 @@ def composite_transform_factory(a, b): -if isinstance(a, BboxTransform) and isinstance(b, BboxTransform): -return BboxTransform(a._boxin, b._boxout) +# if isinstance(a, BboxTransform) and isinstance(b, BboxTransform): +# return BboxTransform(a._boxin, b._boxout) if isinstance(a, AffineBase) and isinstance(b, AffineBase): return CompositeAffine2D(a, b) return CompositeGenericTransform(a, b) @@ -1162,19 +1165,23 @@ self._path = path self._transform = transform +self.set_children(['_transform']) self._transformed_path = None -self._last_id = transform.get_id() + +def _do_invalidation(self, affine_only): +if not affine_only: +self._transformed_path = None +return True def get_path_and_affine(self): -if (self._transformed_path is None or -self._last_id != self._transform.get_id()): +if self._transformed_path is None: vertices = self._transform.transform_non_affine(self._path.vertices) self._transformed_path = Path(vertices, self._path.codes) + return self._transformed_path, self._transform.get_affine() def get_path(self
SF.net SVN: matplotlib: [3894] trunk/matplotlib/lib/matplotlib
Revision: 3894 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3894view=rev Author: mdboom Date: 2007-09-26 06:41:15 -0700 (Wed, 26 Sep 2007) Log Message: --- Bugfix: Display exponents in tick values in the default font (not the default math font) Modified Paths: -- trunk/matplotlib/lib/matplotlib/mathtext.py trunk/matplotlib/lib/matplotlib/ticker.py Modified: trunk/matplotlib/lib/matplotlib/mathtext.py === --- trunk/matplotlib/lib/matplotlib/mathtext.py 2007-09-26 12:29:05 UTC (rev 3893) +++ trunk/matplotlib/lib/matplotlib/mathtext.py 2007-09-26 13:41:15 UTC (rev 3894) @@ -1855,7 +1855,7 @@ tanh) fontname = oneOf(rm cal it tt sf bf) -latex2efont = oneOf(mathrm mathcal mathit mathtt mathsf mathbf) +latex2efont = oneOf(mathrm mathcal mathit mathtt mathsf mathbf mathdefault) space=(FollowedBy(bslash) + (Literal(r'\ ') Modified: trunk/matplotlib/lib/matplotlib/ticker.py === --- trunk/matplotlib/lib/matplotlib/ticker.py 2007-09-26 12:29:05 UTC (rev 3893) +++ trunk/matplotlib/lib/matplotlib/ticker.py 2007-09-26 13:41:15 UTC (rev 3894) @@ -332,9 +332,12 @@ sciNotStr = r'{\times}'+self.format_data(10**self.orderOfMagnitude) else: sciNotStr = u'\xd7'+'1e%d'% self.orderOfMagnitude -if self._useMathText or self._usetex: +if self._useMathText: +return ''.join(('$\mathdefault{',sciNotStr,offsetStr,'}$')) +elif self._usetex: return ''.join(('$',sciNotStr,offsetStr,'$')) -else: return ''.join((sciNotStr,offsetStr)) +else: +return ''.join((sciNotStr,offsetStr)) else: return '' def set_locs(self, locs): @@ -395,8 +398,11 @@ for loc in locs] sigfigs.sort() self.format = '%1.' + str(sigfigs[-1]) + 'f' -if self._usetex or self._useMathText: self.format = '$%s$'%self.format - +if self._usetex: +self.format = '$%s$' % self.format +elif self._useMathText: +self.format = '$\mathdefault{%s}$' % self.format + def pprint_val(self, x): xp = (x-self.offset)/10**self.orderOfMagnitude if npy.absolute(xp) 1e-8: xp = 0 @@ -545,11 +551,13 @@ elif not isDecade: if usetex: s = r'$%d^{%.2f}$'% (b, fx) -else: s = '$%d^{%.2f}$'% (b, fx) +else: +s = '$\mathdefault{%d^{%.2f}}$'% (b, fx) else: if usetex: s = r'$%d^{%d}$'% (b, self.nearest_long(fx)) -else: s = r'$%d^{%d}$'% (b, self.nearest_long(fx)) +else: +s = r'$\mathdefault{%d^{%d}}$'% (b, self.nearest_long(fx)) return s This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3895] branches/transforms/lib/matplotlib
Revision: 3895 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3895view=rev Author: mdboom Date: 2007-09-26 06:53:53 -0700 (Wed, 26 Sep 2007) Log Message: --- Fix log limits. For minor speed improvements. Modified Paths: -- branches/transforms/lib/matplotlib/axes.py branches/transforms/lib/matplotlib/axis.py branches/transforms/lib/matplotlib/lines.py branches/transforms/lib/matplotlib/scale.py branches/transforms/lib/matplotlib/ticker.py branches/transforms/lib/matplotlib/transforms.py Modified: branches/transforms/lib/matplotlib/axes.py === --- branches/transforms/lib/matplotlib/axes.py 2007-09-26 13:41:15 UTC (rev 3894) +++ branches/transforms/lib/matplotlib/axes.py 2007-09-26 13:53:53 UTC (rev 3895) @@ -1095,18 +1095,9 @@ line._remove_method = lambda h: self.lines.remove(h) def _update_line_limits(self, line): -xdata = line.get_xdata(orig=False) -ydata = line.get_ydata(orig=False) +xydata = line.get_xydata() +self.update_datalim( xydata ) -if line.get_transform() != self.transData: -xys = self._get_verts_in_data_coords( -line.get_transform(), zip(xdata, ydata)) -xdata = npy.array([x for x,y in xys]) -ydata = npy.array([y for x,y in xys]) - -self.update_datalim_numerix( xdata, ydata ) - - def add_patch(self, p): Add a patch to the list of Axes patches; the clipbox will be @@ -1151,7 +1142,6 @@ xys = npy.asarray(xys) self.update_datalim_numerix(xys[:, 0], xys[:, 1]) - def update_datalim_numerix(self, x, y): 'Update the data lim bbox with seq of xy tups' # if no data is set currently, the bbox will ignore it's Modified: branches/transforms/lib/matplotlib/axis.py === --- branches/transforms/lib/matplotlib/axis.py 2007-09-26 13:41:15 UTC (rev 3894) +++ branches/transforms/lib/matplotlib/axis.py 2007-09-26 13:53:53 UTC (rev 3895) @@ -334,6 +334,9 @@ 'return the Interval instance for this axis view limits' return self.axes.viewLim.intervalx +def get_minpos(self): +return self.axes.dataLim.minposx + def get_data_interval(self): 'return the Interval instance for this axis data limits' return self.axes.dataLim.intervalx @@ -458,6 +461,9 @@ 'return the Interval instance for this axis view limits' return self.axes.viewLim.intervaly +def get_minpos(self): +return self.axes.dataLim.minposy + def get_data_interval(self): 'return the Interval instance for this axis data limits' return self.axes.dataLim.intervaly @@ -518,7 +524,13 @@ def get_scale(self): return self._scale.name -def set_scale(self, value, base=10, subs=None): +def set_scale(self, value, basex=10, subsx=None, basey=10, subsy=None): +if self.axis_name == 'x': +base = basex +subs = subsx +else: +base = basey +subs = subsy # MGDTODO: Move these settings (ticker etc.) into the scale class itself value = value.lower() assert value.lower() in ('log', 'linear') @@ -534,7 +546,7 @@ self.set_minor_locator(LogLocator(base,subs)) # MGDTODO: Pass base along self._scale = LogScale() -miny, maxy = getattr(self.axes.viewLim, 'interval' + self.axis) +miny, maxy = getattr(self.axes.viewLim, 'interval' + self.axis_name) if min(miny, maxy)=0: self.axes.autoscale_view() @@ -980,7 +992,7 @@ class XAxis(Axis): __name__ = 'xaxis' -axis = 'x' +axis_name = 'x' def contains(self,mouseevent): Test whether the mouse event occured in the x axis. @@ -1156,6 +1168,9 @@ 'return the Interval instance for this axis view limits' return self.axes.viewLim.intervalx +def get_minpos(self): +return self.axes.dataLim.minposx + def get_data_interval(self): 'return the Interval instance for this axis data limits' return self.axes.dataLim.intervalx @@ -1163,7 +1178,7 @@ class YAxis(Axis): __name__ = 'yaxis' -axis = 'y' +axis_name = 'y' def contains(self,mouseevent): Test whether the mouse event occurred in the y axis. @@ -1357,6 +1372,9 @@ 'return the Interval instance for this axis view limits' return self.axes.viewLim.intervaly +def get_minpos(self): +return self.axes.dataLim.minposy + def get_data_interval(self): 'return the Interval instance for this axis data limits' return self.axes.dataLim.intervaly Modified: branches/transforms/lib/matplotlib/lines.py
SF.net SVN: matplotlib: [3896] branches/transforms
Revision: 3896 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3896view=rev Author: mdboom Date: 2007-09-26 06:55:41 -0700 (Wed, 26 Sep 2007) Log Message: --- Merged revisions 3885-3895 via svnmerge from http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib r3894 | mdboom | 2007-09-26 09:41:15 -0400 (Wed, 26 Sep 2007) | 3 lines Bugfix: Display exponents in tick values in the default font (not the default math font) Modified Paths: -- branches/transforms/lib/matplotlib/mathtext.py branches/transforms/lib/matplotlib/ticker.py Property Changed: branches/transforms/ Property changes on: branches/transforms ___ Name: svnmerge-integrated - /trunk/matplotlib:1-3884 + /trunk/matplotlib:1-3895 Modified: branches/transforms/lib/matplotlib/mathtext.py === --- branches/transforms/lib/matplotlib/mathtext.py 2007-09-26 13:53:53 UTC (rev 3895) +++ branches/transforms/lib/matplotlib/mathtext.py 2007-09-26 13:55:41 UTC (rev 3896) @@ -1855,7 +1855,7 @@ tanh) fontname = oneOf(rm cal it tt sf bf) -latex2efont = oneOf(mathrm mathcal mathit mathtt mathsf mathbf) +latex2efont = oneOf(mathrm mathcal mathit mathtt mathsf mathbf mathdefault) space=(FollowedBy(bslash) + (Literal(r'\ ') Modified: branches/transforms/lib/matplotlib/ticker.py === --- branches/transforms/lib/matplotlib/ticker.py2007-09-26 13:53:53 UTC (rev 3895) +++ branches/transforms/lib/matplotlib/ticker.py2007-09-26 13:55:41 UTC (rev 3896) @@ -300,9 +300,12 @@ sciNotStr = r'{\times}'+self.format_data(10**self.orderOfMagnitude) else: sciNotStr = u'\xd7'+'1e%d'% self.orderOfMagnitude -if self._useMathText or self._usetex: +if self._useMathText: +return ''.join(('$\mathdefault{',sciNotStr,offsetStr,'}$')) +elif self._usetex: return ''.join(('$',sciNotStr,offsetStr,'$')) -else: return ''.join((sciNotStr,offsetStr)) +else: +return ''.join((sciNotStr,offsetStr)) else: return '' def set_locs(self, locs): @@ -363,8 +366,11 @@ for loc in locs] sigfigs.sort() self.format = '%1.' + str(sigfigs[-1]) + 'f' -if self._usetex or self._useMathText: self.format = '$%s$'%self.format - +if self._usetex: +self.format = '$%s$' % self.format +elif self._useMathText: +self.format = '$\mathdefault{%s}$' % self.format + def pprint_val(self, x): xp = (x-self.offset)/10**self.orderOfMagnitude if npy.absolute(xp) 1e-8: xp = 0 @@ -511,11 +517,13 @@ elif not isDecade: if usetex: s = r'$%d^{%.2f}$'% (b, fx) -else: s = '$%d^{%.2f}$'% (b, fx) +else: +s = '$\mathdefault{%d^{%.2f}}$'% (b, fx) else: if usetex: s = r'$%d^{%d}$'% (b, self.nearest_long(fx)) -else: s = r'$%d^{%d}$'% (b, self.nearest_long(fx)) +else: +s = r'$\mathdefault{%d^{%d}}$'% (b, self.nearest_long(fx)) return s This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3909] branches/transforms
Revision: 3909 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3909view=rev Author: mdboom Date: 2007-10-03 05:51:16 -0700 (Wed, 03 Oct 2007) Log Message: --- Merged revisions 3906-3908 via svnmerge from http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib r3907 | efiring | 2007-10-02 04:30:29 -0400 (Tue, 02 Oct 2007) | 2 lines matplotlib.use() raises an exception if called too late Modified Paths: -- branches/transforms/CHANGELOG branches/transforms/lib/matplotlib/__init__.py Property Changed: branches/transforms/ Property changes on: branches/transforms ___ Name: svnmerge-integrated - /trunk/matplotlib:1-3905 + /trunk/matplotlib:1-3908 Modified: branches/transforms/CHANGELOG === --- branches/transforms/CHANGELOG 2007-10-03 12:50:04 UTC (rev 3908) +++ branches/transforms/CHANGELOG 2007-10-03 12:51:16 UTC (rev 3909) @@ -1,3 +1,6 @@ +2007-10-01 Made matplotlib.use() raise an exception if called after + backends has been imported. + 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 Modified: branches/transforms/lib/matplotlib/__init__.py === --- branches/transforms/lib/matplotlib/__init__.py 2007-10-03 12:50:04 UTC (rev 3908) +++ branches/transforms/lib/matplotlib/__init__.py 2007-10-03 12:51:16 UTC (rev 3909) @@ -716,6 +716,9 @@ except: from config import rcParams, rcdefaults +_use_error_msg = matplotlib.use() must be called *before* pylab +or matplotlib.backends is imported for the first time. + def use(arg): Set the matplotlib backend to one of the known backends. @@ -732,6 +735,8 @@ for the first time; or, if you are not using pylab, it must be called before importing matplotlib.backends. +if 'matplotlib.backends' in sys.modules: +raise RuntimeError(_use_error_msg) be_parts = arg.split('.') name = validate_backend(be_parts[0]) rcParams['backend'] = name This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3914] branches/transforms
Revision: 3914 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3914view=rev Author: mdboom Date: 2007-10-04 11:57:27 -0700 (Thu, 04 Oct 2007) Log Message: --- Progress on agg_buffer_to_array example. Modified Paths: -- branches/transforms/examples/agg_buffer_to_array.py branches/transforms/examples/polar_demo.py branches/transforms/lib/matplotlib/artist.py branches/transforms/lib/matplotlib/image.py branches/transforms/lib/matplotlib/projections/polar.py branches/transforms/lib/matplotlib/transforms.py branches/transforms/src/_backend_agg.cpp branches/transforms/src/_backend_agg.h Modified: branches/transforms/examples/agg_buffer_to_array.py === --- branches/transforms/examples/agg_buffer_to_array.py 2007-10-04 17:22:01 UTC (rev 3913) +++ branches/transforms/examples/agg_buffer_to_array.py 2007-10-04 18:57:27 UTC (rev 3914) @@ -12,7 +12,7 @@ # grab rhe pixel buffer and dumpy it into a numpy array buf = fig.canvas.buffer_rgba(0,0) -l, b, w, h = fig.bbox.get_bounds() +l, b, w, h = fig.bbox.bounds X = npy.fromstring(buf, npy.uint8) X.shape = h,w,4 Modified: branches/transforms/examples/polar_demo.py === --- branches/transforms/examples/polar_demo.py 2007-10-04 17:22:01 UTC (rev 3913) +++ branches/transforms/examples/polar_demo.py 2007-10-04 18:57:27 UTC (rev 3914) @@ -40,7 +40,7 @@ # information on how to customize the grid locations and labels import numpy as npy -from matplotlib.pyplot import figure, show, rc +from matplotlib.pyplot import figure, show, rc, grid # radar green, solid grid lines rc('grid', color='#316931', linewidth=1, linestyle='-') @@ -55,6 +55,7 @@ theta = 2*npy.pi*r ax.plot(theta, r, color='#ee8d18', lw=3) ax.set_rmax(2.0) +grid(True) ax.set_title(And there was much rejoicing!, fontsize=20) show() Modified: branches/transforms/lib/matplotlib/artist.py === --- branches/transforms/lib/matplotlib/artist.py2007-10-04 17:22:01 UTC (rev 3913) +++ branches/transforms/lib/matplotlib/artist.py2007-10-04 18:57:27 UTC (rev 3914) @@ -350,7 +350,7 @@ def _set_gc_clip(self, gc): 'set the clip properly for the gc' if self.clipbox is not None: -gc.set_clip_rectangle(self.clipbox.bounds) +gc.set_clip_rectangle(self.clipbox) gc.set_clip_path(self._clippath) def draw(self, renderer, *args, **kwargs): Modified: branches/transforms/lib/matplotlib/image.py === --- branches/transforms/lib/matplotlib/image.py 2007-10-04 17:22:01 UTC (rev 3913) +++ branches/transforms/lib/matplotlib/image.py 2007-10-04 18:57:27 UTC (rev 3914) @@ -149,17 +149,17 @@ dyintv = ymax-ymin # the viewport scale factor -sx = dxintv/self.axes.viewLim.width() -sy = dyintv/self.axes.viewLim.height() +sx = dxintv/self.axes.viewLim.width +sy = dyintv/self.axes.viewLim.height if im.get_interpolation()!=_image.NEAREST: im.apply_translation(-1, -1) # the viewport translation -tx = (xmin-self.axes.viewLim.xmin())/dxintv * numcols -ty = (ymin-self.axes.viewLim.ymin())/dyintv * numrows +tx = (xmin-self.axes.viewLim.xmin)/dxintv * numcols +ty = (ymin-self.axes.viewLim.ymin)/dyintv * numrows -l, b, widthDisplay, heightDisplay = self.axes.bbox.get_bounds() +l, b, widthDisplay, heightDisplay = self.axes.bbox.bounds widthDisplay *= magnification heightDisplay *= magnification @@ -180,8 +180,9 @@ def draw(self, renderer, *args, **kwargs): if not self.get_visible(): return im = self.make_image(renderer.get_image_magnification()) -l, b, widthDisplay, heightDisplay = self.axes.bbox.get_bounds() -renderer.draw_image(l, b, im, self.axes.bbox) +l, b, widthDisplay, heightDisplay = self.axes.bbox.bounds +print self.axes.bbox.frozen() +renderer.draw_image(l, b, im, self.axes.bbox.frozen()) def contains(self, mouseevent): Test whether the mouse event occured within the image. Modified: branches/transforms/lib/matplotlib/projections/polar.py === --- branches/transforms/lib/matplotlib/projections/polar.py 2007-10-04 17:22:01 UTC (rev 3913) +++ branches/transforms/lib/matplotlib/projections/polar.py 2007-10-04 18:57:27 UTC (rev 3914) @@ -12,14 +12,29 @@ IdentityTransform, Transform, TransformWrapper class PolarAxes(Axes): + +A polar graph projection, where the input dimensions are theta, r. + +Theta starts pointing east and goes anti-clockwise. + name = 'polar' class PolarTransform
SF.net SVN: matplotlib: [3927] trunk/matplotlib
Revision: 3927 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3927view=rev Author: mdboom Date: 2007-10-08 05:45:23 -0700 (Mon, 08 Oct 2007) Log Message: --- Save image resolution in the PNG file. Modified Paths: -- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py trunk/matplotlib/lib/matplotlib/backends/backend_gtkagg.py trunk/matplotlib/src/_backend_agg.cpp Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py === --- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2007-10-05 22:11:32 UTC (rev 3926) +++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2007-10-08 12:45:23 UTC (rev 3927) @@ -415,5 +415,5 @@ def print_png(self, filename, *args, **kwargs): self.draw() -self.get_renderer()._renderer.write_png(str(filename)) +self.get_renderer()._renderer.write_png(str(filename), self.figure.dpi.get()) Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gtkagg.py === --- trunk/matplotlib/lib/matplotlib/backends/backend_gtkagg.py 2007-10-05 22:11:32 UTC (rev 3926) +++ trunk/matplotlib/lib/matplotlib/backends/backend_gtkagg.py 2007-10-08 12:45:23 UTC (rev 3927) @@ -97,6 +97,8 @@ 0, 0, 0, 0, w, h) if DEBUG: print 'FigureCanvasGTKAgg.done' +def print_png(self, filename, *args, **kwargs): +return FigureCanvasAgg.print_png(self, filename, *args, **kwargs) \ Traceback (most recent call last): Modified: trunk/matplotlib/src/_backend_agg.cpp === --- trunk/matplotlib/src/_backend_agg.cpp 2007-10-05 22:11:32 UTC (rev 3926) +++ trunk/matplotlib/src/_backend_agg.cpp 2007-10-08 12:45:23 UTC (rev 3927) @@ -2283,7 +2283,7 @@ { _VERBOSE(RendererAgg::write_png); - args.verify_length(1); + args.verify_length(1, 2); FILE *fp; Py::Object o = Py::Object(args[0]); @@ -2344,6 +2344,13 @@ width, height, 8, PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); + + // Save the dpi of the image in the file + if (args.size() == 2) { +double dpi = Py::Float(args[1]); +size_t dots_per_meter = (size_t)(dpi / (2.54 / 100.0)); +png_set_pHYs(png_ptr, info_ptr, dots_per_meter, dots_per_meter, PNG_RESOLUTION_METER); + } // this a a color image! sig_bit.gray = 0; @@ -2619,7 +2626,7 @@ add_varargs_method(write_rgba, RendererAgg::write_rgba, write_rgba(fname)); add_varargs_method(write_png, RendererAgg::write_png, -write_png(fname)); +write_png(fname, dpi=None)); add_varargs_method(tostring_rgb, RendererAgg::tostring_rgb, s = tostring_rgb()); add_varargs_method(tostring_argb, RendererAgg::tostring_argb, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3929] branches/transforms
Revision: 3929 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3929view=rev Author: mdboom Date: 2007-10-08 11:15:05 -0700 (Mon, 08 Oct 2007) Log Message: --- Merged revisions 3925-3928 via svnmerge from http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib r3926 | efiring | 2007-10-05 18:11:32 -0400 (Fri, 05 Oct 2007) | 2 lines Fixed numpification bug in pcolor argument handling r3927 | mdboom | 2007-10-08 08:45:23 -0400 (Mon, 08 Oct 2007) | 2 lines Save image resolution in the PNG file. Modified Paths: -- branches/transforms/lib/matplotlib/axes.py branches/transforms/lib/matplotlib/backends/backend_agg.py branches/transforms/lib/matplotlib/backends/backend_gtkagg.py branches/transforms/src/_backend_agg.cpp Property Changed: branches/transforms/ Property changes on: branches/transforms ___ Name: svnmerge-integrated - /trunk/matplotlib:1-3924 + /trunk/matplotlib:1-3928 Modified: branches/transforms/lib/matplotlib/axes.py === --- branches/transforms/lib/matplotlib/axes.py 2007-10-08 18:10:11 UTC (rev 3928) +++ branches/transforms/lib/matplotlib/axes.py 2007-10-08 18:15:05 UTC (rev 3929) @@ -4390,7 +4390,30 @@ return im +def _pcolorargs(self, funcname, *args): +if len(args)==1: +C = args[0] +numRows, numCols = C.shape +X, Y = npy.meshgrid(npy.arange(numCols+1), npy.arange(numRows+1) ) +elif len(args)==3: +X, Y, C = args +else: +raise TypeError( +'Illegal arguments to %s; see help(%s)' % (funcname, funcname)) +Nx = X.shape[-1] +Ny = Y.shape[0] +if len(X.shape) 2 or X.shape[0] == 1: +x = X.reshape(1,Nx) +X = x.repeat(Ny, axis=0) +if len(Y.shape) 2 or Y.shape[1] == 1: +y = Y.reshape(Ny, 1) +Y = y.repeat(Nx, axis=1) +if X.shape != Y.shape: +raise TypeError( +'Incompatible X, Y inputs to %s; see help(%s)' % (funcname, funcname)) +return X, Y, C + def pcolor(self, *args, **kwargs): pcolor(*args, **kwargs): pseudocolor plot of a 2-D array @@ -4502,25 +4525,9 @@ vmax = kwargs.pop('vmax', None) shading = kwargs.pop('shading', 'flat') -if len(args)==1: -C = args[0] -numRows, numCols = C.shape -X, Y = npy.meshgrid(npy.arange(numCols+1), npy.arange(numRows+1) ) -elif len(args)==3: -X, Y, C = args -numRows, numCols = C.shape -else: -raise TypeError, 'Illegal arguments to pcolor; see help(pcolor)' +X, Y, C = self._pcolorargs('pcolor', *args) +Ny, Nx = X.shape -Nx = X.shape[-1] -Ny = Y.shape[0] -if len(X.shape) 2 or X.shape[0] == 1: -X = X.ravel().resize((Ny, Nx)) -if len(Y.shape) 2 or Y.shape[1] == 1: -Y = Y.ravel().resize((Nx, Ny)).T - - - # convert to MA, if necessary. C = ma.asarray(C) X = ma.asarray(X) @@ -4655,23 +4662,9 @@ shading = kwargs.pop('shading', 'flat') edgecolors = kwargs.pop('edgecolors', 'None') -if len(args)==1: -C = args[0] -numRows, numCols = C.shape -X, Y = npy.meshgrid(npy.arange(numCols+1), npy.arange(numRows+1) ) -elif len(args)==3: -X, Y, C = args -numRows, numCols = C.shape -else: -raise TypeError, 'Illegal arguments to pcolormesh; see help(pcolormesh)' +X, Y, C = self._pcolorargs('pcolormesh', *args) +Ny, Nx = X.shape -Nx = X.shape[-1] -Ny = Y.shape[0] -if len(X.shape) 2 or X.shape[0] == 1: -X = X.ravel().resize((Ny, Nx)) -if len(Y.shape) 2 or Y.shape[1] == 1: -Y = Y.ravel().resize((Nx, Ny)).T - # convert to one dimensional arrays C = ma.ravel(C[0:Ny-1, 0:Nx-1]) # data point in each cell is value at lower left corner X = X.ravel() Modified: branches/transforms/lib/matplotlib/backends/backend_agg.py === --- branches/transforms/lib/matplotlib/backends/backend_agg.py 2007-10-08 18:10:11 UTC (rev 3928) +++ branches/transforms/lib/matplotlib/backends/backend_agg.py 2007-10-08 18:15:05 UTC (rev 3929) @@ -387,5 +387,5 @@ def print_png(self, filename, *args, **kwargs): self.draw() -self.get_renderer()._renderer.write_png(str(filename)) +self.get_renderer()._renderer.write_png(str(filename), self.figure.dpi.get()) Modified: branches/transforms/lib/matplotlib/backends/backend_gtkagg.py
SF.net SVN: matplotlib: [3934] branches/transforms
Revision: 3934 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3934view=rev Author: mdboom Date: 2007-10-11 08:42:53 -0700 (Thu, 11 Oct 2007) Log Message: --- Continued progress getting more examples to work. Working examples (with TkAgg backend only) are marked in PASSED_DEMOS for the curious. Modified Paths: -- branches/transforms/examples/histogram_demo_canvasagg.py branches/transforms/examples/line_collection2.py branches/transforms/examples/pick_event_demo.py branches/transforms/lib/matplotlib/axes.py branches/transforms/lib/matplotlib/axis.py branches/transforms/lib/matplotlib/collections.py branches/transforms/lib/matplotlib/colorbar.py branches/transforms/lib/matplotlib/colors.py branches/transforms/lib/matplotlib/figure.py branches/transforms/lib/matplotlib/image.py branches/transforms/lib/matplotlib/legend.py branches/transforms/lib/matplotlib/lines.py branches/transforms/lib/matplotlib/mathtext.py branches/transforms/lib/matplotlib/patches.py branches/transforms/lib/matplotlib/ticker.py branches/transforms/lib/matplotlib/transforms.py branches/transforms/src/_backend_agg.cpp branches/transforms/src/_backend_agg.h Added Paths: --- branches/transforms/PASSED_DEMOS Added: branches/transforms/PASSED_DEMOS === --- branches/transforms/PASSED_DEMOS(rev 0) +++ branches/transforms/PASSED_DEMOS2007-10-11 15:42:53 UTC (rev 3934) @@ -0,0 +1,210 @@ +accented_text.pyO +agg_buffer_to_array.py O +agg_oo.py O +agg_resize.py [BROKEN IN TRUNK] +agg_test.py +alignment_test.py O +animation_blit_fltk.py +animation_blit.py +animation_blit_qt4.py +animation_blit_qt.py +animation_blit_tk.py +animation_blit_wx.py +anim.py O [BUT SLOWER] +annotation_demo.py O +anscombe.pyO +arctest.py O +arrow_demo.py O +axes_demo.py O +axes_props.py [SOMETHING FUNNY ABOUT DASHED LINES] +axhspan_demo.pyO +axis_equal_demo.py O +backend_driver.py +barchart_demo.pyO +barcode_demo.py O +barh_demo.py [BROKEN IN TRUNK] +bar_stacked.py O +boxplot_demo.pyO +break.py O +broken_barh.py O +clippath_test.py O +clippedline.py O +collections_demo.py -- [NEEDS ADDITIONAL WORK] +colorbar_only.py O +color_by_yvalue.py O +color_demo.py O +colours.py [???] +contour_demo.py +contourf_demo.py +contour_image.py +coords_demo.py O +coords_report.py O +csd_demo.pyO +cursor_demo.py O +custom_figure_class.py [EXCEPT FOR PS OUTPUT] +customize_rc.py +custom_ticker1.py O +dannys_example.py [REQUIRES NUMERIC] +dash_control.pyO +dashpointlabel.py O +dashtick.py +data_browser.pyO +data_helper.py [N/A] +date_demo1.py O +date_demo2.py O +date_demo_convert.py O [PASSES] +date_demo_rrule.py O [PASSES] +date_index_formatter.py O [PASSES] +dynamic_collection.py O +dynamic_demo.py[GTK] +dynamic_demo_wx.py [WX] +dynamic_image_gtkagg.py +dynamic_image_wxagg2.py +dynamic_image_wxagg.py +ellipse_demo.pyO +ellipse_rotated.py O +embedding_in_gtk2.py +embedding_in_gtk3.py +embedding_in_gtk.py +embedding_in_qt4.py +embedding_in_qt.py +embedding_in_tk2.py +embedding_in_tk.py +embedding_in_wx2.py +embedding_in_wx3.py +embedding_in_wx4.py +embedding_in_wx.py +errorbar_demo.py O +errorbar_limits.py O +figimage_demo.py O +figlegend_demo.py [HORRIBLY BROKEN] +figtext.py O +fill_between_posneg.py O +fill_between.pyO +fill_demo2.py O +fill_demo.py O +fill_spiral.py O +finance_demo.pyO +font_indexing.py O +fonts_demo_kw.py O +fonts_demo.py O +font_table_ttf.py [N/A] +ftface_props.py[N/A] +ganged_plots.pyO +glyph_to_path.py [Requires PIL] +gradient_bar.pyO +gtk_spreadsheet.py +hatch_demo.py [Requires PS] +histogram_demo_canvasagg.py [???] +histogram_demo.py O +image_demo2.py O +image_demo3.py [Requires PIL] +image_demo.py O +image_interp.pyO +image_masked.pyO [Whew!] +image_origin.pyO +image_slices_viewer.py [BROKEN ON TRUNK] +__init__.py +integral_demo.py O +interactive2.py[N/A] +interactive.py [N/A] +interp_demo.py O +invert_axes.py O +keypress_demo.py [BROKEN IN TRUNK] +lasso_demo.py O +layer_images.pyO +legend_auto.py [WEIRD z-order problem in figure 10] +legend_demo2.pyO
SF.net SVN: matplotlib: [3947] branches/transforms/lib/matplotlib
Revision: 3947 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3947view=rev Author: mdboom Date: 2007-10-15 06:49:25 -0700 (Mon, 15 Oct 2007) Log Message: --- Significant speed improvement in text layout. Reverted to fix bug in ticklabels. Lots of other minor things. Modified Paths: -- branches/transforms/lib/matplotlib/axes.py branches/transforms/lib/matplotlib/axis.py branches/transforms/lib/matplotlib/collections.py branches/transforms/lib/matplotlib/lines.py branches/transforms/lib/matplotlib/path.py branches/transforms/lib/matplotlib/text.py branches/transforms/lib/matplotlib/transforms.py Modified: branches/transforms/lib/matplotlib/axes.py === --- branches/transforms/lib/matplotlib/axes.py 2007-10-14 21:14:18 UTC (rev 3946) +++ branches/transforms/lib/matplotlib/axes.py 2007-10-15 13:49:25 UTC (rev 3947) @@ -1037,6 +1037,7 @@ a.set_axes(self) self.artists.append(a) self._set_artist_props(a) +a.set_clip_path(self.axesPatch) a._remove_method = lambda h: self.artists.remove(h) def add_collection(self, collection, autolim=False): @@ -1091,6 +1092,7 @@ 'Add a table instance to the list of axes tables' self._set_artist_props(tab) self.tables.append(tab) +tab.set_clip_path(self.axesPatch) tab._remove_method = lambda h: self.tables.remove(h) def relim(self): Modified: branches/transforms/lib/matplotlib/axis.py === --- branches/transforms/lib/matplotlib/axis.py 2007-10-14 21:14:18 UTC (rev 3946) +++ branches/transforms/lib/matplotlib/axis.py 2007-10-15 13:49:25 UTC (rev 3947) @@ -91,7 +91,6 @@ self._size = size self._padPixels = self.figure.dpi * self._pad * (1/72.0) -self._locTransform = Affine2D() self.tick1line = self._get_tick1line() self.tick2line = self._get_tick2line() @@ -286,7 +285,7 @@ markersize=self._size, ) -l.set_transform(self._locTransform + self.axes.get_xaxis_transform()) +l.set_transform(self.axes.get_xaxis_transform()) self._set_artist_props(l) return l @@ -298,16 +297,20 @@ linestyle=rcParams['grid.linestyle'], linewidth=rcParams['grid.linewidth'], ) -l.set_transform(self._locTransform + self.axes.get_xaxis_transform()) +l.set_transform(self.axes.get_xaxis_transform()) self._set_artist_props(l) return l def update_position(self, loc): 'Set the location of tick in data coords with scalar loc' -self._locTransform.clear().translate(loc, 0.0) -self.label1.set_x(loc) -self.label2.set_x(loc) +x = loc + +self.tick1line.set_xdata((x,)) +self.tick2line.set_xdata((x,)) +self.gridline.set_xdata((x, )) +self.label1.set_x(x) +self.label2.set_x(x) self._loc = loc def get_view_interval(self): @@ -385,7 +388,7 @@ linestyle = 'None', markersize=self._size, ) -l.set_transform(self._locTransform + self.axes.get_yaxis_transform()) +l.set_transform(self.axes.get_yaxis_transform()) self._set_artist_props(l) return l @@ -398,7 +401,7 @@ markersize=self._size, ) -l.set_transform(self._locTransform + self.axes.get_yaxis_transform()) +l.set_transform(self.axes.get_yaxis_transform()) self._set_artist_props(l) return l @@ -411,19 +414,24 @@ linewidth=rcParams['grid.linewidth'], ) -l.set_transform(self._locTransform + self.axes.get_yaxis_transform()) +l.set_transform(self.axes.get_yaxis_transform()) self._set_artist_props(l) return l def update_position(self, loc): 'Set the location of tick in data coords with scalar loc' -self._locTransform.clear().translate(0.0, loc) -self.label1.set_y(loc) -self.label2.set_y(loc) +y = loc +self.tick1line.set_ydata((y,)) +self.tick2line.set_ydata((y,)) +self.gridline.set_ydata((y, )) + +self.label1.set_y( y ) +self.label2.set_y( y ) + self._loc = loc - + def get_view_interval(self): 'return the Interval instance for this axis view limits' return self.axes.viewLim.intervaly @@ -751,7 +759,7 @@ if len(self.minorTicks) numticks: # update the new tick label properties from the old for i in range(numticks - len(self.minorTicks)): -tick = self._get_tick(minor=True) +tick = self._get_tick
SF.net SVN: matplotlib: [3953] trunk/matplotlib/ttconv/ttutil.cpp
Revision: 3953 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3953view=rev Author: mdboom Date: 2007-10-16 05:28:49 -0700 (Tue, 16 Oct 2007) Log Message: --- Fix build on Windows with MSVC .NET 2003 Modified Paths: -- trunk/matplotlib/ttconv/ttutil.cpp Modified: trunk/matplotlib/ttconv/ttutil.cpp === --- trunk/matplotlib/ttconv/ttutil.cpp 2007-10-15 21:22:03 UTC (rev 3952) +++ trunk/matplotlib/ttconv/ttutil.cpp 2007-10-16 12:28:49 UTC (rev 3953) @@ -32,14 +32,14 @@ va_start(arg_list, format); char buffer[PRINTF_BUFFER_SIZE]; -#ifdef WIN32 +#if defined(WIN32) || defined(_MSC_VER) int size = _vsnprintf(buffer, PRINTF_BUFFER_SIZE, format, arg_list); #else int size = vsnprintf(buffer, PRINTF_BUFFER_SIZE, format, arg_list); #endif if (size = PRINTF_BUFFER_SIZE) { char* buffer2 = (char*)malloc(size); -#ifdef WIN32 +#if defined(WIN32) || defined(_MSC_VER) _vsnprintf(buffer2, size, format, arg_list); #else vsnprintf(buffer2, size, format, arg_list); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3955] branches/transforms/lib/matplotlib
Revision: 3955 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3955view=rev Author: mdboom Date: 2007-10-16 07:17:53 -0700 (Tue, 16 Oct 2007) Log Message: --- First pass at PS backend updates. Modified Paths: -- branches/transforms/lib/matplotlib/backend_bases.py branches/transforms/lib/matplotlib/backends/backend_ps.py branches/transforms/lib/matplotlib/cbook.py branches/transforms/lib/matplotlib/collections.py branches/transforms/lib/matplotlib/lines.py branches/transforms/lib/matplotlib/path.py branches/transforms/lib/matplotlib/transforms.py Modified: branches/transforms/lib/matplotlib/backend_bases.py === --- branches/transforms/lib/matplotlib/backend_bases.py 2007-10-16 13:45:59 UTC (rev 3954) +++ branches/transforms/lib/matplotlib/backend_bases.py 2007-10-16 14:17:53 UTC (rev 3955) @@ -49,7 +49,62 @@ trans is an affine transform applied to the path. raise NotImplementedError - + +def draw_path_collection(self, master_transform, cliprect, clippath, + clippath_trans, paths, all_transforms, offsets, + offsetTrans, facecolors, edgecolors, linewidths, + linestyles, antialiaseds): + +MGDTODO: Document me. Explain that often the backend will not +want to override this. + +Npaths = len(paths) +Noffsets= len(offsets) +N = max(Npaths, Noffsets) +Ntransforms = min(len(all_transforms), N) +Nfacecolors = len(facecolors) +Nedgecolors = len(edgecolors) +Nlinewidths = len(linewidths) +Nlinestyles = len(linestyles) +Naa = len(antialiaseds) + +if (Nfacecolors == 0 and Nedgecolors == 0) or N == 0: +return + +ttransforms = [] +for i in range(Ntransforms): +transform = all_transforms[i] +if transform is None: +transform = transforms.IdentityTransform() +ttransforms.append((transform + master_transform).frozen()) + +toffsets = offsetTrans.transform(offsets) + +gc = self.new_gc() +gc.set_clip_rectangle(cliprect) +if clippath is not None: +clippath = transforms.TransformedPath(clippath, clippath_trans) +gc.set_clippath(clippath) + +if Nfacecolors == 0: +rgbFace = None + +print linewidths, edgecolors + +for i in xrange(N): +path = paths[i % Npaths] +xo, yo = toffsets[i % Noffsets] +transform = ttransforms[i % Ntransforms].frozen().translate(xo, yo) +if Nfacecolors: +rgbFace = facecolors[i % Nfacecolors] +if Nedgecolors: +gc.set_foreground(edgecolors[i % Nedgecolors]) +gc.set_linewidth(linewidths[i % Nlinewidths]) +gc.set_dashes(*linestyles[i % Nlinestyles]) +gc.set_antialiased(antialiaseds[i % Naa]) + +self.draw_path(gc, path, transform, rgbFace) + def get_image_magnification(self): Get the factor by which to magnify images passed to draw_image. @@ -78,328 +133,6 @@ return False -## -## OLD API IS BELOW -## These functions no longer need to be implemented in the backends -- -## they now perform all of their functions in terms of the new API. - -# def draw_arc(self, gc, rgbFace, x, y, width, height, angle1, angle2, -# rotation): -# -# Draw an arc using GraphicsContext instance gcEdge, centered at x,y, -# with width and height and angles from 0.0 to 360.0 -# 0 degrees is at 3-o'clock -# positive angles are anti-clockwise -# draw rotated 'rotation' degrees anti-clockwise about x,y - -# If the color rgbFace is not None, fill the arc with it. -# -# raise NotImplementedError - -# def draw_line_collection(self, segments, transform, clipbox, -# colors, linewidths, linestyle, antialiaseds, -# offsets, transOffset): -# -# This is a function for optimized line drawing. If you need to draw -# many line segments with similar properties, it is faster to avoid the -# overhead of all the object creation etc. The lack of total -# configurability is compensated for with efficiency. Hence we don't use -# a GC and many of the line props it supports. See -# matplotlib.collections for more details. - -# segments is a sequence of ( line0, line1, line2), where linen = -# is an Mx2 array with columns x, y. Each line can
SF.net SVN: matplotlib: [3956] branches/transforms
Revision: 3956 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3956view=rev Author: mdboom Date: 2007-10-16 07:35:12 -0700 (Tue, 16 Oct 2007) Log Message: --- Merged revisions 3933-3955 via svnmerge from http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib r3935 | mdboom | 2007-10-11 13:03:50 -0400 (Thu, 11 Oct 2007) | 1 line Fixed minor import bug r3941 | jdh2358 | 2007-10-14 15:00:50 -0400 (Sun, 14 Oct 2007) | 1 line added ellipse compare script r3949 | jdh2358 | 2007-10-15 16:00:54 -0400 (Mon, 15 Oct 2007) | 3 lines fixed an aspect=auto problem with bezier ellipse approx r3950 | jdh2358 | 2007-10-15 16:52:32 -0400 (Mon, 15 Oct 2007) | 2 lines Fixed a texst clipping bug in backend agg r3951 | jdh2358 | 2007-10-15 17:08:35 -0400 (Mon, 15 Oct 2007) | 2 lines Fixed an annotation unit bug r3952 | jdh2358 | 2007-10-15 17:22:03 -0400 (Mon, 15 Oct 2007) | 2 lines fixed a unit problem with annotations r3953 | mdboom | 2007-10-16 08:28:49 -0400 (Tue, 16 Oct 2007) | 1 line Fix build on Windows with MSVC .NET 2003 r3954 | jdh2358 | 2007-10-16 09:45:59 -0400 (Tue, 16 Oct 2007) | 2 lines restored unit support for ellipses -- and added examples/units/ellipse_with_units.py Modified Paths: -- branches/transforms/CHANGELOG branches/transforms/boilerplate.py branches/transforms/lib/matplotlib/backends/backend_ps.py branches/transforms/lib/matplotlib/cbook.py branches/transforms/lib/matplotlib/mlab.py branches/transforms/lib/matplotlib/patches.py branches/transforms/lib/matplotlib/text.py branches/transforms/src/_backend_agg.cpp branches/transforms/ttconv/ttutil.cpp branches/transforms/unit/ellipse_compare.py Added Paths: --- branches/transforms/examples/units/annotate_with_units.py branches/transforms/examples/units/ellipse_with_units.py Property Changed: branches/transforms/ Property changes on: branches/transforms ___ Name: svnmerge-integrated - /trunk/matplotlib:1-3932 + /trunk/matplotlib:1-3955 Modified: branches/transforms/CHANGELOG === --- branches/transforms/CHANGELOG 2007-10-16 14:17:53 UTC (rev 3955) +++ branches/transforms/CHANGELOG 2007-10-16 14:35:12 UTC (rev 3956) @@ -1,3 +1,12 @@ +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 Modified: branches/transforms/boilerplate.py === --- branches/transforms/boilerplate.py 2007-10-16 14:17:53 UTC (rev 3955) +++ branches/transforms/boilerplate.py 2007-10-16 14:35:12 UTC (rev 3956) @@ -2,10 +2,9 @@ # file is pasted into pylab.py. We did try to do this the smart way, # with callable functions and new.function, but could never get the # docstrings right for python2.2. See -# http://groups-beta.google.com/group/comp.lang.python/messages/1b14640f3a4ad3dc,b3d7453af21e5f82,17739e70ac6f710c,9d5291fce29cbbb1,c5b578e4ffc6af28,056ff270daa2f414?thread_id=dcd63ec13096a0f6mode=thread +# http://groups.google.com/group/comp.lang.python/browse_frm/thread/dcd63ec13096a0f6/1b14640f3a4ad3dc?#1b14640f3a4ad3dc - # note we check for __doc__ is not None since py2exe optimize removes # the docstrings Copied: branches/transforms/examples/units/annotate_with_units.py (from rev 3954, trunk/matplotlib/examples/units/annotate_with_units.py) === --- branches/transforms/examples/units/annotate_with_units.py (rev 0) +++ branches/transforms/examples/units/annotate_with_units.py 2007-10-16 14:35:12 UTC (rev 3956) @@ -0,0 +1,27 @@ + +import pylab +from basic_units import cm + +fig = pylab.figure() +ax = fig.add_subplot(111) + + +ax.annotate( Note 01, [0.5*cm, 0.5*cm] ) + +# xy and text both unitized +ax.annotate('local max', xy=(3*cm, 1*cm), xycoords='data', +xytext=(0.8*cm, 0.95*cm), textcoords='data', +arrowprops=dict(facecolor='black', shrink=0.05), +horizontalalignment='right', verticalalignment='top') + +# mixing units w/ nonunits +ax.annotate('local max', xy=(3*cm, 1*cm), xycoords
SF.net SVN: matplotlib: [3963] trunk/matplotlib/lib/matplotlib/backends/ backend_pdf.py
Revision: 3963 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3963view=rev Author: mdboom Date: 2007-10-18 10:40:30 -0700 (Thu, 18 Oct 2007) Log Message: --- Major speedup in PDF backend by using hasattr() rather than 'in dir()' 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-10-18 15:06:49 UTC (rev 3962) +++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2007-10-18 17:40:30 UTC (rev 3963) @@ -105,7 +105,7 @@ Map Python objects to PDF syntax. # Some objects defined later have their own pdfRepr method. -if 'pdfRepr' in dir(obj): +if hasattr(obj, 'pdfRepr'): return obj.pdfRepr() # Floats. PDF does not have exponential notation (1.0e-10) so we This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3965] branches/transforms
Revision: 3965 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3965view=rev Author: mdboom Date: 2007-10-18 11:11:59 -0700 (Thu, 18 Oct 2007) Log Message: --- First pass at working PDF backend. Modified Paths: -- branches/transforms/lib/matplotlib/backends/backend_pdf.py branches/transforms/lib/matplotlib/backends/backend_ps.py branches/transforms/lib/matplotlib/projections/polar.py branches/transforms/lib/matplotlib/transforms.py branches/transforms/src/_backend_agg.cpp Modified: branches/transforms/lib/matplotlib/backends/backend_pdf.py === --- branches/transforms/lib/matplotlib/backends/backend_pdf.py 2007-10-18 18:07:06 UTC (rev 3964) +++ branches/transforms/lib/matplotlib/backends/backend_pdf.py 2007-10-18 18:11:59 UTC (rev 3965) @@ -33,7 +33,10 @@ LOAD_NO_HINTING, KERNING_UNFITTED from matplotlib.mathtext import MathTextParser from matplotlib.transforms import Bbox +from matplotlib.path import Path from matplotlib import ttconv +# MGDTODO: Move this stuff +from matplotlib.backends._backend_agg import get_path_extents # Overview # @@ -90,22 +93,26 @@ Make one string from sequence of strings, with whitespace in between. The whitespace is chosen to form lines of at most linelen characters, if possible. - -s, strings = [strings[0]], strings[1:] -while strings: -if len(s[-1]) + len(strings[0]) linelen: -s[-1] += ' ' + strings[0] +currpos = 0 +lasti = 0 +result = [] +for i, s in enumerate(strings): +length = len(s) +if currpos + length linelen: +currpos += length + 1 else: -s.append(strings[0]) -strings = strings[1:] -return '\n'.join(s) +result.append(' '.join(strings[lasti:i])) +lasti = i +currpos = length +result.append(' '.join(strings[lasti:])) +return '\n'.join(result) def pdfRepr(obj): Map Python objects to PDF syntax. # Some objects defined later have their own pdfRepr method. -if 'pdfRepr' in dir(obj): +if hasattr(obj, 'pdfRepr'): return obj.pdfRepr() # Floats. PDF does not have exponential notation (1.0e-10) so we @@ -164,6 +171,13 @@ else: r += -%02d'%02d' % (z//3600, z%3600) return pdfRepr(r) +# A bounding box +elif isinstance(obj, Bbox): +r = [[] +r.extend([pdfRepr(val) for val in obj.lbrt]) +r.append(]) +return fill(r) + else: raise TypeError, \ Don't know a PDF representation for %s objects. \ @@ -379,7 +393,6 @@ self.markers = {} self.two_byte_charprocs = {} -self.nextMarker = 1 # The PDF spec recommends to include every procset procsets = [ Name(x) @@ -409,8 +422,8 @@ for val in self.alphaStates.values()])) self.writeHatches() xobjects = dict(self.images.values()) -for name, value in self.markers.items(): -xobjects[name] = value[0] +for tup in self.markers.values(): +xobjects[tup[0]] = tup[1] for name, value in self.two_byte_charprocs.items(): xobjects[name] = value self.writeObject(self.XObjectObject, xobjects) @@ -1009,71 +1022,64 @@ img.flipud_out() -def markerObject(self, path, fillp, lw): +def markerObject(self, path, trans, fillp, lw): Return name of a marker XObject representing the given path. - -name = Name('M%d' % self.nextMarker) -ob = self.reserveObject('marker %d' % self.nextMarker) -self.nextMarker += 1 -self.markers[name] = (ob, path, fillp, lw) +key = (path, trans) +result = self.markers.get(key) +if result is None: +name = Name('M%d' % len(self.markers)) +ob = self.reserveObject('marker %d' % len(self.markers)) +self.markers[key] = (name, ob, path, trans, fillp, lw) +else: +name = result[0] return name - + def writeMarkers(self): -for name, tuple in self.markers.items(): -object, path, fillp, lw = tuple +for tup in self.markers.values(): +name, object, path, trans, fillp, lw = tup +a, b, c, d = get_path_extents(path, trans) +bbox = Bbox.from_lbrt(*get_path_extents(path, trans)) +bbox = bbox.padded(lw * 0.5) self.beginStream( object.id, None, {'Type': Name('XObject'), 'Subtype': Name('Form'), - 'BBox': self.pathBbox(path, lw) }) -self.writePath(path, fillp) + 'BBox': bbox }) +self.writePath(path, trans) +if fillp: +self.output(Op.fill_stroke) +else: +self.output(Op.stroke
SF.net SVN: matplotlib: [3964] trunk/matplotlib/lib/matplotlib/backends/ backend_pdf.py
Revision: 3964 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3964view=rev Author: mdboom Date: 2007-10-18 11:07:06 -0700 (Thu, 18 Oct 2007) Log Message: --- Faster version of fill() for PDF writing 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-10-18 17:40:30 UTC (rev 3963) +++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2007-10-18 18:07:06 UTC (rev 3964) @@ -90,15 +90,19 @@ Make one string from sequence of strings, with whitespace in between. The whitespace is chosen to form lines of at most linelen characters, if possible. - -s, strings = [strings[0]], strings[1:] -while strings: -if len(s[-1]) + len(strings[0]) linelen: -s[-1] += ' ' + strings[0] +currpos = 0 +lasti = 0 +result = [] +for i, s in enumerate(strings): +length = len(s) +if currpos + length linelen: +currpos += length + 1 else: -s.append(strings[0]) -strings = strings[1:] -return '\n'.join(s) +result.append(' '.join(strings[lasti:i])) +lasti = i +currpos = length +result.append(' '.join(strings[lasti:])) +return '\n'.join(result) def pdfRepr(obj): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3981] branches/transforms/lib/matplotlib/ projections/polar.py
Revision: 3981 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3981view=rev Author: mdboom Date: 2007-10-23 07:23:19 -0700 (Tue, 23 Oct 2007) Log Message: --- Decreasing polar interpolation resolution. Modified Paths: -- branches/transforms/lib/matplotlib/projections/polar.py Modified: branches/transforms/lib/matplotlib/projections/polar.py === --- branches/transforms/lib/matplotlib/projections/polar.py 2007-10-21 21:19:51 UTC (rev 3980) +++ branches/transforms/lib/matplotlib/projections/polar.py 2007-10-23 14:23:19 UTC (rev 3981) @@ -151,7 +151,7 @@ def refresh(self): return self.base.refresh() -RESOLUTION = 100 +RESOLUTION = 50 def __init__(self, *args, **kwargs): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3984] branches/transforms
Revision: 3984 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3984view=rev Author: mdboom Date: 2007-10-23 07:30:57 -0700 (Tue, 23 Oct 2007) Log Message: --- Merged revisions 3962-3983 via svnmerge from http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib r3963 | mdboom | 2007-10-18 13:40:30 -0400 (Thu, 18 Oct 2007) | 1 line Major speedup in PDF backend by using hasattr() rather than 'in dir()' r3964 | mdboom | 2007-10-18 14:07:06 -0400 (Thu, 18 Oct 2007) | 1 line Faster version of fill() for PDF writing r3966 | jdh2358 | 2007-10-19 10:23:48 -0400 (Fri, 19 Oct 2007) | 2 lines fixed a verbose report bug in patches r3967 | dsdale | 2007-10-19 10:43:21 -0400 (Fri, 19 Oct 2007) | 2 lines removed a gsave/grestore pair surrounding _draw_ps r3968 | dsdale | 2007-10-19 11:37:41 -0400 (Fri, 19 Oct 2007) | 3 lines changed dependency check for ghostscript, which was failing to identify svn versions r3969 | dsdale | 2007-10-19 11:41:25 -0400 (Fri, 19 Oct 2007) | 2 lines whitespace cleanup r3975 | jdh2358 | 2007-10-21 12:02:07 -0400 (Sun, 21 Oct 2007) | 1 line added a show method for gtk fig manager Modified Paths: -- branches/transforms/CHANGELOG branches/transforms/lib/matplotlib/__init__.py branches/transforms/lib/matplotlib/backends/backend_gtk.py branches/transforms/lib/matplotlib/backends/backend_ps.py branches/transforms/lib/matplotlib/collections.py branches/transforms/lib/matplotlib/config/checkdep.py branches/transforms/setup.py branches/transforms/setupext.py Property Changed: branches/transforms/ Property changes on: branches/transforms ___ Name: svnmerge-integrated - /trunk/matplotlib:1-3961 + /trunk/matplotlib:1-3983 Modified: branches/transforms/CHANGELOG === --- branches/transforms/CHANGELOG 2007-10-23 14:25:49 UTC (rev 3983) +++ branches/transforms/CHANGELOG 2007-10-23 14:30:57 UTC (rev 3984) @@ -1,3 +1,8 @@ +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 Modified: branches/transforms/lib/matplotlib/__init__.py === --- branches/transforms/lib/matplotlib/__init__.py 2007-10-23 14:25:49 UTC (rev 3983) +++ branches/transforms/lib/matplotlib/__init__.py 2007-10-23 14:30:57 UTC (rev 3984) @@ -149,13 +149,10 @@ # --verbose-silent or --verbose-helpful _commandLineVerbose = None - for arg in sys.argv[1:]: if not arg.startswith('--verbose-'): continue _commandLineVerbose = arg[10:] - - def __init__(self): self.set_level('silent') self.fileo = sys.stdout @@ -195,8 +192,6 @@ return True return False - - def wrap(self, fmt, func, level='helpful', always=True): return a callable function that wraps func and reports it @@ -225,6 +220,7 @@ verbose=Verbose() + def checkdep_dvipng(): try: stdin, stdout = os.popen4('dvipng -version') @@ -243,7 +239,7 @@ command = 'gs -v' stdin, stdout = os.popen4(command) line = stdout.readlines()[0] -v = line.split()[2] +v = line.split()[-2] vtest = '.'.join(v.split('.')[:2]) # deal with version numbers like '7.07.1' float(vtest) return vtest Modified: branches/transforms/lib/matplotlib/backends/backend_gtk.py === --- branches/transforms/lib/matplotlib/backends/backend_gtk.py 2007-10-23 14:25:49 UTC (rev 3983) +++ branches/transforms/lib/matplotlib/backends/backend_gtk.py 2007-10-23 14:30:57 UTC (rev 3984) @@ -390,7 +390,7 @@ self.window = gtk.Window() self.window.set_title(Figure %d % num) - + self.vbox = gtk.VBox() self.window.add(self.vbox) self.vbox.show() @@ -439,7 +439,10 @@ gtk.main_level() = 1: gtk.main_quit() - +def show(self): +# show the figure window +self.window.show() + def full_screen_toggle (self): self._full_screen_flag = not self._full_screen_flag if self._full_screen_flag: Modified: branches/transforms/lib/matplotlib/backends/backend_ps.py === --- branches/transforms/lib
SF.net SVN: matplotlib: [3982] branches/transforms/lib/matplotlib/backends/ backend_pdf.py
Revision: 3982 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3982view=rev Author: mdboom Date: 2007-10-23 07:24:49 -0700 (Tue, 23 Oct 2007) Log Message: --- Marker objects should be keyed off of whether or not they are filled and their line width (since the line width affects the bounding box). 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-10-23 14:23:19 UTC (rev 3981) +++ branches/transforms/lib/matplotlib/backends/backend_pdf.py 2007-10-23 14:24:49 UTC (rev 3982) @@ -1024,7 +1024,7 @@ def markerObject(self, path, trans, fillp, lw): Return name of a marker XObject representing the given path. -key = (path, trans) +key = (path, trans, fillp is not None, lw) result = self.markers.get(key) if result is None: name = Name('M%d' % len(self.markers)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3985] branches/transforms/lib/matplotlib
Revision: 3985 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3985view=rev Author: mdboom Date: 2007-10-23 09:40:25 -0700 (Tue, 23 Oct 2007) Log Message: --- More progress on SVG. Refactored PS collection drawing to make it easier to reuse the (fairly complex) code. Modified Paths: -- branches/transforms/lib/matplotlib/backend_bases.py branches/transforms/lib/matplotlib/backends/backend_ps.py branches/transforms/lib/matplotlib/backends/backend_svg.py Modified: branches/transforms/lib/matplotlib/backend_bases.py === --- branches/transforms/lib/matplotlib/backend_bases.py 2007-10-23 14:30:57 UTC (rev 3984) +++ branches/transforms/lib/matplotlib/backend_bases.py 2007-10-23 16:40:25 UTC (rev 3985) @@ -55,13 +55,90 @@ offsetTrans, facecolors, edgecolors, linewidths, linestyles, antialiaseds): -MGDTODO: Document me. Explain that often the backend will not -want to override this. +This provides a fallback implementation of +draw_path_collection that makes multiple calls to draw_path. +Often, the backend will want to override this in order to +render each set of path data only once, and then reference +that path multiple times with the different offsets, colors, +styles etc. The methods _iter_collection_raw_paths and +_iter_collection are provided to help with (and standardize) +the implementation that in each backend. +path_ids = [] +for path, transform in self._iter_collection_raw_paths( +master_transform, paths, all_transforms): +path_ids.append((path, transform)) + +for xo, yo, path_id, gc, rgbFace in self._iter_collection( +path_ids, cliprect, clippath, clippath_trans, +offsets, offsetTrans, facecolors, edgecolors, +linewidths, linestyles, antialiaseds): +path, transform = path_id +transform = transform.frozen().translate(xo, yo) +self.draw_path(gc, path, transform, rgbFace) + +def _iter_collection_raw_paths(self, master_transform, paths, all_transforms): + +This is a helper method (along with _iter_collection) to make +it easier to write a space-efficent draw_path_collection +implementation in a backend. + +This method yields all of the base path/transform +combinations, given a master transform, a list of paths and +list of transforms. + +The arguments should be exactly what is passed in to +draw_path_collection. + +The backend should take each yielded path and transform and +create an object can be referenced (reused) later. + Npaths = len(paths) +Ntransforms = len(all_transforms) +N = max(Npaths, Ntransforms) + +if Npaths == 0: +return + +for i in xrange(N): +path = paths[i % Npaths] +transform = all_transforms[i % Ntransforms] +if transform is None: +transform = transforms.IdentityTransform() +transform += master_transform +yield path, transform + +def _iter_collection(self, path_ids, cliprect, clippath, clippath_trans, + offsets, offsetTrans, facecolors, edgecolors, + linewidths, linestyles, antialiaseds): + +This is a helper method (along with +_iter_collection_raw_paths) to make it easier to write a +space-efficent draw_path_collection implementation in a +backend. + +This method yields all of the path, offset and graphics +context combinations to draw the path collection. The caller +should already have looped over the results of +_iter_collection_raw_paths to draw this collection. + +The arguments should be the same as that passed into +draw_path_collection, with the exception of path_ids, which +is a list of arbitrary objects that the backend will use to +reference one of the paths created in the +_iter_collection_raw_paths stage. + +Each yielded result is of the form: + + xo, yo, path_id, gc, rgbFace + +where xo, yo is an offset; path_id is one of the elements of +path_ids; gc is a graphics context and rgbFace is a color to +use for filling the path. + +Npaths = len(path_ids) Noffsets= len(offsets) N = max(Npaths, Noffsets) -Ntransforms = min(len(all_transforms), N) Nfacecolors = len(facecolors) Nedgecolors = len(edgecolors) Nlinewidths = len(linewidths) @@ -71,16 +148,10 @@ if (Nfacecolors == 0 and Nedgecolors == 0) or Npaths == 0
SF.net SVN: matplotlib: [3986] branches/transforms/src/_backend_agg.cpp
Revision: 3986 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3986view=rev Author: mdboom Date: 2007-10-23 09:54:51 -0700 (Tue, 23 Oct 2007) Log Message: --- Fix bug that broke draw_image Modified Paths: -- branches/transforms/src/_backend_agg.cpp Modified: branches/transforms/src/_backend_agg.cpp === --- branches/transforms/src/_backend_agg.cpp2007-10-23 16:40:25 UTC (rev 3985) +++ branches/transforms/src/_backend_agg.cpp2007-10-23 16:54:51 UTC (rev 3986) @@ -48,17 +48,11 @@ PyArrayObject* matrix = NULL; try { -if (obj.ptr() == Py_None) { - if (errors) - throw Py::Exception(); - return agg::trans_affine(); -} +if (obj.ptr() == Py_None) + throw Py::Exception(); matrix = (PyArrayObject*) PyArray_FromObject(obj.ptr(), PyArray_DOUBLE, 2, 2); -if (!matrix) { - if (errors) - throw Py::Exception(); - return agg::trans_affine(); -} +if (!matrix) + throw Py::Exception(); if (matrix-nd == 2 || matrix-dimensions[0] == 3 || matrix-dimensions[1] == 3) { size_t stride0 = matrix-strides[0]; size_t stride1 = matrix-strides[1]; @@ -81,16 +75,16 @@ return agg::trans_affine(a, b, c, d, e, f); } + +throw Py::Exception(); } catch (...) { if (errors) { Py_XDECREF(matrix); - throw; + throw Py::TypeError(Invalid affine transformation matrix); } } Py_XDECREF(matrix); - if (errors) -throw Py::TypeError(Invalid affine transformation matrix); return agg::trans_affine(); } @@ -797,6 +791,7 @@ Py::Object RendererAgg::draw_image(const Py::Tuple args) { _VERBOSE(RendererAgg::draw_image); + args.verify_length(4, 6); float x = Py::Float(args[0]); @@ -807,7 +802,7 @@ agg::trans_affine clippath_trans; if (args.size() == 6) { clippath = args[4]; -clippath_trans = py_to_agg_transformation_matrix(args[5]); +clippath_trans = py_to_agg_transformation_matrix(args[5], false); } theRasterizer-reset_clipping(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3987] branches/transforms/lib/matplotlib/lines.py
Revision: 3987 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3987view=rev Author: mdboom Date: 2007-10-23 12:16:11 -0700 (Tue, 23 Oct 2007) Log Message: --- Fix bugs in log_demo.py Modified Paths: -- branches/transforms/lib/matplotlib/lines.py Modified: branches/transforms/lib/matplotlib/lines.py === --- branches/transforms/lib/matplotlib/lines.py 2007-10-23 16:54:51 UTC (rev 3986) +++ branches/transforms/lib/matplotlib/lines.py 2007-10-23 19:16:11 UTC (rev 3987) @@ -284,7 +284,6 @@ self._xorig = npy.asarray([]) self._yorig = npy.asarray([]) self.set_data(xdata, ydata) -self._logcache = None def contains(self, mouseevent): Test whether the mouse event occurred on the line. The pick radius determines @@ -386,6 +385,8 @@ self._xorig = x self._yorig = y self.recache() +else: +self._transformed_path = TransformedPath(self._path, self.get_transform()) def recache(self): #if self.axes is None: print 'recache no axes' @@ -418,7 +419,6 @@ self._xy = npy.concatenate((x, y), 1) self._x = self._xy[:, 0] # just a view self._y = self._xy[:, 1] # just a view -self._logcache = None # Masked arrays are now handled by the Path class itself self._path = Path(self._xy, closed=False) @@ -632,9 +632,7 @@ ACCEPTS: npy.array x = npy.asarray(x) -if x.shape != self._xorig.shape or npy.any(x != self._xorig): -self._xorig = x -self.recache() +self.set_data(x, self._yorig) def set_ydata(self, y): @@ -643,9 +641,7 @@ ACCEPTS: npy.array y = npy.asarray(y) -if y.shape != self._yorig.shape or npy.any(y != self._yorig): -self._yorig = y -self.recache() +self.set_data(self._xorig, y) def set_dashes(self, seq): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3988] branches/transforms/src/_backend_agg.cpp
Revision: 3988 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3988view=rev Author: mdboom Date: 2007-10-23 12:20:21 -0700 (Tue, 23 Oct 2007) Log Message: --- Reduce tendency to use aliased drawing. Modified Paths: -- branches/transforms/src/_backend_agg.cpp Modified: branches/transforms/src/_backend_agg.cpp === --- branches/transforms/src/_backend_agg.cpp2007-10-23 19:16:11 UTC (rev 3987) +++ branches/transforms/src/_backend_agg.cpp2007-10-23 19:20:21 UTC (rev 3988) @@ -434,7 +434,7 @@ } trans.transform(x1, y1); -if (!(fabs(x0 - x1) 0.1 || fabs(y0 - y1) 0.1)) { +if (!(fabs(x0 - x1) 0.001 || fabs(y0 - y1) 0.001)) { path.rewind(0); return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3989] branches/transforms/lib/matplotlib/backends/ backend_pdf.py
Revision: 3989 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3989view=rev Author: mdboom Date: 2007-10-23 12:47:43 -0700 (Tue, 23 Oct 2007) Log Message: --- Fix bug in clipping rectangle in PDF 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-10-23 19:20:21 UTC (rev 3988) +++ branches/transforms/lib/matplotlib/backends/backend_pdf.py 2007-10-23 19:47:43 UTC (rev 3989) @@ -32,7 +32,7 @@ from matplotlib.ft2font import FT2Font, FIXED_WIDTH, ITALIC, LOAD_NO_SCALE, \ LOAD_NO_HINTING, KERNING_UNFITTED from matplotlib.mathtext import MathTextParser -from matplotlib.transforms import Bbox +from matplotlib.transforms import Bbox, BboxBase from matplotlib.path import Path from matplotlib import ttconv # MGDTODO: Move this stuff @@ -172,11 +172,8 @@ return pdfRepr(r) # A bounding box -elif isinstance(obj, Bbox): -r = [[] -r.extend([pdfRepr(val) for val in obj.lbrt]) -r.append(]) -return fill(r) +elif isinstance(obj, BboxBase): +return fill([pdfRepr(val) for val in obj.bounds]) else: raise TypeError, \ @@ -1043,7 +1040,7 @@ self.beginStream( object.id, None, {'Type': Name('XObject'), 'Subtype': Name('Form'), - 'BBox': bbox }) + 'BBox': list(bbox.lbrt) }) self.writePath(path, trans) if fillp: self.output(Op.fill_stroke) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3990] branches/transforms/src/_backend_agg.cpp
Revision: 3990 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3990view=rev Author: mdboom Date: 2007-10-23 12:48:14 -0700 (Tue, 23 Oct 2007) Log Message: --- Fix bug affecting legend_auto.py Modified Paths: -- branches/transforms/src/_backend_agg.cpp Modified: branches/transforms/src/_backend_agg.cpp === --- branches/transforms/src/_backend_agg.cpp2007-10-23 19:47:43 UTC (rev 3989) +++ branches/transforms/src/_backend_agg.cpp2007-10-23 19:48:14 UTC (rev 3990) @@ -1568,12 +1568,12 @@ 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 (y *y0) *y0 = y; if (x *x1) *x1 = x; if (y *y1) *y1 = y; -if ((code agg::path_cmd_end_poly) == agg::path_cmd_end_poly) - continue; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3995] branches/transforms/lib/matplotlib/lines.py
Revision: 3995 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3995view=rev Author: mdboom Date: 2007-10-24 11:12:19 -0700 (Wed, 24 Oct 2007) Log Message: --- Fix masked array plotting again. Modified Paths: -- branches/transforms/lib/matplotlib/lines.py Modified: branches/transforms/lib/matplotlib/lines.py === --- branches/transforms/lib/matplotlib/lines.py 2007-10-24 18:01:26 UTC (rev 3994) +++ branches/transforms/lib/matplotlib/lines.py 2007-10-24 18:12:19 UTC (rev 3995) @@ -378,8 +378,10 @@ else: x, y = args -x = npy.asarray(x) -y = npy.asarray(y) +if not ma.isMaskedArray(x): +x = npy.asarray(x) +if not ma.isMaskedArray(y): +y = npy.asarray(y) if ((x.shape != self._xorig.shape or npy.any(x != self._xorig)) or (y.shape != self._yorig.shape or npy.any(y != self._yorig))): self._xorig = x @@ -666,6 +668,11 @@ renderer.draw_path(gc, path, trans) +def _draw_steps(self, renderer, gc, path, trans): +# MGDTODO: Implement me +raise NotImplementedError('steps' linestyle should be returning soon...) + + def _draw_dashed(self, renderer, gc, path, trans): gc.set_linestyle('dashed') if self._dashSeq is not None: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [3997] branches/transforms/lib/matplotlib
Revision: 3997 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3997view=rev Author: mdboom Date: 2007-10-24 12:22:00 -0700 (Wed, 24 Oct 2007) Log Message: --- Renamed [xmin, ymin, xmax, ymax] in Bbox to [x0, y0, x1, y1] and provide functions that really do give xmax etc. as well. Renamed lbrt to extents and lbwh to bounds (for consistency). Removed some dead code. Modified Paths: -- branches/transforms/lib/matplotlib/axes.py branches/transforms/lib/matplotlib/axis.py branches/transforms/lib/matplotlib/backend_bases.py branches/transforms/lib/matplotlib/backends/backend_agg.py branches/transforms/lib/matplotlib/backends/backend_pdf.py branches/transforms/lib/matplotlib/collections.py branches/transforms/lib/matplotlib/figure.py branches/transforms/lib/matplotlib/image.py branches/transforms/lib/matplotlib/legend.py branches/transforms/lib/matplotlib/lines.py branches/transforms/lib/matplotlib/patches.py branches/transforms/lib/matplotlib/path.py branches/transforms/lib/matplotlib/projections/polar.py branches/transforms/lib/matplotlib/text.py branches/transforms/lib/matplotlib/transforms.py Modified: branches/transforms/lib/matplotlib/axes.py === --- branches/transforms/lib/matplotlib/axes.py 2007-10-24 18:49:08 UTC (rev 3996) +++ branches/transforms/lib/matplotlib/axes.py 2007-10-24 19:22:00 UTC (rev 3997) @@ -480,7 +480,7 @@ if isinstance(rect, mtransforms.Bbox): self._position = rect else: -self._position = mtransforms.Bbox.from_lbwh(*rect) +self._position = mtransforms.Bbox.from_bounds(*rect) self._originalPosition = self._position.frozen() self.set_axes(self) self.set_aspect('auto') @@ -1696,7 +1696,7 @@ # Call all of the other y-axes that are shared with this one for other in self._shared_y_axes.get_siblings(self): if other is not self: - other.set_ylim(self.viewLim.ymin, self.viewLim.ymax, emit=False) + other.set_ylim(self.viewLim.intervaly, emit=False) if self.figure.canvas is not None: self.figure.canvas.draw_idle() @@ -1902,7 +1902,6 @@ if self.get_aspect() != 'auto': dx = 0.5 * (dx + dy) dy = dx -xmin, ymin, xmax, ymax = p.lim.lbrt alpha = npy.power(10.0, (dx, dy)) start = p.trans_inverse.transform_point((p.x, p.y)) @@ -5207,7 +5206,7 @@ figBottom = top - (rowNum+1)*figH - rowNum*sepH figLeft = left + colNum*(figW + sepW) -self.figbox = mtransforms.Bbox.from_lbwh(figLeft, figBottom, figW, figH) +self.figbox = mtransforms.Bbox.from_bounds(figLeft, figBottom, figW, figH) self.rowNum = rowNum self.colNum = colNum self.numRows = rows Modified: branches/transforms/lib/matplotlib/axis.py === --- branches/transforms/lib/matplotlib/axis.py 2007-10-24 18:49:08 UTC (rev 3996) +++ branches/transforms/lib/matplotlib/axis.py 2007-10-24 19:22:00 UTC (rev 3997) @@ -1070,7 +1070,7 @@ bottom = self.axes.bbox.ymin else: bbox = Bbox.union(bboxes) -bottom = bbox.ymin +bottom = bbox.y0 self.label.set_position( (x, bottom - self.LABELPAD*self.figure.dpi / 72.0)) else: @@ -1078,8 +1078,7 @@ top = self.axes.bbox.ymax else: bbox = bbox_union(bboxes2) -top = bbox.ymax - +top = bbox.y1 self.label.set_position( (x, top+self.LABELPAD*self.figure.dpi / 72.0)) def _update_offset_text_position(self, bboxes, bboxes2): @@ -1092,7 +1091,7 @@ bottom = self.axes.bbox.ymin else: bbox = Bbox.union(bboxes) -bottom = bbox.ymin +bottom = bbox.y0 self.offsetText.set_position((x, bottom-self.OFFSETTEXTPAD*self.figure.dpi/72.0)) def set_ticks_position(self, position): @@ -1280,9 +1279,8 @@ if not len(bboxes): left = self.axes.bbox.xmin else: - bbox = Bbox.union(bboxes) -left = bbox.xmin +left = bbox.x0 self.label.set_position( (left-self.LABELPAD*self.figure.dpi/72.0, y)) @@ -1291,7 +1289,7 @@ right = self.axes.bbox.xmax else: bbox = Bbox.union(bboxes2) -right = bbox.xmax +right = bbox.x1 self.label.set_position( (right+self.LABELPAD*self.figure.dpi/72.0, y)) Modified: branches/transforms/lib/matplotlib/backend_bases.py
SF.net SVN: matplotlib: [3998] branches/transforms
Revision: 3998 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3998view=rev Author: mdboom Date: 2007-10-24 12:42:49 -0700 (Wed, 24 Oct 2007) Log Message: --- More examples working. Modified Paths: -- branches/transforms/examples/poly_editor.py branches/transforms/examples/wxcursor_demo.py branches/transforms/lib/matplotlib/backends/backend_wx.py branches/transforms/lib/matplotlib/patches.py branches/transforms/lib/matplotlib/transforms.py Modified: branches/transforms/examples/poly_editor.py === --- branches/transforms/examples/poly_editor.py 2007-10-24 19:22:00 UTC (rev 3997) +++ branches/transforms/examples/poly_editor.py 2007-10-24 19:42:49 UTC (rev 3998) @@ -68,10 +68,11 @@ def get_ind_under_point(self, event): 'get the index of the vertex under point if within epsilon tolerance' -x, y = zip(*self.poly.xy) # display coords -xt, yt = self.poly.get_transform().numerix_x_y(x, y) +xy = npy.asarray(self.poly.xy) +xyt = self.poly.get_transform().transform(xy) +xt, yt = xyt[:, 0], xyt[:, 1] d = sqrt((xt-event.x)**2 + (yt-event.y)**2) indseq = nonzero(equal(d, amin(d))) ind = indseq[0] @@ -130,7 +131,7 @@ x,y = event.xdata, event.ydata self.poly.xy[self._ind] = x,y self.line.set_data(zip(*self.poly.xy)) - + self.canvas.restore_region(self.background) self.ax.draw_artist(self.poly) self.ax.draw_artist(self.line) Modified: branches/transforms/examples/wxcursor_demo.py === --- branches/transforms/examples/wxcursor_demo.py 2007-10-24 19:22:00 UTC (rev 3997) +++ branches/transforms/examples/wxcursor_demo.py 2007-10-24 19:42:49 UTC (rev 3998) @@ -3,6 +3,8 @@ import matplotlib +matplotlib.use('WXAgg') + from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas from matplotlib.backends.backend_wx import NavigationToolbar2Wx from matplotlib.figure import Figure @@ -65,6 +67,5 @@ return True if __name__=='__main__': -matplotlib.use('WXAgg') app = App(0) app.MainLoop() Modified: branches/transforms/lib/matplotlib/backends/backend_wx.py === --- branches/transforms/lib/matplotlib/backends/backend_wx.py 2007-10-24 19:22:00 UTC (rev 3997) +++ branches/transforms/lib/matplotlib/backends/backend_wx.py 2007-10-24 19:42:49 UTC (rev 3998) @@ -2043,7 +2043,7 @@ vscale= float(ppw) / fig_dpi # set figure resolution,bg color for printer -self.canvas.figure.dpi.set(ppw) +self.canvas.figure.dpi = ppw self.canvas.figure.set_facecolor('#FF') renderer = RendererWx(self.canvas.bitmap, self.canvas.figure.dpi) Modified: branches/transforms/lib/matplotlib/patches.py === --- branches/transforms/lib/matplotlib/patches.py 2007-10-24 19:22:00 UTC (rev 3997) +++ branches/transforms/lib/matplotlib/patches.py 2007-10-24 19:42:49 UTC (rev 3998) @@ -506,8 +506,8 @@ See Patch documentation for additional kwargs Patch.__init__(self, **kwargs) -self.xy = xy self._path = Path(xy, closed=True) +self.xy = self._path.vertices __init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd def get_path(self): Modified: branches/transforms/lib/matplotlib/transforms.py === --- branches/transforms/lib/matplotlib/transforms.py2007-10-24 19:22:00 UTC (rev 3997) +++ branches/transforms/lib/matplotlib/transforms.py2007-10-24 19:42:49 UTC (rev 3998) @@ -927,6 +927,7 @@ The transformed point is returned as a sequence of length self.output_dims. +assert len(point) == 2 return self.transform(npy.asarray([point]))[0] def transform_path(self, path): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4000] branches/transforms
Revision: 4000 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4000view=rev Author: mdboom Date: 2007-10-25 07:07:44 -0700 (Thu, 25 Oct 2007) Log Message: --- table_demo working. Lots of minor fixes. Faster transforms when debugging is turned off. Modified Paths: -- branches/transforms/PASSED_DEMOS branches/transforms/examples/contour_demo.py branches/transforms/lib/matplotlib/axes.py branches/transforms/lib/matplotlib/backend_bases.py branches/transforms/lib/matplotlib/backends/backend_pdf.py branches/transforms/lib/matplotlib/backends/backend_ps.py branches/transforms/lib/matplotlib/lines.py branches/transforms/lib/matplotlib/patches.py branches/transforms/lib/matplotlib/scale.py branches/transforms/lib/matplotlib/table.py branches/transforms/lib/matplotlib/transforms.py Modified: branches/transforms/PASSED_DEMOS === --- branches/transforms/PASSED_DEMOS2007-10-24 22:14:57 UTC (rev 3999) +++ branches/transforms/PASSED_DEMOS2007-10-25 14:07:44 UTC (rev 4000) @@ -156,13 +156,13 @@ polar_demo.py O polar_legend.pyO polar_scatter.py O -poly_editor.py [NEEDS OVERHAUL] +poly_editor.py O poormans_contour.pyO -printing_in_wx.py +printing_in_wx.py [REQUIRES NON-AGG WX RENDERER, WHICH IS NOT YET IMPLEMENTED] print_stdout.py[BROKEN?] psd_demo.pyO -pstest.py -pylab_with_gtk.py +pstest.py O +pylab_with_gtk.py O pythonic_matplotlib.py O quadmesh_demo.py O [MASKED VALUES ARE SHOWN DUE TO A BUG IN TRUNK] quiver_demo.py O @@ -190,7 +190,7 @@ subplots_adjust.py O subplot_toolbar.py O system_monitor.py O -table_demo.py +table_demo.py O tex_demo.pyO text_handles.pyO text_rotation.py O @@ -204,7 +204,7 @@ vertical_ticklabels.py O vline_demo.py O webapp_demo.py -wxcursor_demo.py +wxcursor_demo.py O xcorr_demo.py O zoom_window.py O zorder_demo.py O Modified: branches/transforms/examples/contour_demo.py === --- branches/transforms/examples/contour_demo.py2007-10-24 22:14:57 UTC (rev 3999) +++ branches/transforms/examples/contour_demo.py2007-10-25 14:07:44 UTC (rev 4000) @@ -92,8 +92,8 @@ # This makes the original colorbar look a bit out of place, # so let's improve its position. -l,b,w,h = gca().get_position() -ll,bb,ww,hh = CB.ax.get_position() +l,b,w,h = gca().get_position().bounds +ll,bb,ww,hh = CB.ax.get_position().bounds CB.ax.set_position([ll, b+0.1*h, ww, h*0.8]) Modified: branches/transforms/lib/matplotlib/axes.py === --- branches/transforms/lib/matplotlib/axes.py 2007-10-24 22:14:57 UTC (rev 3999) +++ branches/transforms/lib/matplotlib/axes.py 2007-10-25 14:07:44 UTC (rev 4000) @@ -582,8 +582,6 @@ self._yaxis_transform = mtransforms.blended_transform_factory( self.axes.transAxes, self.axes.transData) -self.transData.write_graphviz(open(trans.dot, w)) - def get_xaxis_transform(self): return self._xaxis_transform @@ -636,8 +634,10 @@ 'original' to change the second; 'both' to change both -ACCEPTS: len(4) sequence of floats +ACCEPTS: len(4) sequence of floats, or a Bbox object +if not isinstance(pos, mtransforms.BboxBase): +pos = mtransforms.Bbox.from_bounds(*pos) if which in ('both', 'active'): self._position.set(pos) if which in ('both', 'original'): Modified: branches/transforms/lib/matplotlib/backend_bases.py === --- branches/transforms/lib/matplotlib/backend_bases.py 2007-10-24 22:14:57 UTC (rev 3999) +++ branches/transforms/lib/matplotlib/backend_bases.py 2007-10-25 14:07:44 UTC (rev 4000) @@ -155,7 +155,7 @@ gc.set_clip_rectangle(cliprect) if clippath is not None: clippath = transforms.TransformedPath(clippath, clippath_trans) -gc.set_clippath(clippath) +gc.set_clip_path(clippath) if Nfacecolors == 0: rgbFace = None Modified: branches/transforms/lib/matplotlib/backends/backend_pdf.py === --- branches/transforms/lib/matplotlib/backends/backend_pdf.py 2007-10-24 22:14:57 UTC (rev 3999) +++ branches/transforms/lib/matplotlib/backends/backend_pdf.py 2007-10-25 14:07:44 UTC (rev 4000) @@ -1032,7 +1032,7 @@ def writeMarkers(self): for tup in self.markers.values(): name, object, path, trans, fillp, lw = tup -bbox
SF.net SVN: matplotlib: [4001] branches/transforms
Revision: 4001 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4001view=rev Author: mdboom Date: 2007-10-25 07:10:16 -0700 (Thu, 25 Oct 2007) Log Message: --- Merged revisions 3984-4000 via svnmerge from http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib r3991 | efiring | 2007-10-23 17:25:24 -0400 (Tue, 23 Oct 2007) | 2 lines Bugfix: save colorbar axis label so it won't get lost r3999 | efiring | 2007-10-24 18:14:57 -0400 (Wed, 24 Oct 2007) | 2 lines Added ax kwarg to pyplot.colorbar and Figure.colorbar Modified Paths: -- branches/transforms/API_CHANGES branches/transforms/CHANGELOG branches/transforms/lib/matplotlib/colorbar.py branches/transforms/lib/matplotlib/figure.py branches/transforms/lib/matplotlib/pyplot.py Property Changed: branches/transforms/ Property changes on: branches/transforms ___ Name: svnmerge-integrated - /trunk/matplotlib:1-3983 + /trunk/matplotlib:1-4000 Modified: branches/transforms/API_CHANGES === --- branches/transforms/API_CHANGES 2007-10-25 14:07:44 UTC (rev 4000) +++ branches/transforms/API_CHANGES 2007-10-25 14:10:16 UTC (rev 4001) @@ -1,6 +1,11 @@ -Changed cbook.reversed so it yields a tuple rather than a +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 +and cbook only defines reversed if python doesnt provide the builtin. Made skiprows=1 the default on csv2rec Modified: branches/transforms/CHANGELOG === --- branches/transforms/CHANGELOG 2007-10-25 14:07:44 UTC (rev 4000) +++ branches/transforms/CHANGELOG 2007-10-25 14:10:16 UTC (rev 4001) @@ -1,3 +1,5 @@ +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) @@ -12,7 +14,7 @@ unit/ellipse_compare.py to compare spline with vertex approx for both aspects. JDH -2007-10-05 remove generator expressions from texmanager and mpltraits. +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 Modified: branches/transforms/lib/matplotlib/colorbar.py === --- branches/transforms/lib/matplotlib/colorbar.py 2007-10-25 14:07:44 UTC (rev 4000) +++ branches/transforms/lib/matplotlib/colorbar.py 2007-10-25 14:10:16 UTC (rev 4001) @@ -70,21 +70,27 @@ colorbar_doc = ''' Add a colorbar to a plot. -Function signatures: +Function signatures for the pyplot interface; all but the first are +also method signatures for the Figure.colorbar method: colorbar(**kwargs) - colorbar(mappable, **kwargs) +colorbar(mappable, cax=cax, **kwargs) +colorbar(mappable, ax=ax, **kwargs) -colorbar(mappable, cax, **kwargs) +arguments: +mappable: the image, ContourSet, etc. to which the colorbar applies; +this argument is mandatory for the Figure.colorbar +method but optional for the pyplot.colorbar function, +which sets the default to the current image. -The optional arguments mappable and cax may be included in the kwargs; -they are image, ContourSet, etc. to which the colorbar applies, and -the axes object in which the colorbar will be drawn. Defaults are -the current image and a new axes object created next to that image -after resizing the image. +keyword arguments: +cax: None | axes object into which the colorbar will be drawn +ax: None | parent axes object from which space for a new + colorbar axes will be stolen -kwargs are in two groups: + +**kwargs are in two groups: axes properties: %s colorbar properties: @@ -155,6 +161,7 @@ self.filled = filled self.solids = None self.lines = None +self.set_label('') if cbook.iterable(ticks): self.locator = ticker.FixedLocator(ticks, nbins=len(ticks)) else: @@ -183,6 +190,7 @@ self._config_axes(X, Y) if self.filled: self._add_solids(X, Y, C) +self
SF.net SVN: matplotlib: [4004] branches/transforms
Revision: 4004 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4004view=rev Author: mdboom Date: 2007-10-25 12:16:11 -0700 (Thu, 25 Oct 2007) Log Message: --- Increased coverage of backend_driver.py to include almost everything in axes.py. Lots of little bug fixes. Modified Paths: -- branches/transforms/PASSED_DEMOS branches/transforms/examples/arrow_demo.py branches/transforms/examples/backend_driver.py branches/transforms/lib/matplotlib/artist.py branches/transforms/lib/matplotlib/axes.py branches/transforms/lib/matplotlib/backend_bases.py branches/transforms/lib/matplotlib/backends/backend_pdf.py branches/transforms/lib/matplotlib/backends/backend_ps.py branches/transforms/lib/matplotlib/backends/backend_svg.py branches/transforms/lib/matplotlib/backends/backend_template.py branches/transforms/lib/matplotlib/cbook.py branches/transforms/lib/matplotlib/collections.py branches/transforms/lib/matplotlib/contour.py branches/transforms/lib/matplotlib/lines.py branches/transforms/lib/matplotlib/patches.py branches/transforms/lib/matplotlib/path.py branches/transforms/lib/matplotlib/scale.py branches/transforms/lib/matplotlib/transforms.py branches/transforms/lib/matplotlib/widgets.py branches/transforms/src/_gtkagg.cpp Added Paths: --- branches/transforms/examples/equal_aspect_ratio.py branches/transforms/examples/hline_demo.py Modified: branches/transforms/PASSED_DEMOS === --- branches/transforms/PASSED_DEMOS2007-10-25 18:16:03 UTC (rev 4003) +++ branches/transforms/PASSED_DEMOS2007-10-25 19:16:11 UTC (rev 4004) @@ -60,7 +60,7 @@ dynamic_demo_wx.py [REQUIRES NON-AGG WX RENDERER, WHICH IS NOT YET IMPLEMENTED] dynamic_image_gtkagg.py O dynamic_image_wxagg2.py O -dynamic_image_wxagg.py +dynamic_image_wxagg.py [REQUIRES NON-AGG WX RENDERER, WHICH IS NOT YET IMPLEMENTED] ellipse_demo.pyO ellipse_rotated.py O embedding_in_gtk2.py [REQUIRES NON-AGG GDK RENDERER, WHICH IS NOT YET IMPLEMENTED] Modified: branches/transforms/examples/arrow_demo.py === --- branches/transforms/examples/arrow_demo.py 2007-10-25 18:16:03 UTC (rev 4003) +++ branches/transforms/examples/arrow_demo.py 2007-10-25 19:16:11 UTC (rev 4004) @@ -280,6 +280,7 @@ if __name__ == '__main__': from sys import argv +d = None if len(argv) 1: if argv[1] == 'full': d = all_on_max @@ -293,7 +294,7 @@ elif argv[1] == 'sample': d = sample_data scaled = True -else: +if d is None: d = all_on_max scaled=False if len(argv) 2: Modified: branches/transforms/examples/backend_driver.py === --- branches/transforms/examples/backend_driver.py 2007-10-25 18:16:03 UTC (rev 4003) +++ branches/transforms/examples/backend_driver.py 2007-10-25 19:16:11 UTC (rev 4004) @@ -22,10 +22,16 @@ 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', 'contour_demo.py', 'contourf_demo.py', 'csd_demo.py', @@ -33,6 +39,8 @@ 'customize_rc.py', 'date_demo1.py', 'date_demo2.py', +'equal_aspect_ratio.py', +'errorbar_limits.py', 'figimage_demo.py', 'figlegend_demo.py', 'figtext.py', @@ -40,6 +48,7 @@ 'finance_demo.py', 'fonts_demo_kw.py', 'histogram_demo.py', +'hline_demo.py', 'image_demo.py', 'image_demo2.py', 'image_masked.py', @@ -66,11 +75,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', @@ -104,7 +120,7 @@ def run(arglist): os.system(' '.join(arglist)) -def drive(backend, python='python', switches = []): +def drive(backend, python=['python'], switches = []): exclude = failbackend.get(backend, []) switchstring = ' '.join(switches) @@ -151,17 +167,20 @@ tmpfile.write('savefig(%s, dpi=150)' % outfile) tmpfile.close() -run([python, tmpfile_name, switchstring]) +run(python + [tmpfile_name, switchstring]) #os.system('%s %s %s' % (python, tmpfile_name, switchstring)) os.remove(tmpfile_name) if __name__
SF.net SVN: matplotlib: [4011] branches/transforms
Revision: 4011 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4011view=rev Author: mdboom Date: 2007-10-26 08:58:50 -0700 (Fri, 26 Oct 2007) Log Message: --- More coverage. Add draw_path_collection to SVG. Modified Paths: -- branches/transforms/examples/backend_driver.py branches/transforms/examples/legend_auto.py branches/transforms/lib/matplotlib/axis.py branches/transforms/lib/matplotlib/backends/backend_ps.py branches/transforms/lib/matplotlib/backends/backend_svg.py branches/transforms/lib/matplotlib/figure.py branches/transforms/lib/matplotlib/quiver.py branches/transforms/lib/matplotlib/scale.py branches/transforms/lib/matplotlib/transforms.py Modified: branches/transforms/examples/backend_driver.py === --- branches/transforms/examples/backend_driver.py 2007-10-26 03:40:33 UTC (rev 4010) +++ branches/transforms/examples/backend_driver.py 2007-10-26 15:58:50 UTC (rev 4011) @@ -55,6 +55,7 @@ 'image_origin.py', 'invert_axes.py', 'layer_images.py', +'legend_auto.py', 'legend_demo.py', 'legend_demo2.py', 'line_collection.py', Modified: branches/transforms/examples/legend_auto.py === --- branches/transforms/examples/legend_auto.py 2007-10-26 03:40:33 UTC (rev 4010) +++ branches/transforms/examples/legend_auto.py 2007-10-26 15:58:50 UTC (rev 4011) @@ -79,7 +79,12 @@ if __name__ == '__main__': nfigs = 10 -figures = [int(f) for f in sys.argv[1:]] +figures = [] +for f in sys.argv[1:]: +try: +figures.append(int(f)) +except ValueError: +pass if len(figures) == 0: figures = range(1, nfigs+1) Modified: branches/transforms/lib/matplotlib/axis.py === --- branches/transforms/lib/matplotlib/axis.py 2007-10-26 03:40:33 UTC (rev 4010) +++ branches/transforms/lib/matplotlib/axis.py 2007-10-26 15:58:50 UTC (rev 4011) @@ -18,7 +18,7 @@ from font_manager import FontProperties from text import Text, TextWithDash, _process_text_args from transforms import Affine2D, Bbox, blended_transform_factory, interval_contains, \ -interval_contains_open, IntervalTransform, IdentityTransform +interval_contains_open, IdentityTransform from patches import bbox_artist from scale import scale_factory Modified: branches/transforms/lib/matplotlib/backends/backend_ps.py === --- branches/transforms/lib/matplotlib/backends/backend_ps.py 2007-10-26 03:40:33 UTC (rev 4010) +++ branches/transforms/lib/matplotlib/backends/backend_ps.py 2007-10-26 15:58:50 UTC (rev 4011) @@ -505,12 +505,13 @@ path_codes = [] for i, (path, transform) in enumerate(self._iter_collection_raw_paths( master_transform, paths, all_transforms)): -ps_cmd = ['/p%x_%x {' % (self._path_collection_id, i), +name = 'p%x_%x' % (self._path_collection_id, i) +ps_cmd = ['/%s {' % name, 'newpath', 'translate'] ps_cmd.append(self._convert_path(path, transform)) ps_cmd.extend(['} bind def\n']) write('\n'.join(ps_cmd)) -path_codes.append(p%x_%x % (self._path_collection_id, i)) +path_codes.append(name) for xo, yo, path_id, gc, rgbFace in self._iter_collection( path_codes, cliprect, clippath, clippath_trans, Modified: branches/transforms/lib/matplotlib/backends/backend_svg.py === --- branches/transforms/lib/matplotlib/backends/backend_svg.py 2007-10-26 03:40:33 UTC (rev 4010) +++ branches/transforms/lib/matplotlib/backends/backend_svg.py 2007-10-26 15:58:50 UTC (rev 4011) @@ -42,6 +42,7 @@ self._clipd = {} self._char_defs = {} self._markers = {} +self._path_collection_id = 0 self.mathtext_parser = MathTextParser('SVG') self.fontd = {} svgwriter.write(svgProlog%(width,height,width,height)) @@ -192,7 +193,33 @@ for x, y in tpath.vertices: details = 'xlink:href=#%s x=%f y=%f' % (name, x, y) self._draw_svg_element('use', details, gc, rgbFace) + +def draw_path_collection(self, master_transform, cliprect, clippath, + clippath_trans, paths, all_transforms, offsets, + offsetTrans, facecolors, edgecolors, linewidths, + linestyles, antialiaseds): +write = self._svgwriter.write + +path_codes = [] +write('defs\n') +for i, (path, transform) in enumerate(self._iter_collection_raw_paths( +master_transform, paths, all_transforms
SF.net SVN: matplotlib: [4012] branches/transforms/lib/matplotlib
Revision: 4012 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4012view=rev Author: mdboom Date: 2007-10-26 10:01:28 -0700 (Fri, 26 Oct 2007) Log Message: --- Added BboxTransformFrom/To for more efficient bounding box transforms. Modified Paths: -- branches/transforms/lib/matplotlib/axes.py branches/transforms/lib/matplotlib/figure.py branches/transforms/lib/matplotlib/legend.py branches/transforms/lib/matplotlib/patches.py branches/transforms/lib/matplotlib/projections/polar.py branches/transforms/lib/matplotlib/quiver.py branches/transforms/lib/matplotlib/transforms.py Modified: branches/transforms/lib/matplotlib/axes.py === --- branches/transforms/lib/matplotlib/axes.py 2007-10-26 15:58:50 UTC (rev 4011) +++ branches/transforms/lib/matplotlib/axes.py 2007-10-26 17:01:28 UTC (rev 4012) @@ -560,8 +560,7 @@ self.dataLim = mtransforms.Bbox.unit() self.viewLim = mtransforms.Bbox.unit() -self.transAxes = mtransforms.BboxTransform( -mtransforms.Bbox.unit(), self.bbox) +self.transAxes = mtransforms.BboxTransformTo(self.bbox) # Transforms the x and y axis separately by a scale factor # It is assumed that this part will have non-linear components @@ -569,8 +568,8 @@ # An affine transformation on the data, generally to limit the # range of the axes -self.transLimits = mtransforms.BboxTransform( -mtransforms.TransformedBbox(self.viewLim, self.transScale), mtransforms.Bbox.unit()) +self.transLimits = mtransforms.BboxTransformFrom( +mtransforms.TransformedBbox(self.viewLim, self.transScale)) # The parentheses are important for efficiency here -- they # group the last two (which are usually affines) separately Modified: branches/transforms/lib/matplotlib/figure.py === --- branches/transforms/lib/matplotlib/figure.py2007-10-26 15:58:50 UTC (rev 4011) +++ branches/transforms/lib/matplotlib/figure.py2007-10-26 17:01:28 UTC (rev 4012) @@ -19,7 +19,7 @@ from legend import Legend from ticker import FormatStrFormatter -from transforms import Affine2D, Bbox, BboxTransform, TransformedBbox +from transforms import Affine2D, Bbox, BboxTransformTo, TransformedBbox from cm import ScalarMappable from contour import ContourSet from projections import projection_factory, get_projection_names, \ @@ -136,7 +136,7 @@ self.frameon = frameon -self.transFigure = BboxTransform(Bbox.unit(), self.bbox) +self.transFigure = BboxTransformTo(self.bbox) self.figurePatch = Rectangle( xy=(0,0), width=1, height=1, Modified: branches/transforms/lib/matplotlib/legend.py === --- branches/transforms/lib/matplotlib/legend.py2007-10-26 15:58:50 UTC (rev 4011) +++ branches/transforms/lib/matplotlib/legend.py2007-10-26 17:01:28 UTC (rev 4012) @@ -34,7 +34,7 @@ from patches import Patch, Rectangle, RegularPolygon, Shadow, bbox_artist, draw_bbox from collections import LineCollection, RegularPolyCollection from text import Text -from transforms import Affine2D, Bbox, BboxTransform +from transforms import Affine2D, Bbox, BboxTransformTo def line_cuts_bbox(line, bbox): Return True if and only if line cuts bbox. @@ -165,7 +165,7 @@ raise TypeError(Legend needs either Axes or Figure as parent) self.parent = parent self._offsetTransform = Affine2D() -self._parentTransform = BboxTransform(Bbox.unit(), parent.bbox) +self._parentTransform = BboxTransformTo(parent.bbox) Artist.set_transform(self, self._offsetTransform + self._parentTransform) if loc is None: Modified: branches/transforms/lib/matplotlib/patches.py === --- branches/transforms/lib/matplotlib/patches.py 2007-10-26 15:58:50 UTC (rev 4011) +++ branches/transforms/lib/matplotlib/patches.py 2007-10-26 17:01:28 UTC (rev 4012) @@ -346,8 +346,7 @@ left, right = self.convert_xunits((xy[0], xy[0] + width)) bottom, top = self.convert_yunits((xy[1], xy[1] + height)) self._bbox = transforms.Bbox.from_extents(left, bottom, right, top) - self._rect_transform = transforms.BboxTransform( - transforms.Bbox.unit(), self._bbox) + self._rect_transform = transforms.BboxTransformTo(self._bbox) __init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd def get_path(self): Modified: branches/transforms/lib/matplotlib/projections/polar.py === --- branches/transforms/lib/matplotlib/projections/polar.py 2007-10
SF.net SVN: matplotlib: [4017] branches/transforms/lib/matplotlib
Revision: 4017 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4017view=rev Author: mdboom Date: 2007-10-26 11:00:23 -0700 (Fri, 26 Oct 2007) Log Message: --- Removed unused imports. Modified Paths: -- branches/transforms/lib/matplotlib/_mathtext_data.py branches/transforms/lib/matplotlib/art3d.py branches/transforms/lib/matplotlib/artist.py branches/transforms/lib/matplotlib/axes.py branches/transforms/lib/matplotlib/axes3d.py branches/transforms/lib/matplotlib/axis.py branches/transforms/lib/matplotlib/backend_bases.py branches/transforms/lib/matplotlib/collections.py branches/transforms/lib/matplotlib/colorbar.py branches/transforms/lib/matplotlib/colors.py branches/transforms/lib/matplotlib/contour.py branches/transforms/lib/matplotlib/dates.py branches/transforms/lib/matplotlib/figure.py branches/transforms/lib/matplotlib/finance.py branches/transforms/lib/matplotlib/font_manager.py branches/transforms/lib/matplotlib/fontconfig_pattern.py branches/transforms/lib/matplotlib/image.py branches/transforms/lib/matplotlib/legend.py branches/transforms/lib/matplotlib/lines.py branches/transforms/lib/matplotlib/mathtext.py branches/transforms/lib/matplotlib/mlab.py branches/transforms/lib/matplotlib/patches.py branches/transforms/lib/matplotlib/proj3d.py branches/transforms/lib/matplotlib/scale.py branches/transforms/lib/matplotlib/table.py branches/transforms/lib/matplotlib/texmanager.py branches/transforms/lib/matplotlib/text.py branches/transforms/lib/matplotlib/ticker.py branches/transforms/lib/matplotlib/units.py Modified: branches/transforms/lib/matplotlib/_mathtext_data.py === --- branches/transforms/lib/matplotlib/_mathtext_data.py2007-10-26 17:57:02 UTC (rev 4016) +++ branches/transforms/lib/matplotlib/_mathtext_data.py2007-10-26 18:00:23 UTC (rev 4017) @@ -14,8 +14,6 @@ print charcode, glyphind -from sets import Set - latex_to_bakoma = { r'\oint': ('cmex10', 45), r'\bigodot' : ('cmex10', 50), Modified: branches/transforms/lib/matplotlib/art3d.py === --- branches/transforms/lib/matplotlib/art3d.py 2007-10-26 17:57:02 UTC (rev 4016) +++ branches/transforms/lib/matplotlib/art3d.py 2007-10-26 18:00:23 UTC (rev 4017) @@ -10,7 +10,6 @@ import text from colors import Normalize -from cm import jet import numpy as npy import proj3d Modified: branches/transforms/lib/matplotlib/artist.py === --- branches/transforms/lib/matplotlib/artist.py2007-10-26 17:57:02 UTC (rev 4016) +++ branches/transforms/lib/matplotlib/artist.py2007-10-26 18:00:23 UTC (rev 4017) @@ -1,9 +1,7 @@ from __future__ import division -import sys, re, warnings +import re, warnings from cbook import iterable, flatten -from transforms import Affine2D, Bbox, IdentityTransform, TransformedBbox, \ -TransformedPath -import matplotlib.units as units +from transforms import Bbox, IdentityTransform, TransformedBbox, TransformedPath ## Note, matplotlib artists use the doc strings for set and get # methods to enable the introspection methods of setp and getp. Every Modified: branches/transforms/lib/matplotlib/axes.py === --- branches/transforms/lib/matplotlib/axes.py 2007-10-26 17:57:02 UTC (rev 4016) +++ branches/transforms/lib/matplotlib/axes.py 2007-10-26 18:00:23 UTC (rev 4017) @@ -1,5 +1,5 @@ from __future__ import division, generators -import math, sys, warnings, copy, new +import math, warnings, new import numpy as npy @@ -9,7 +9,6 @@ rcParams = matplotlib.rcParams from matplotlib import artist as martist -from matplotlib import agg from matplotlib import axis as maxis from matplotlib import cbook from matplotlib import collections as mcoll @@ -21,9 +20,7 @@ from matplotlib import legend as mlegend from matplotlib import lines as mlines from matplotlib import mlab -from matplotlib import cm from matplotlib import patches as mpatches -from matplotlib import path as mpath from matplotlib import quiver as mquiver from matplotlib import scale as mscale from matplotlib import table as mtable Modified: branches/transforms/lib/matplotlib/axes3d.py === --- branches/transforms/lib/matplotlib/axes3d.py2007-10-26 17:57:02 UTC (rev 4016) +++ branches/transforms/lib/matplotlib/axes3d.py2007-10-26 18:00:23 UTC (rev 4017) @@ -11,12 +11,10 @@ import random -import matplotlib from axes import Axes import cbook from transforms import unit_bbox -import figure import numpy as npy from colors import Normalize Modified: branches
SF.net SVN: matplotlib: [4018] branches/transforms/lib/matplotlib/ projections/polar.py
Revision: 4018 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4018view=rev Author: mdboom Date: 2007-10-26 11:04:51 -0700 (Fri, 26 Oct 2007) Log Message: --- Fix polar plot title so it doesn't clash with 90 degree value. Modified Paths: -- branches/transforms/lib/matplotlib/projections/polar.py Modified: branches/transforms/lib/matplotlib/projections/polar.py === --- branches/transforms/lib/matplotlib/projections/polar.py 2007-10-26 18:00:23 UTC (rev 4017) +++ branches/transforms/lib/matplotlib/projections/polar.py 2007-10-26 18:04:51 UTC (rev 4018) @@ -175,6 +175,8 @@ self.grid(rcParams['polaraxes.grid']) self.xaxis.set_ticks_position('none') self.yaxis.set_ticks_position('none') + +self.title.set_y(1.06) def _set_lim_and_transforms(self): self.dataLim = Bbox.unit() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4019] branches/transforms
Revision: 4019 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4019view=rev Author: mdboom Date: 2007-10-26 11:32:44 -0700 (Fri, 26 Oct 2007) Log Message: --- Can't drag zoom on a polar plot. Finessing Agg drawing quality a little bit. Modified Paths: -- branches/transforms/lib/matplotlib/axes.py branches/transforms/lib/matplotlib/backend_bases.py branches/transforms/lib/matplotlib/projections/polar.py branches/transforms/src/_backend_agg.cpp Modified: branches/transforms/lib/matplotlib/axes.py === --- branches/transforms/lib/matplotlib/axes.py 2007-10-26 18:04:51 UTC (rev 4018) +++ branches/transforms/lib/matplotlib/axes.py 2007-10-26 18:32:44 UTC (rev 4019) @@ -1820,6 +1820,12 @@ Interactive manipulation +def can_zoom(self): + +Return True if this axes support the zoom box + +return True + def get_navigate(self): Get whether the axes responds to navigation commands Modified: branches/transforms/lib/matplotlib/backend_bases.py === --- branches/transforms/lib/matplotlib/backend_bases.py 2007-10-26 18:04:51 UTC (rev 4018) +++ branches/transforms/lib/matplotlib/backend_bases.py 2007-10-26 18:32:44 UTC (rev 4019) @@ -1361,7 +1361,8 @@ self._xypress=[] for i, a in enumerate(self.canvas.figure.get_axes()): -if x is not None and y is not None and a.in_axes(event) and a.get_navigate(): +if x is not None and y is not None and a.in_axes(event) \ +and a.get_navigate() and a.can_zoom(): self._xypress.append(( x, y, a, i, a.viewLim.frozen(), a.transData.frozen())) self.press(event) Modified: branches/transforms/lib/matplotlib/projections/polar.py === --- branches/transforms/lib/matplotlib/projections/polar.py 2007-10-26 18:04:51 UTC (rev 4018) +++ branches/transforms/lib/matplotlib/projections/polar.py 2007-10-26 18:32:44 UTC (rev 4019) @@ -55,8 +55,11 @@ transform_non_affine.__doc__ = Transform.transform_non_affine.__doc__ def transform_path(self, path): -path = path.interpolated(self._resolution) -return Path(self.transform(path.vertices), path.codes) +vertices = path.vertices +if len(vertices) == 2 and vertices[0, 0] == vertices[1, 0]: +return Path(self.transform(vertices), path.codes) +ipath = path.interpolated(self._resolution) +return Path(self.transform(ipath.vertices), ipath.codes) transform_path.__doc__ = Transform.transform_path.__doc__ transform_path_non_affine = transform_path @@ -151,7 +154,7 @@ def refresh(self): return self.base.refresh() -RESOLUTION = 50 +RESOLUTION = 75 def __init__(self, *args, **kwargs): @@ -377,6 +380,12 @@ return 1.0 ### Interactive panning + +def can_zoom(self): + +Return True if this axes support the zoom box + +return False def start_pan(self, x, y, button): angle = self._r_label1_position.to_values()[4] / 180.0 * npy.pi Modified: branches/transforms/src/_backend_agg.cpp === --- branches/transforms/src/_backend_agg.cpp2007-10-26 18:04:51 UTC (rev 4018) +++ branches/transforms/src/_backend_agg.cpp2007-10-26 18:32:44 UTC (rev 4019) @@ -95,8 +95,8 @@ unsigned vertex(double* x, double* y) { unsigned cmd = m_source-vertex(x, y); if (m_quantize agg::is_vertex(cmd)) { - *x = int(*x) + 0.5; - *y = int(*y) + 0.5; + *x = round(*x) + 0.5; + *y = round(*y) + 0.5; } return cmd; } @@ -389,7 +389,7 @@ } trans.transform(x1, y1); -if (!(fabs(x0 - x1) 0.001 || fabs(y0 - y1) 0.001)) { +if (!(fabs(x0 - x1) 1e-4 || fabs(y0 - y1) 1e-4)) { path.rewind(0); return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4020] trunk/matplotlib/
Revision: 4020 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4020view=rev Author: mdboom Date: 2007-10-26 11:44:16 -0700 (Fri, 26 Oct 2007) Log Message: --- Initialized merge tracking via svnmerge with revisions 1-3806 from https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/transforms Property Changed: trunk/matplotlib/ Property changes on: trunk/matplotlib ___ Name: svnmerge-integrated + /branches/transforms:1-3806 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4046] trunk/matplotlib/lib/matplotlib
Revision: 4046 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4046view=rev Author: mdboom Date: 2007-10-29 07:30:51 -0700 (Mon, 29 Oct 2007) Log Message: --- Fixing bug in font rendering -- the patented freetype hinter appears to be unable to deal with the non-square hinting grid hack. Modified Paths: -- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py trunk/matplotlib/lib/matplotlib/mathtext.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py === --- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2007-10-29 13:40:42 UTC (rev 4045) +++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2007-10-29 14:30:51 UTC (rev 4046) @@ -82,7 +82,7 @@ from matplotlib.cbook import enumerate, is_string_like, exception_to_str from matplotlib.figure import Figure from matplotlib.font_manager import findfont -from matplotlib.ft2font import FT2Font, LOAD_DEFAULT +from matplotlib.ft2font import FT2Font, LOAD_FORCE_AUTOHINT from matplotlib.mathtext import MathTextParser from matplotlib.transforms import lbwh_to_bbox @@ -196,9 +196,9 @@ font = self._get_agg_font(prop) if font is None: return None if len(s) == 1 and ord(s) 127: -font.load_char(ord(s), flags=LOAD_DEFAULT) +font.load_char(ord(s), flags=LOAD_FORCE_AUTOHINT) else: -font.set_text(s, 0, flags=LOAD_DEFAULT) +font.set_text(s, 0, flags=LOAD_FORCE_AUTOHINT) font.draw_glyphs_to_bitmap() #print x, y, int(x), int(y) @@ -231,7 +231,7 @@ self.mathtext_parser.parse(s, self.dpi.get(), prop) return width, height, descent font = self._get_agg_font(prop) -font.set_text(s, 0.0, flags=LOAD_DEFAULT) # the width and height of unrotated string +font.set_text(s, 0.0, flags=LOAD_FORCE_AUTOHINT) # the width and height of unrotated string w, h = font.get_width_height() d = font.get_descent() w /= 64.0 # convert from subpixels Modified: trunk/matplotlib/lib/matplotlib/mathtext.py === --- trunk/matplotlib/lib/matplotlib/mathtext.py 2007-10-29 13:40:42 UTC (rev 4045) +++ trunk/matplotlib/lib/matplotlib/mathtext.py 2007-10-29 14:30:51 UTC (rev 4046) @@ -143,7 +143,7 @@ from matplotlib.afm import AFM from matplotlib.cbook import enumerate, iterable, Bunch, get_realpath_and_stat, \ is_string_like -from matplotlib.ft2font import FT2Font, FT2Image, KERNING_DEFAULT, LOAD_DEFAULT, LOAD_NO_HINTING +from matplotlib.ft2font import FT2Font, FT2Image, KERNING_DEFAULT, LOAD_FORCE_AUTOHINT, LOAD_NO_HINTING from matplotlib.font_manager import findfont, FontProperties from matplotlib._mathtext_data import latex_to_bakoma, \ latex_to_standard, tex2uni, type12uni, tex2type1, uni2type1, \ @@ -306,7 +306,7 @@ self.fonts_object.get_used_characters()) def get_hinting_type(self): -return LOAD_DEFAULT +return LOAD_FORCE_AUTOHINT def MathtextBackendAgg(): return MathtextBackendBbox(MathtextBackendAggRender()) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4047] trunk/matplotlib/src/ft2font.cpp
Revision: 4047 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4047view=rev Author: mdboom Date: 2007-10-29 07:44:18 -0700 (Mon, 29 Oct 2007) Log Message: --- Fixing bug in font rendering -- the patented freetype hinter appears to be unable to deal with the non-square hinting grid hack. [Forgot this file]. Modified Paths: -- trunk/matplotlib/src/ft2font.cpp Modified: trunk/matplotlib/src/ft2font.cpp === --- trunk/matplotlib/src/ft2font.cpp2007-10-29 14:30:51 UTC (rev 4046) +++ trunk/matplotlib/src/ft2font.cpp2007-10-29 14:44:18 UTC (rev 4047) @@ -943,7 +943,7 @@ angle = angle/360.0*2*3.14159; - long flags = FT_LOAD_DEFAULT; + long flags = FT_LOAD_FORCE_AUTOHINT; if (kwargs.hasKey(flags)) flags = Py::Long(kwargs[flags]); @@ -1054,7 +1054,7 @@ } char FT2Font::load_char__doc__[] = -load_char(charcode, flags=LOAD_LOAD_DEFAULT)\n +load_char(charcode, flags=LOAD_FORCE_AUTOHINT)\n \n Load character with charcode in current fontfile and set glyph.\n The flags argument can be a bitwise-or of the LOAD_XXX constants.\n @@ -1075,7 +1075,7 @@ //load a char using the unsigned long charcode args.verify_length(1); - long charcode = Py::Long(args[0]), flags = Py::Long(FT_LOAD_DEFAULT); + long charcode = Py::Long(args[0]), flags = Py::Long(FT_LOAD_FORCE_AUTOHINT); if (kwargs.hasKey(flags)) flags = Py::Long(kwargs[flags]); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4052] branches/transforms/examples/ shared_axis_demo.py
Revision: 4052 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4052view=rev Author: mdboom Date: 2007-10-29 08:20:13 -0700 (Mon, 29 Oct 2007) Log Message: --- Revert this example to like it is in the trunk. Modified Paths: -- branches/transforms/examples/shared_axis_demo.py Modified: branches/transforms/examples/shared_axis_demo.py === --- branches/transforms/examples/shared_axis_demo.py2007-10-29 15:04:28 UTC (rev 4051) +++ branches/transforms/examples/shared_axis_demo.py2007-10-29 15:20:13 UTC (rev 4052) @@ -36,12 +36,12 @@ s2 = exp(-t) s3 = sin(4*pi*t) ax1 = subplot(311) -plot(t,s1, bH) +plot(t,s1) setp( ax1.get_xticklabels(), fontsize=6) ## share x only ax2 = subplot(312, sharex=ax1) -plot(t, s2, b) +plot(t, s2) # make these tick labels invisible setp( ax2.get_xticklabels(), visible=False) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4054] branches/transforms
Revision: 4054 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4054view=rev Author: mdboom Date: 2007-10-29 09:55:53 -0700 (Mon, 29 Oct 2007) Log Message: --- More examples working. Modified Paths: -- branches/transforms/PASSED_DEMOS branches/transforms/lib/matplotlib/collections.py branches/transforms/lib/matplotlib/ticker.py Modified: branches/transforms/PASSED_DEMOS === --- branches/transforms/PASSED_DEMOS2007-10-29 15:21:49 UTC (rev 4053) +++ branches/transforms/PASSED_DEMOS2007-10-29 16:55:53 UTC (rev 4054) @@ -209,4 +209,20 @@ zoom_window.py O zorder_demo.py O -MGDTODO: units directory \ No newline at end of file + +units directory - + +annotate_with_units.py O +artist_tests.pyO +bar_demo2.py O +bar_unit_demo.py [BROKEN IN TRUNK] +basic_units.py [N/A] +date_converter.py O +date_support.py[N/A] +ellipse_with_units.py [BROKEN IN TRUNK] +evans_test2.py O +evans_test.py O +__init__.py[N/A] +radian_demo.py O +units_sample.pyO +units_scatter.py Modified: branches/transforms/lib/matplotlib/collections.py === --- branches/transforms/lib/matplotlib/collections.py 2007-10-29 15:21:49 UTC (rev 4053) +++ branches/transforms/lib/matplotlib/collections.py 2007-10-29 16:55:53 UTC (rev 4054) @@ -16,7 +16,7 @@ import matplotlib.transforms as transforms import matplotlib.artist as artist import matplotlib.backend_bases as backend_bases -import matplotlib.path as path +import matplotlib.path as mpath class Collection(artist.Artist, cm.ScalarMappable): @@ -136,7 +136,7 @@ offsets = transOffset.transform_non_affine(offsets) transOffset = transOffset.get_affine() -result = path.get_path_collection_extents( +result = mpath.get_path_collection_extents( transform.frozen(), paths, self.get_transforms(), npy.asarray(offsets, npy.float_), transOffset.frozen()) result = result.inverse_transformed(transData) @@ -154,15 +154,19 @@ paths = [] for path in self._paths: vertices = path.vertices -xs, ys = zip(*segment) +xs, ys = vertices[:, 0], vertices[:, 1] xs = self.convert_xunits(xs) ys = self.convert_yunits(ys) -paths.append(path.Path(zip(xs, ys), path.codes)) +paths.append(mpath.Path(zip(xs, ys), path.codes)) if self._offsets is not None: xs = self.convert_xunits(self._offsets[:0]) ys = self.convert_yunits(self._offsets[:1]) offsets = zip(xs, ys) - +if len(offsets) == 0: +offsets = npy.zeros((1, 2)) +else: +offsets = npy.asarray(offsets, npy.float_) + self.update_scalarmappable() clippath, clippath_trans = self.get_transformed_clip_path_and_affine() @@ -179,7 +183,7 @@ renderer.draw_path_collection( transform.frozen(), self.clipbox, clippath, clippath_trans, paths, self.get_transforms(), -npy.asarray(offsets, npy.float_), transOffset, +offsets, transOffset, self._facecolors, self._edgecolors, self._linewidths, self._linestyles, self._antialiaseds) renderer.close_group(self.__class__.__name__) @@ -198,7 +202,7 @@ paths = [transform.transform_path_non_affine(path) for path in paths] transform = transform.get_affine() -ind = path.point_in_path_collection( +ind = mpath.point_in_path_collection( mouseevent.x, mouseevent.y, self._pickradius, transform.frozen(), paths, self.get_transforms(), npy.asarray(self._offsets, npy.float_), @@ -372,7 +376,7 @@ (0, 2) .. (0, meshWidth), (1, 0), (1, 1), and so on. def __init__(self, meshWidth, meshHeight, coordinates, showedges): -Path = path.Path +Path = mpath.Path Collection.__init__(self) self._meshWidth = meshWidth @@ -426,7 +430,7 @@ def set_verts(self, verts): '''This allows one to delay initialization of the vertices.''' -self._paths = [path.Path(v, closed=True) for v in verts] +self._paths = [mpath.Path(v, closed=True) for v in verts] def get_paths(self): return self._paths @@ -450,7 +454,7 @@ __init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd class RegularPolyCollection(Collection): -_path_generator = path.Path.unit_regular_polygon +_path_generator = mpath.Path.unit_regular_polygon def __init__(self, dpi, @@ -510,11 +514,11
SF.net SVN: matplotlib: [4056] branches/transforms/lib/matplotlib/ collections.py
Revision: 4056 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4056view=rev Author: mdboom Date: 2007-10-29 10:39:06 -0700 (Mon, 29 Oct 2007) Log Message: --- Oops -- this shouldn't have been committed. Modified Paths: -- branches/transforms/lib/matplotlib/collections.py Modified: branches/transforms/lib/matplotlib/collections.py === --- branches/transforms/lib/matplotlib/collections.py 2007-10-29 17:31:24 UTC (rev 4055) +++ branches/transforms/lib/matplotlib/collections.py 2007-10-29 17:39:06 UTC (rev 4056) @@ -608,7 +608,7 @@ def set_segments(self, segments): if segments is None: return -segments = [npy.asarray([[y.get_value() for y in x] for x in seg], npy.float_) for seg in segments] +segments = [npy.asarray(seg, npy.float_) for seg in segments] if self._uniform_offsets is not None: segments = self._add_offsets(segments) self._paths = [mpath.Path(seg, closed=False) for seg in segments] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4060] branches/transforms/lib/matplotlib
Revision: 4060 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4060view=rev Author: mdboom Date: 2007-10-29 11:37:17 -0700 (Mon, 29 Oct 2007) Log Message: --- Fix clip path in polar plot legend. Modified Paths: -- branches/transforms/lib/matplotlib/artist.py branches/transforms/lib/matplotlib/backend_bases.py Modified: branches/transforms/lib/matplotlib/artist.py === --- branches/transforms/lib/matplotlib/artist.py2007-10-29 18:23:24 UTC (rev 4059) +++ branches/transforms/lib/matplotlib/artist.py2007-10-29 18:37:17 UTC (rev 4060) @@ -309,6 +309,7 @@ if transform is None: if isinstance(path, Rectangle): self.clipbox = TransformedBbox(Bbox.unit(), path.get_transform()) +self._clippath = None success = True elif isinstance(path, Patch): self._clippath = TransformedPath( Modified: branches/transforms/lib/matplotlib/backend_bases.py === --- branches/transforms/lib/matplotlib/backend_bases.py 2007-10-29 18:23:24 UTC (rev 4059) +++ branches/transforms/lib/matplotlib/backend_bases.py 2007-10-29 18:37:17 UTC (rev 4060) @@ -326,13 +326,15 @@ def get_clip_rectangle(self): -Return the clip rectangle as (left, bottom, width, height) +Return the clip rectangle as a Bbox instance return self._cliprect def get_clip_path(self): -Return the clip path +Return the clip path in the form (path, transform), where path +is a path.Path instance, and transform as an affine transform +to apply to the path before clipping. if self._clippath is not None: return self._clippath.get_transformed_path_and_affine() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4107] trunk/matplotlib/lib/matplotlib
Revision: 4107 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4107view=rev Author: mdboom Date: 2007-11-05 07:45:00 -0800 (Mon, 05 Nov 2007) Log Message: --- First pass at getting STIX fonts to work. Support .otf fonts in font_manager.py Modified Paths: -- trunk/matplotlib/lib/matplotlib/_mathtext_data.py trunk/matplotlib/lib/matplotlib/font_manager.py trunk/matplotlib/lib/matplotlib/mathtext.py Modified: trunk/matplotlib/lib/matplotlib/_mathtext_data.py === --- trunk/matplotlib/lib/matplotlib/_mathtext_data.py 2007-11-05 02:36:20 UTC (rev 4106) +++ trunk/matplotlib/lib/matplotlib/_mathtext_data.py 2007-11-05 15:45:00 UTC (rev 4107) @@ -1885,7 +1885,7 @@ 'measeq': 8798, 'upharpoonleft': 8639, 'lq': 8216, -'Upsilon': 978, +'Upsilon': 933, 'subsetneq': 8842, 'greater': 62, 'supsetneq': 8843, @@ -2238,7 +2238,7 @@ 'combiningbreve' : 774, 'combiningoverline': 772, 'combininggraveaccent' : 768, -'combiningacuteaccent' : 714, +'combiningacuteaccent' : 769, 'combiningdiaeresis' : 776, 'combiningtilde' : 771, 'combiningrightarrowabove' : 8407, Modified: trunk/matplotlib/lib/matplotlib/font_manager.py === --- trunk/matplotlib/lib/matplotlib/font_manager.py 2007-11-05 02:36:20 UTC (rev 4106) +++ trunk/matplotlib/lib/matplotlib/font_manager.py 2007-11-05 15:45:00 UTC (rev 4107) @@ -36,7 +36,7 @@ import os, sys, glob, shutil from sets import Set import matplotlib -from matplotlib import afm +from matplotlib import afm from matplotlib import ft2font from matplotlib import rcParams, get_home, get_configdir from matplotlib.cbook import is_string_like @@ -95,6 +95,10 @@ path = os.path.join(home, '.fonts') X11FontDirectories.append(path) +def get_fontext_synonyms(fontext): +return {'ttf': ('ttf', 'otf'), +'afm': ('afm',)}[fontext] + def win32FontDirectory(): Return the user-specified font directory for Win32. @@ -121,6 +125,8 @@ if directory is None: directory = win32FontDirectory() +fontext = get_fontext_synonyms(fontext) + key, items = None, {} for fontdir in MSFontDirectories: try: @@ -129,7 +135,10 @@ continue if not local: -return glob.glob(os.path.join(directory, '*.'+fontext)) +files = [] +for ext in fontext: +files.extend(glob.glob(os.path.join(directory, '*.'+ext))) +return files try: for j in range(_winreg.QueryInfoKey(local)[1]): try: @@ -137,7 +146,7 @@ if not os.path.dirname(direc): direc = os.path.join(directory, direc) direc = os.path.abspath(direc).lower() -if direc[-4:] == '.'+fontext: +if os.path.splitext(direc)[1][1:] in fontext: items[direc] = 1 except EnvironmentError: continue @@ -168,13 +177,16 @@ if directory is None: directory = OSXFontDirectory() +fontext = get_fontext_synonyms(fontext) + files = [] for path in directory: if fontext is None: files.extend(glob.glob(os.path.join(path,'*'))) else: -files.extend(glob.glob(os.path.join(path, '*.'+fontext))) -files.extend(glob.glob(os.path.join(path, '*.'+fontext.upper( +for ext in fontext: +files.extend(glob.glob(os.path.join(path, '*.'+ext))) +files.extend(glob.glob(os.path.join(path, '*.'+ext.upper( return files @@ -201,12 +213,14 @@ except ImportError: return {} +fontext = get_fontext_synonyms(fontext) + fontfiles = {} status, output = commands.getstatusoutput(fc-list file) if status == 0: for line in output.split('\n'): fname = line.split(':')[0] -if (os.path.splitext(fname)[1] == . + fontext and +if (os.path.splitext(fname)[1][1:] in fontext and os.path.exists(fname)): fontfiles[fname] = 1 @@ -221,7 +235,8 @@ AFM fonts as an option. fontfiles = {} - +fontexts = get_fontext_synonyms(fontext) + if fontpaths is None: if sys.platform == 'win32': fontdir = win32FontDirectory() @@ -230,7 +245,7 @@ # now get all installed fonts directly... for f in win32InstalledFonts(fontdir): base, ext = os.path.splitext(f) -if len(ext)1 and ext[1:].lower()==fontext: +if len(ext)1 and ext[1:].lower() in fontexts: fontfiles[f] = 1 else: fontpaths = x11FontDirectory() @@ -246,8
SF.net SVN: matplotlib: [4110] trunk/matplotlib
Revision: 4110 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4110view=rev Author: mdboom Date: 2007-11-05 09:30:08 -0800 (Mon, 05 Nov 2007) Log Message: --- Make STIX fonts work. Modified Paths: -- trunk/matplotlib/examples/mathtext_examples.py trunk/matplotlib/lib/matplotlib/_mathtext_data.py trunk/matplotlib/lib/matplotlib/config/mplconfig.py trunk/matplotlib/lib/matplotlib/config/rcsetup.py trunk/matplotlib/lib/matplotlib/mathtext.py trunk/matplotlib/lib/matplotlib/rcsetup.py trunk/matplotlib/matplotlibrc.template Modified: trunk/matplotlib/examples/mathtext_examples.py === --- trunk/matplotlib/examples/mathtext_examples.py 2007-11-05 16:50:11 UTC (rev 4109) +++ trunk/matplotlib/examples/mathtext_examples.py 2007-11-05 17:30:08 UTC (rev 4110) @@ -48,7 +48,8 @@ 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$' +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}$' ] from pylab import * Modified: trunk/matplotlib/lib/matplotlib/_mathtext_data.py === --- trunk/matplotlib/lib/matplotlib/_mathtext_data.py 2007-11-05 16:50:11 UTC (rev 4109) +++ trunk/matplotlib/lib/matplotlib/_mathtext_data.py 2007-11-05 17:30:08 UTC (rev 4110) @@ -1755,7 +1755,10 @@ uni2type1 = dict([(v,k) for k,v in type12uni.items()]) -tex2uni = {'doteq': 8784, +tex2uni = { +'widehat': 0x0302, +'widetilde': 0x0303, +'doteq': 8784, 'partial': 8706, 'gg': 8811, 'asymp': 8781, Modified: trunk/matplotlib/lib/matplotlib/config/mplconfig.py === --- trunk/matplotlib/lib/matplotlib/config/mplconfig.py 2007-11-05 16:50:11 UTC (rev 4109) +++ trunk/matplotlib/lib/matplotlib/config/mplconfig.py 2007-11-05 17:30:08 UTC (rev 4110) @@ -166,7 +166,7 @@ it = T.Trait('serif:oblique' , mplT.FontconfigPatternHandler()) bf = T.Trait('serif:bold', mplT.FontconfigPatternHandler()) sf = T.Trait('sans' , mplT.FontconfigPatternHandler()) -use_cm = T.true +fontset = T.Trait('cm', 'cm', 'stix', 'custom') fallback_to_cm = T.true class axes(TConfig): @@ -344,7 +344,7 @@ 'mathtext.it' : (self.tconfig.mathtext, 'it'), 'mathtext.bf' : (self.tconfig.mathtext, 'bf'), 'mathtext.sf' : (self.tconfig.mathtext, 'sf'), -'mathtext.use_cm' : (self.tconfig.mathtext, 'use_cm'), +'mathtext.fontset': (self.tconfig.mathtext, 'fontset'), 'mathtext.fallback_to_cm' : (self.tconfig.mathtext, 'fallback_to_cm'), 'image.aspect' : (self.tconfig.image, 'aspect'), Modified: trunk/matplotlib/lib/matplotlib/config/rcsetup.py === --- trunk/matplotlib/lib/matplotlib/config/rcsetup.py 2007-11-05 16:50:11 UTC (rev 4109) +++ trunk/matplotlib/lib/matplotlib/config/rcsetup.py 2007-11-05 17:30:08 UTC (rev 4110) @@ -203,6 +203,8 @@ parse_fontconfig_pattern(s) return s +validate_fontset = ValidateInStrings('fontset', ['cm', 'stix', 'custom']) + validate_verbose = ValidateInStrings('verbose',[ 'silent', 'helpful', 'debug', 'debug-annoying', ]) @@ -365,7 +367,7 @@ 'mathtext.it' : ['serif:italic', validate_font_properties], 'mathtext.bf' : ['serif:bold', validate_font_properties], 'mathtext.sf' : ['sans\-serif', validate_font_properties], -'mathtext.use_cm' : [True, validate_bool], +'mathtext.fontset': ['cm', validate_fontset], 'mathtext.fallback_to_cm' : [True, validate_bool], 'image.aspect': ['equal', validate_aspect], # equal, auto, a number Modified: trunk/matplotlib/lib/matplotlib/mathtext.py === --- trunk/matplotlib/lib/matplotlib/mathtext.py 2007-11-05 16:50:11 UTC (rev 4109) +++ trunk/matplotlib/lib/matplotlib/mathtext.py 2007-11-05 17:30:08 UTC (rev 4110) @@ -528,7 +528,7 @@ A generic base class for all font setups that use Truetype fonts (through ft2font) -basepath = os.path.join( get_data_path(), 'fonts', 'ttf' ) +basepath = os.path.join( get_data_path(), 'fonts' ) class CachedFont: def __init__(self, font): @@ -665,7 +665,7 @@ TruetypeFonts.__init__(self, *args, **kwargs) if not len(self.fontmap): for key, val
SF.net SVN: matplotlib: [4115] trunk/matplotlib/lib/matplotlib/rcsetup.py
Revision: 4115 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4115view=rev Author: mdboom Date: 2007-11-05 12:42:23 -0800 (Mon, 05 Nov 2007) Log Message: --- Fix rcParams bug. Modified Paths: -- trunk/matplotlib/lib/matplotlib/rcsetup.py Modified: trunk/matplotlib/lib/matplotlib/rcsetup.py === --- trunk/matplotlib/lib/matplotlib/rcsetup.py 2007-11-05 20:13:00 UTC (rev 4114) +++ trunk/matplotlib/lib/matplotlib/rcsetup.py 2007-11-05 20:42:23 UTC (rev 4115) @@ -367,7 +367,7 @@ 'mathtext.it' : ['serif:italic', validate_font_properties], 'mathtext.bf' : ['serif:bold', validate_font_properties], 'mathtext.sf' : ['sans\-serif', validate_font_properties], -'mathtext.fontset': [True, validate_fontset], +'mathtext.fontset': ['cm', validate_fontset], 'mathtext.fallback_to_cm' : [True, validate_bool], 'image.aspect': ['equal', validate_aspect], # equal, auto, a number This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4122] branches/transforms/lib/matplotlib
Revision: 4122 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4122view=rev Author: mdboom Date: 2007-11-06 07:37:44 -0800 (Tue, 06 Nov 2007) Log Message: --- Minor speed improvement (thanks to Eric Firing). Also use matplotlib.numerix.npyma instead of numpy.ma Modified Paths: -- branches/transforms/lib/matplotlib/path.py branches/transforms/lib/matplotlib/transforms.py Modified: branches/transforms/lib/matplotlib/path.py === --- branches/transforms/lib/matplotlib/path.py 2007-11-06 13:14:08 UTC (rev 4121) +++ branches/transforms/lib/matplotlib/path.py 2007-11-06 15:37:44 UTC (rev 4122) @@ -7,7 +7,7 @@ import math import numpy as npy -from numpy import ma as ma +from matplotlib.numerix import npyma as ma from matplotlib._path import point_in_path, get_path_extents, \ point_in_path_collection @@ -86,7 +86,8 @@ resulting path will be compressed, with MOVETO codes inserted in the correct places to jump over the masked regions. -if not ma.isMaskedArray(vertices): +mask = ma.getmask(vertices) +if not mask: vertices = ma.asarray(vertices, npy.float_) if codes is None: @@ -112,7 +113,6 @@ # itself), are not expected to deal with masked arrays, so we # must remove them from the array (using compressed), and add # MOVETO commands to the codes array accordingly. -mask = ma.getmask(vertices) if mask is not ma.nomask: mask1d = ma.mask_or(mask[:, 0], mask[:, 1]) vertices = ma.compress(npy.invert(mask1d), vertices, 0) @@ -125,7 +125,6 @@ assert vertices.ndim == 2 assert vertices.shape[1] == 2 - assert codes.ndim == 1 self._codes = codes self._vertices = vertices Modified: branches/transforms/lib/matplotlib/transforms.py === --- branches/transforms/lib/matplotlib/transforms.py2007-11-06 13:14:08 UTC (rev 4121) +++ branches/transforms/lib/matplotlib/transforms.py2007-11-06 15:37:44 UTC (rev 4122) @@ -24,7 +24,7 @@ import numpy as npy -from numpy import ma as ma +from matplotlib.numerix import npyma as ma from numpy.linalg import inv from weakref import WeakKeyDictionary This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4126] trunk/matplotlib
Revision: 4126 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4126view=rev Author: mdboom Date: 2007-11-06 10:32:30 -0800 (Tue, 06 Nov 2007) Log Message: --- Prevent errors when using OpenType CFF fonts. This means turning off subsetting on backend_pdf, and raising an exception in backend_ps. Modified Paths: -- trunk/matplotlib/examples/mathtext_examples.py trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py trunk/matplotlib/lib/matplotlib/backends/backend_ps.py trunk/matplotlib/lib/matplotlib/font_manager.py trunk/matplotlib/lib/matplotlib/mathtext.py Modified: trunk/matplotlib/examples/mathtext_examples.py === --- trunk/matplotlib/examples/mathtext_examples.py 2007-11-06 18:23:13 UTC (rev 4125) +++ trunk/matplotlib/examples/mathtext_examples.py 2007-11-06 18:32:30 UTC (rev 4126) @@ -49,7 +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$', -ur'Generic symbol: $\u23ce \mathrm{\ue0f2}$' +ur'Generic symbol: $\u23ce \mathrm{\ue0f2 \U0001D538}$' ] from pylab import * Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py === --- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2007-11-06 18:23:13 UTC (rev 4125) +++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2007-11-06 18:32:30 UTC (rev 4126) @@ -9,6 +9,7 @@ import re import sys import time +import warnings import zlib import numpy as npy @@ -25,7 +26,7 @@ FigureManagerBase, FigureCanvasBase from matplotlib.cbook import Bunch, enumerate, is_string_like, reverse_dict, get_realpath_and_stat from matplotlib.figure import Figure -from matplotlib.font_manager import findfont +from matplotlib.font_manager import findfont, is_opentype_cff_font from matplotlib.afm import AFM import matplotlib.type1font as type1font import matplotlib.dviread as dviread @@ -786,7 +787,8 @@ glyph = font.load_char(ccode, flags=LOAD_NO_HINTING) # Why divided by 3.0 ??? Wish I knew... MGD widths.append((ccode, cvt(glyph.horiAdvance) / 3.0)) -cid_to_gid_map[ccode] = unichr(gind) +if ccode 65536: +cid_to_gid_map[ccode] = unichr(gind) max_ccode = max(ccode, max_ccode) widths.sort() cid_to_gid_map = cid_to_gid_map[:max_ccode + 1] @@ -876,6 +878,15 @@ 'StemV' : 0 # ??? } +# The font subsetting to a Type 3 font does not work for +# OpenType (.otf) that embed a Postscript CFF font, so avoid that -- +# save as a (non-subsetted) Type 42 font instead. +if is_opentype_cff_font(filename): +fonttype = 42 +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: @@ -1134,10 +1145,6 @@ self.truetype_font_cache = {} self.afm_font_cache = {} self.file.used_characters = self.used_characters = {} -if rcParams['pdf.fonttype'] == 3: -self.encode_string = self.encode_string_type3 -else: -self.encode_string = self.encode_string_type42 self.mathtext_parser = MathTextParser(Pdf) self.image_magnification = dpi/72.0 self.tex_font_map = None @@ -1344,7 +1351,7 @@ # When using Type 3 fonts, we can't use character codes higher # than 255, so we use the Do command to render those # instead. -fonttype = rcParams['pdf.fonttype'] +global_fonttype = rcParams['pdf.fonttype'] # Set up a global transformation matrix for the whole math expression a = angle / 180.0 * pi @@ -1357,6 +1364,11 @@ prev_font = None, None oldx, oldy = 0, 0 for ox, oy, fontname, fontsize, num, symbol_name in glyphs: +if is_opentype_cff_font(fontname): +fonttype = 42 +else: +fonttype = global_fonttype + if fonttype == 42 or num = 255: self._setup_textpos(ox, oy, 0, oldx, oldy) oldx, oldy = ox, oy @@ -1364,14 +1376,19 @@ self.file.output(self.file.fontName(fontname), fontsize, Op.selectfont) prev_font = fontname, fontsize -self.file.output(self.encode_string(unichr(num
SF.net SVN: matplotlib: [4130] trunk/matplotlib/lib/matplotlib/mpl-data/ fonts/ttf
Revision: 4130 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4130view=rev Author: mdboom Date: 2007-11-06 11:38:29 -0800 (Tue, 06 Nov 2007) Log Message: --- Converted STIX fonts from otf to ttf. Added Paths: --- trunk/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/LICENSE_STIX trunk/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/STIXGeneral.ttf trunk/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/STIXGeneralBol.ttf trunk/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/STIXGeneralBolIta.ttf trunk/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/STIXGeneralItalic.ttf trunk/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/STIXNonUni.ttf trunk/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/STIXNonUniBol.ttf trunk/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/STIXNonUniBolIta.ttf trunk/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/STIXNonUniIta.ttf trunk/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/STIXSiz1Sym.ttf trunk/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/STIXSiz1SymBol.ttf trunk/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/STIXSiz2Sym.ttf trunk/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/STIXSiz2SymBol.ttf trunk/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/STIXSiz3Sym.ttf trunk/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/STIXSiz3SymBol.ttf trunk/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/STIXSiz4Sym.ttf trunk/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/STIXSiz4SymBol.ttf trunk/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/STIXSiz5Sym.ttf Copied: trunk/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/LICENSE_STIX (from rev 4106, trunk/matplotlib/lib/matplotlib/mpl-data/fonts/otf/LICENSE_STIX) === --- trunk/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/LICENSE_STIX (rev 0) +++ trunk/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/LICENSE_STIX 2007-11-06 19:38:29 UTC (rev 4130) @@ -0,0 +1,71 @@ +TERMS AND CONDITIONS + + 1. Permission is hereby granted, free of charge, to any person +obtaining a copy of the STIX Fonts-TM set accompanying this license +(collectively, the Fonts) and the associated documentation files +(collectively with the Fonts, the Font Software), to reproduce and +distribute the Font Software, including the rights to use, copy, merge +and publish copies of the Font Software, and to permit persons to whom +the Font Software is furnished to do so same, subject to the following +terms and conditions (the License). + + 2. The following copyright and trademark notice and these Terms and +Conditions shall be included in all copies of one or more of the Font +typefaces and any derivative work created as permitted under this +License: + + Copyright (c) 2001-2005 by the STI Pub Companies, consisting of +the American Institute of Physics, the American Chemical Society, the +American Mathematical Society, the American Physical Society, Elsevier, +Inc., and The Institute of Electrical and Electronic Engineers, Inc. +Portions copyright (c) 1998-2003 by MicroPress, Inc. Portions copyright +(c) 1990 by Elsevier, Inc. All rights reserved. STIX Fonts-TM is a +trademark of The Institute of Electrical and Electronics Engineers, Inc. + + 3. You may (a) convert the Fonts from one format to another (e.g., +from TrueType to PostScript), in which case the normal and reasonable +distortion that occurs during such conversion shall be permitted and (b) +embed or include a subset of the Fonts in a document for the purposes of +allowing users to read text in the document that utilizes the Fonts. In +each case, you may use the STIX Fonts-TM mark to designate the resulting +Fonts or subset of the Fonts. + + 4. You may also (a) add glyphs or characters to the Fonts, or modify +the shape of existing glyphs, so long as the base set of glyphs is not +removed and (b) delete glyphs or characters from the Fonts, provided +that the resulting font set is distributed with the following +disclaimer: This [name] font does not include all the Unicode points +covered in the STIX Fonts-TM set but may include others. In each case, +the name used to denote the resulting font set shall not include the +term STIX or any similar term. + + 5. You may charge a fee in connection with the distribution of the +Font Software, provided that no copy of one or more of the individual +Font typefaces that form the STIX Fonts-TM set may be sold by itself. + + 6. THE FONT SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY +KIND, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK OR OTHER RIGHT. IN NO EVENT SHALL +MICROPRESS OR ANY OF THE STI PUB COMPANIES BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, INCLUDING, BUT NOT LIMITED TO, ANY GENERAL, +SPECIAL, INDIRECT, INCIDENTAL
SF.net SVN: matplotlib: [4131] trunk/matplotlib/lib/matplotlib/mpl-data/ fonts/otf/
Revision: 4131 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4131view=rev Author: mdboom Date: 2007-11-06 11:38:57 -0800 (Tue, 06 Nov 2007) Log Message: --- Removing STIX otf fonts Removed Paths: - trunk/matplotlib/lib/matplotlib/mpl-data/fonts/otf/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4132] trunk/matplotlib/lib/matplotlib/mathtext.py
Revision: 4132 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4132view=rev Author: mdboom Date: 2007-11-06 11:39:23 -0800 (Tue, 06 Nov 2007) Log Message: --- Converted STIX fonts from otf to ttf. Modified Paths: -- trunk/matplotlib/lib/matplotlib/mathtext.py Modified: trunk/matplotlib/lib/matplotlib/mathtext.py === --- trunk/matplotlib/lib/matplotlib/mathtext.py 2007-11-06 19:38:57 UTC (rev 4131) +++ trunk/matplotlib/lib/matplotlib/mathtext.py 2007-11-06 19:39:23 UTC (rev 4132) @@ -835,21 +835,21 @@ return [(fontname, sym)] class StixFonts(UnicodeFonts): -_fontmap = { 'rm' : ('STIXGeneral', 'otf'), - 'tt' : ('VeraMono', 'ttf'), - 'it' : ('STIXGeneralItalic', 'otf'), - 'bf' : ('STIXGeneralBol', 'otf'), - 'sf' : ('Vera', 'ttf'), - 'nonunirm' : ('STIXNonUni', 'otf'), - 'nonuniit' : ('STIXNonUniIta', 'otf'), - 'nonunibf' : ('STIXNonUniBol', 'otf'), +_fontmap = { 'rm' : 'STIXGeneral', + 'tt' : 'VeraMono', + 'it' : 'STIXGeneralItalic', + 'bf' : 'STIXGeneralBol', + 'sf' : 'Vera', + 'nonunirm' : 'STIXNonUni', + 'nonuniit' : 'STIXNonUniIta', + 'nonunibf' : 'STIXNonUniBol', - 0 : ('STIXGeneral', 'otf'), - 1 : ('STIXSiz1Sym', 'otf'), - 2 : ('STIXSiz2Sym', 'otf'), - 3 : ('STIXSiz3Sym', 'otf'), - 4 : ('STIXSiz4Sym', 'otf'), - 5 : ('STIXSiz5Sym', 'otf') + 0 : 'STIXGeneral', + 1 : 'STIXSiz1Sym', + 2 : 'STIXSiz2Sym', + 3 : 'STIXSiz3Sym', + 4 : 'STIXSiz4Sym', + 5 : 'STIXSiz5Sym' } fontmap = {} use_cmex = False @@ -858,8 +858,8 @@ def __init__(self, *args, **kwargs): TruetypeFonts.__init__(self, *args, **kwargs) if not len(self.fontmap): -for key, (name, ext) in self._fontmap.iteritems(): -fullpath = os.path.join(self.basepath, ext, name + . + ext) +for key, name in self._fontmap.iteritems(): +fullpath = os.path.join(self.basepath, 'ttf', name + .ttf) self.fontmap[key] = fullpath self.fontmap[name] = fullpath This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4154] branches/transforms/lib/matplotlib
Revision: 4154 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4154view=rev Author: mdboom Date: 2007-11-07 13:20:45 -0800 (Wed, 07 Nov 2007) Log Message: --- First pass at Cairo support on the branch. Modified Paths: -- branches/transforms/lib/matplotlib/backend_bases.py branches/transforms/lib/matplotlib/backends/backend_cairo.py branches/transforms/lib/matplotlib/path.py Modified: branches/transforms/lib/matplotlib/backend_bases.py === --- branches/transforms/lib/matplotlib/backend_bases.py 2007-11-07 20:38:46 UTC (rev 4153) +++ branches/transforms/lib/matplotlib/backend_bases.py 2007-11-07 21:20:45 UTC (rev 4154) @@ -62,7 +62,7 @@ that path multiple times with the different offsets, colors, styles etc. The methods _iter_collection_raw_paths and _iter_collection are provided to help with (and standardize) -the implementation that in each backend. +the implementation across backends. path_ids = [] for path, transform in self._iter_collection_raw_paths( @@ -91,10 +91,9 @@ if showedges: edgecolors = npy.array([[0.0, 0.0, 0.0, 1.0]], npy.float_) -linewidths = npy.array([1.0], npy.float_) else: -edgecolors = linewidths = npy.array([], npy.float_) -linewidths = npy.array([0.0], npy.float_) +edgecolors = facecolors +linewidths = npy.array([1.0], npy.float_) return self.draw_path_collection( master_transform, cliprect, clippath, clippath_trans, @@ -195,8 +194,10 @@ rgbFace = facecolors[i % Nfacecolors] if Nedgecolors: gc.set_foreground(edgecolors[i % Nedgecolors]) -gc.set_linewidth(linewidths[i % Nlinewidths]) -gc.set_dashes(*linestyles[i % Nlinestyles]) +if Nlinewidths: +gc.set_linewidth(linewidths[i % Nlinewidths]) +if Nlinestyles: +gc.set_dashes(*linestyles[i % Nlinestyles]) gc.set_antialiased(antialiaseds[i % Naa]) yield xo, yo, path_id, gc, rgbFace @@ -466,7 +467,7 @@ if isRGB: self._rgb = fg else: -self._rgb = colors.colorConverter.to_rgb(fg) +self._rgb = colors.colorConverter.to_rgba(fg) def set_graylevel(self, frac): Modified: branches/transforms/lib/matplotlib/backends/backend_cairo.py === --- branches/transforms/lib/matplotlib/backends/backend_cairo.py 2007-11-07 20:38:46 UTC (rev 4153) +++ branches/transforms/lib/matplotlib/backends/backend_cairo.py 2007-11-07 21:20:45 UTC (rev 4154) @@ -39,7 +39,8 @@ from matplotlib.cbookimport enumerate, izip, is_string_like from matplotlib.figure import Figure from matplotlib.mathtext import MathTextParser -from matplotlib.transforms import Bbox +from matplotlib.path import Path +from matplotlib.transforms import Bbox, Affine2D from matplotlib.font_manager import ttfFontProperty from matplotlib import rcParams @@ -48,9 +49,9 @@ # Image::color_conv(format) for draw_image() if sys.byteorder == 'little': - BYTE_FORMAT = 0 # BGRA +BYTE_FORMAT = 0 # BGRA else: - BYTE_FORMAT = 1 # ARGB +BYTE_FORMAT = 1 # ARGB class RendererCairo(RendererBase): @@ -91,10 +92,10 @@ self.mathtext_parser = MathTextParser('Cairo') def set_ctx_from_surface (self, surface): - self.ctx = cairo.Context (surface) - self.ctx.save() # restore, save - when call new_gc() +self.ctx = cairo.Context (surface) +self.ctx.save() # restore, save - when call new_gc() + - def set_width_height(self, width, height): self.width = width self.height = height @@ -109,9 +110,12 @@ #_.ctx.save() -if fill_c: +if fill_c is not None: ctx.save() -ctx.set_source_rgb (*fill_c) +if len(fill_c) == 3: +ctx.set_source_rgb (*fill_c) +else: +ctx.set_source_rgba (*fill_c) #if stroke_c: # always (implicitly) set at the moment ctx.fill_preserve() #else: @@ -124,22 +128,48 @@ #_.ctx.restore() # revert to the default attributes - -def draw_arc(self, gc, rgbFace, x, y, width, height, angle1, angle2, - rotation): -if _debug: print '%s.%s()' % (self.__class__.__name__, _fn_name()) +[EMAIL PROTECTED] +def convert_path(ctx, tpath): +for points, code in tpath.iter_segments(): +if code == Path.MOVETO: +ctx.move_to(*points) +elif code == Path.LINETO: +ctx.line_to(*points) +elif code
SF.net SVN: matplotlib: [4157] branches/transforms/src/_backend_agg.h
Revision: 4157 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4157view=rev Author: mdboom Date: 2007-11-08 05:21:17 -0800 (Thu, 08 Nov 2007) Log Message: --- Small bugfix to compile on gcc 4.x (Thanks, Eric) Modified Paths: -- branches/transforms/src/_backend_agg.h Modified: branches/transforms/src/_backend_agg.h === --- branches/transforms/src/_backend_agg.h 2007-11-08 00:24:57 UTC (rev 4156) +++ branches/transforms/src/_backend_agg.h 2007-11-08 13:21:17 UTC (rev 4157) @@ -165,7 +165,7 @@ Py::Object draw_image(const Py::Tuple args); Py::Object draw_path(const Py::Tuple args); Py::Object draw_path_collection(const Py::Tuple args); - Py::Object RendererAgg::draw_quad_mesh(const Py::Tuple args); + Py::Object draw_quad_mesh(const Py::Tuple args); Py::Object write_rgba(const Py::Tuple args); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4159] branches/transforms/src
Revision: 4159 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4159view=rev Author: mdboom Date: 2007-11-08 06:06:25 -0800 (Thu, 08 Nov 2007) Log Message: --- Get wxagg extension working again. Factor out the new Bbox conversion code into agg_py_transforms.h Modified Paths: -- branches/transforms/src/_backend_agg.cpp branches/transforms/src/_backend_agg.h branches/transforms/src/_gtkagg.cpp branches/transforms/src/_tkagg.cpp branches/transforms/src/_wxagg.cpp branches/transforms/src/agg_py_transforms.h Modified: branches/transforms/src/_backend_agg.cpp === --- branches/transforms/src/_backend_agg.cpp2007-11-08 14:05:18 UTC (rev 4158) +++ branches/transforms/src/_backend_agg.cpp2007-11-08 14:06:25 UTC (rev 4159) @@ -273,33 +273,6 @@ }; -bool -RendererAgg::bbox_to_rect(const Py::Object bbox_obj, double* l, double* b, double* r, double* t) { - PyArrayObject* bbox = NULL; - - if (bbox_obj.ptr() != Py_None) { -bbox = (PyArrayObject*) PyArray_FromObject(bbox_obj.ptr(), PyArray_DOUBLE, 2, 2); - -if (!bbox || PyArray_NDIM(bbox) != 2 || PyArray_DIM(bbox, 0) != 2 || PyArray_DIM(bbox, 1) != 2) { - Py_XDECREF(bbox); - throw Py::TypeError - (Expected a Bbox object.); -} - -*l = *(double*)PyArray_GETPTR2(bbox, 0, 0); -double _b = *(double*)PyArray_GETPTR2(bbox, 0, 1); -*r = *(double*)PyArray_GETPTR2(bbox, 1, 0); -double _t = *(double*)PyArray_GETPTR2(bbox, 1, 1); -*b = height - _t; -*t = height - _b; - -Py_XDECREF(bbox); -return true; - } - - return false; -} - templateclass R void RendererAgg::set_clipbox(const Py::Object cliprect, R rasterizer) { @@ -308,7 +281,7 @@ _VERBOSE(RendererAgg::set_clipbox); double l, b, r, t; - if (bbox_to_rect(cliprect, l, b, r, t)) { + if (py_convert_bbox(cliprect.ptr(), l, b, r, t)) { rasterizer-clip_box((int)l, (int)b, (int)r, (int)t); } @@ -408,7 +381,7 @@ Py::Object box_obj = args[0]; double l, b, r, t; - if (!bbox_to_rect(box_obj, l, b, r, t)) + if (!py_convert_bbox(box_obj.ptr(), l, b, r, t)) throw Py::TypeError(Invalid bbox provided to copy_from_bbox); agg::rect rect((int)l, (int)b, (int)r, (int)t); Modified: branches/transforms/src/_backend_agg.h === --- branches/transforms/src/_backend_agg.h 2007-11-08 14:05:18 UTC (rev 4158) +++ branches/transforms/src/_backend_agg.h 2007-11-08 14:06:25 UTC (rev 4159) @@ -215,7 +215,6 @@ double points_to_pixels_snapto( const Py::Object points); agg::rgba rgb_to_color(const Py::SeqBasePy::Object rgb, double alpha); facepair_t _get_rgba_face(const Py::Object rgbFace, double alpha); - bool bbox_to_rect(const Py::Object bbox, double* l, double* b, double* r, double* t); templateclass R void set_clipbox(const Py::Object cliprect, R rasterizer); bool render_clippath(const Py::Object clippath, const agg::trans_affine clippath_trans); Modified: branches/transforms/src/_gtkagg.cpp === --- branches/transforms/src/_gtkagg.cpp 2007-11-08 14:05:18 UTC (rev 4158) +++ branches/transforms/src/_gtkagg.cpp 2007-11-08 14:06:25 UTC (rev 4159) @@ -14,6 +14,7 @@ #include _backend_agg.h #define PY_ARRAY_TYPES_PREFIX NumPy #include numpy/arrayobject.h +#include agg_py_transforms.h // the extension module class _gtkagg_module : public Py::ExtensionModule_gtkagg_module @@ -71,31 +72,12 @@ else { //bbox is not None; copy the image in the bbox PyObject* clipbox = args[2].ptr(); - PyArrayObject* bbox = NULL; double l, b, r, t; - try { - bbox = (PyArrayObject*) PyArray_FromObject(clipbox, PyArray_DOUBLE, 2, 2); - - if (!bbox || bbox-nd != 2 || bbox-dimensions[0] != 2 || bbox-dimensions[1] != 2) { - throw Py::TypeError - (Argument 3 to agg_to_gtk_drawable must be a Bbox object.); - } - - l = *(double*)PyArray_GETPTR2(bbox, 0, 0); - b = *(double*)PyArray_GETPTR2(bbox, 0, 1); - r = *(double*)PyArray_GETPTR2(bbox, 1, 0); - t = *(double*)PyArray_GETPTR2(bbox, 1, 1); - - Py_XDECREF(bbox); - bbox = NULL; - } catch (...) { - Py_XDECREF(bbox); - bbox = NULL; - throw; + if (!py_convert_bbox(clipbox, l, b, r, t)) { + throw Py::TypeError + (Argument 3 to agg_to_gtk_drawable must be a Bbox object.); } - //std::cout b - //t ; destx = (int)l; desty = srcheight-(int)t; @@ -118,11 +100,8 @@ agg::rect_baseint region(destx, desty, (int)r, srcheight-(int)b); destrb.copy_from(*aggRenderer-renderingBuffer, region, -destx, -desty); - - } - /*std::cout desty
SF.net SVN: matplotlib: [4160] trunk/matplotlib/lib/matplotlib/mathtext.py
Revision: 4160 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4160view=rev Author: mdboom Date: 2007-11-08 06:31:15 -0800 (Thu, 08 Nov 2007) Log Message: --- Throw in dummy characters for symbols not in the Bakoma fonts. Modified Paths: -- trunk/matplotlib/lib/matplotlib/mathtext.py Modified: trunk/matplotlib/lib/matplotlib/mathtext.py === --- trunk/matplotlib/lib/matplotlib/mathtext.py 2007-11-08 14:06:25 UTC (rev 4159) +++ trunk/matplotlib/lib/matplotlib/mathtext.py 2007-11-08 14:31:15 UTC (rev 4160) @@ -672,6 +672,7 @@ _slanted_symbols = Set(r\int \oint.split()) def _get_glyph(self, fontname, sym, fontsize): +symbol_name = None if fontname in self.fontmap and latex_to_bakoma.has_key(sym): basename, num = latex_to_bakoma[sym] slanted = (basename == cmmi10) or sym in self._slanted_symbols @@ -682,11 +683,21 @@ slanted = (fontname == it) cached_font = self._get_font(fontname) num = ord(sym) -symbol_name = cached_font.font.get_glyph_name( -cached_font.charmap[num]) -else: -raise ValueError('unrecognized symbol %s' % sym) +gid = cached_font.charmap.get(num) +if gid is not None: +symbol_name = cached_font.font.get_glyph_name( +cached_font.charmap[num]) +if symbol_name is None: +warn(Unrecognized symbol '%s'. Substituting with a dummy symbol. + % sym.encode('ascii', 'backslashreplace'), MathTextWarning) +fontname = 'it' +cached_font = self._get_font(fontname) +num = 0x3F # currency character, for lack of anything better +gid = cached_font.charmap[num] +symbol_name = cached_font.font.get_glyph_name(gid) +slanted = False + return cached_font, num, symbol_name, fontsize, slanted # The Bakoma fonts contain many pre-sized alternatives for the This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4161] branches/transforms/examples/simple_plot_fps .py
Revision: 4161 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4161view=rev Author: mdboom Date: 2007-11-08 08:26:31 -0800 (Thu, 08 Nov 2007) Log Message: --- Updating the simple_plot_fps benchmark. Modified Paths: -- branches/transforms/examples/simple_plot_fps.py Modified: branches/transforms/examples/simple_plot_fps.py === --- branches/transforms/examples/simple_plot_fps.py 2007-11-08 14:31:15 UTC (rev 4160) +++ branches/transforms/examples/simple_plot_fps.py 2007-11-08 16:26:31 UTC (rev 4161) @@ -5,8 +5,7 @@ from pylab import * -plot([1,2]) -show() +ion() t = arange(0.0, 1.0+0.001, 0.001) s = cos(2*2*pi*t) @@ -21,14 +20,10 @@ #savefig('simple_plot') import time -from matplotlib import transforms - + frames = 100.0 -t = time.clock() -ion() +t = time.time() for i in xrange(int(frames)): -transforms.CATCH = True part = i / frames axis([0.0, 1.0 - part, -1.0 + part, 1.0 - part]) -show() -print fps:, frames / (time.clock() - t) +print fps:, frames / (time.time() - t) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4178] trunk/matplotlib/lib/matplotlib/backends/ backend_qt4agg.py
Revision: 4178 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4178view=rev Author: mdboom Date: 2007-11-09 05:10:12 -0800 (Fri, 09 Nov 2007) Log Message: --- Avoid annoying Qt4 messages when mpl raises an exception. (Thanks to Martin Teichmann in patch 1828813) Modified Paths: -- trunk/matplotlib/lib/matplotlib/backends/backend_qt4agg.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_qt4agg.py === --- trunk/matplotlib/lib/matplotlib/backends/backend_qt4agg.py 2007-11-09 13:08:48 UTC (rev 4177) +++ trunk/matplotlib/lib/matplotlib/backends/backend_qt4agg.py 2007-11-09 13:10:12 UTC (rev 4178) @@ -80,8 +80,6 @@ if DEBUG: print 'FigureCanvasQtAgg.paintEvent: ', self, \ self.get_width_height() -p = QtGui.QPainter( self ) - # only replot data when needed if type(self.replot) is bool: # might be a bbox for blitting if self.replot: @@ -99,6 +97,7 @@ qImage = QtGui.QImage(stringBuffer, self.renderer.width, self.renderer.height, QtGui.QImage.Format_ARGB32) +p = QtGui.QPainter(self) p.drawPixmap(QtCore.QPoint(0, 0), QtGui.QPixmap.fromImage(qImage)) # draw the zoom rectangle to the QPainter @@ -106,6 +105,7 @@ p.setPen( QtGui.QPen( QtCore.Qt.black, 1, QtCore.Qt.DotLine ) ) p.drawRect( self.rect[0], self.rect[1], self.rect[2], self.rect[3] ) +p.end() # we are blitting here else: bbox = self.replot @@ -114,10 +114,10 @@ reg = self.copy_from_bbox(bbox) stringBuffer = reg.to_string() qImage = QtGui.QImage(stringBuffer, w, h, QtGui.QImage.Format_ARGB32) +p = QtGui.QPainter(self) pixmap = QtGui.QPixmap.fromImage(qImage) p.drawPixmap(QtCore.QPoint(l, self.renderer.height-t), pixmap) - -p.end() +p.end() self.replot = False self.drawRect = False This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4184] branches/transforms/src/_backend_agg.cpp
Revision: 4184 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4184view=rev Author: mdboom Date: 2007-11-09 08:33:58 -0800 (Fri, 09 Nov 2007) Log Message: --- Fix misaligned clipping rectangle. Modified Paths: -- branches/transforms/src/_backend_agg.cpp Modified: branches/transforms/src/_backend_agg.cpp === --- branches/transforms/src/_backend_agg.cpp2007-11-09 14:24:41 UTC (rev 4183) +++ branches/transforms/src/_backend_agg.cpp2007-11-09 16:33:58 UTC (rev 4184) @@ -282,7 +282,7 @@ double l, b, r, t; if (py_convert_bbox(cliprect.ptr(), l, b, r, t)) { -rasterizer-clip_box((int)l, (int)b, (int)r, (int)t); +rasterizer-clip_box((int)l + 1, (int)b + 1, (int)r + 1, (int)t + 1); } _VERBOSE(RendererAgg::set_clipbox done); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4185] branches/transforms/lib/matplotlib
Revision: 4185 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4185view=rev Author: mdboom Date: 2007-11-09 08:35:15 -0800 (Fri, 09 Nov 2007) Log Message: --- Get wx backend working with wxGraphicsContext drawing. Modified Paths: -- branches/transforms/lib/matplotlib/backend_bases.py branches/transforms/lib/matplotlib/backends/backend_wx.py Modified: branches/transforms/lib/matplotlib/backend_bases.py === --- branches/transforms/lib/matplotlib/backend_bases.py 2007-11-09 16:33:58 UTC (rev 4184) +++ branches/transforms/lib/matplotlib/backend_bases.py 2007-11-09 16:35:15 UTC (rev 4185) @@ -67,8 +67,6 @@ override this method in order to draw the marker only once and reuse it multiple times. -ctx = gc.ctx -ctx.new_path() tpath = trans.transform_path(path) for x, y in tpath.vertices: self.draw_path(gc, marker_path, Modified: branches/transforms/lib/matplotlib/backends/backend_wx.py === --- branches/transforms/lib/matplotlib/backends/backend_wx.py 2007-11-09 16:33:58 UTC (rev 4184) +++ branches/transforms/lib/matplotlib/backends/backend_wx.py 2007-11-09 16:35:15 UTC (rev 4185) @@ -94,7 +94,7 @@ cvs_id = '$Id$' -import sys, os, os.path, math, StringIO +import sys, os, os.path, math, StringIO, weakref # Debugging settings here... # Debug level set here. If the debug level is less than 5, information @@ -154,7 +154,9 @@ from matplotlib.artist import Artist from matplotlib.cbook import exception_to_str from matplotlib.figure import Figure +from matplotlib.path import Path from matplotlib.text import _process_text_args, Text +from matplotlib.transforms import Affine2D from matplotlib.widgets import SubplotTool from matplotlib import rcParams @@ -261,10 +263,14 @@ #return 1, 1 if ismath: s = self.strip_math(s) -if self.gc is None: gc = self.new_gc() +if self.gc is None: +gc = self.new_gc() +else: +gc = self.gc +gfx_ctx = gc.gfx_ctx font = self.get_wx_font(s, prop) -self.gc.SetFont(font) -w, h, descent, leading = self.gc.GetFullTextExtent(s) +gfx_ctx.SetFont(font, wx.BLACK) +w, h, descent, leading = gfx_ctx.GetFullTextExtent(s) return w, h, descent @@ -272,97 +278,49 @@ 'return the canvas width and height in display coords' return self.width, self.height - -def draw_arc(self, gc, rgbFace, x, y, width, height, angle1, angle2, rotation): - -Draw an arc centered at x,y with width and height and angles -from 0.0 to 360.0. -If rgbFace is present, fill the figure in this colour, otherwise -it is not filled. - +def handle_clip_rectangle(self, gc): +new_bounds = gc.get_clip_rectangle() +if new_bounds is not None: +new_bounds = new_bounds.bounds +gfx_ctx = gc.gfx_ctx +if gfx_ctx._lastcliprect != new_bounds: +gfx_ctx._lastcliprect = new_bounds +if new_bounds is None: +gfx_ctx.ResetClip() +else: +gfx_ctx.Clip(*new_bounds) + +[EMAIL PROTECTED] +def convert_path(gfx_ctx, tpath): +wxpath = gfx_ctx.CreatePath() +for points, code in tpath.iter_segments(): +if code == Path.MOVETO: +wxpath.MoveToPoint(*points) +elif code == Path.LINETO: +wxpath.AddLineToPoint(*points) +elif code == Path.CURVE3: +wxpath.AddQuadCurveToPoint(*points) +elif code == Path.CURVE4: +wxpath.AddCurveToPoint(*points) +elif code == Path.CLOSEPOLY: +wxpath.CloseSubpath() +return wxpath +convert_path = staticmethod(convert_path) + +def draw_path(self, gc, path, transform, rgbFace=None): gc.select() -assert gc.Ok(), wxMemoryDC not OK to use -# wxPython requires upper left corner of bounding rectange for ellipse -# Theoretically you don't need the int() below, but it seems to make -# rounding of arc centre point more accurate in screen co-ordinates -ulX = x - int(width/2) -ulY = self.height - int(y + (height/2)) +self.handle_clip_rectangle(gc) +gfx_ctx = gc.gfx_ctx +transform = transform + Affine2D().scale(1.0, -1.0).translate(0.0, self.height) +tpath = transform.transform_path(path) +wxpath = self.convert_path(gfx_ctx, tpath) if rgbFace is not None: -r,g,b = self._to_wx_rgb(rgbFace) -new_brush =wx.Brush(wx.Colour(r,g,b), wx.SOLID) -gc.SetBrush(new_brush) +gfx_ctx.SetBrush(wx.Brush(gc.get_wxcolour(rgbFace))) +gfx_ctx.DrawPath
SF.net SVN: matplotlib: [4189] branches/transforms/lib/matplotlib
Revision: 4189 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4189view=rev Author: mdboom Date: 2007-11-09 11:09:42 -0800 (Fri, 09 Nov 2007) Log Message: --- Add support for nonuniform grids to imshow. Modified Paths: -- branches/transforms/lib/matplotlib/axes.py branches/transforms/lib/matplotlib/image.py Modified: branches/transforms/lib/matplotlib/axes.py === --- branches/transforms/lib/matplotlib/axes.py 2007-11-09 16:43:38 UTC (rev 4188) +++ branches/transforms/lib/matplotlib/axes.py 2007-11-09 19:09:42 UTC (rev 4189) @@ -4385,7 +4385,9 @@ plotting z(x,y): imshow, pcolor and relatives, contour -def imshow(self, X, +def imshow(self, I, + X = None, + Y = None, cmap = None, norm = None, aspect=None, @@ -4402,18 +4404,24 @@ **kwargs): -IMSHOW(X, cmap=None, norm=None, aspect=None, interpolation=None, - alpha=1.0, vmin=None, vmax=None, origin=None, extent=None) +IMSHOW(I, X=None, Y=None, cmap=None, norm=None, aspect=None, + interpolation=None, alpha=1.0, vmin=None, vmax=None, + origin=None, extent=None) -IMSHOW(X) - plot image X to current axes, resampling to scale to axes -size (X may be numarray/Numeric array or PIL image) +IMSHOW(I) - plot image I to current axes, resampling to scale to axes +size (I may be numarray/Numeric array or PIL image) -IMSHOW(X, **kwargs) - Use keyword args to control image scaling, -colormapping etc. See below for details +IMSHOW(I, X, Y) - plot image I to current axes, with + nonuniform X and Y axes. (I, X and Y may be + numarray/Numeric array or PIL image) + +IMSHOW(I, X, Y, **kwargs) - Use keyword args to control image +scaling, colormapping etc. See +below for details -Display the image in X to current axes. X may be a float array, a -uint8 array or a PIL image. If X is an array, X can have the following +Display the image in I to current axes. I may be a float array, a +uint8 array or a PIL image. If I is an array, I can have the following shapes: MxN: luminance (grayscale, float array only) @@ -4425,6 +4433,10 @@ The value for each component of MxNx3 and MxNx4 float arrays should be in the range 0.0 to 1.0; MxN float arrays may be normalised. +X and/or Y may be provided to specify a non-uniform image +grid. Each element of the X or Y arrays is the width or height +of the corresponding pixel in the given image. + A image.AxesImage instance is returned The following kwargs are allowed: @@ -4488,12 +4500,25 @@ if norm is not None: assert(isinstance(norm, mcolors.Normalize)) if cmap is not None: assert(isinstance(cmap, mcolors.Colormap)) if aspect is None: aspect = rcParams['image.aspect'] -self.set_aspect(aspect) -im = mimage.AxesImage(self, cmap, norm, interpolation, origin, extent, - filternorm=filternorm, - filterrad=filterrad, **kwargs) - -im.set_data(X) +# self.set_aspect(aspect) + +if X is None and Y is None: +im = mimage.AxesImage(self, cmap, norm, interpolation, origin, extent, + filternorm=filternorm, + filterrad=filterrad, **kwargs) + +im.set_data(I) +else: +if X is None: +X = npy.arange(I.shape[1]) +if Y is None: +Y = npy.arange(I.shape[0]) +im = mimage.NonUniformImage(self, cmap=cmap, norm=norm, +interpolation=interpolation, +origin=origin, extent=extent, +filternorm=filternorm, +filterrad=filterrad, **kwargs) +im.set_data(X, Y, I) im.set_alpha(alpha) self._set_artist_props(im) im.set_clip_path(self.axesPatch) @@ -4515,7 +4540,7 @@ return im - + def _pcolorargs(self, funcname, *args): if len(args)==1: C = args[0] Modified: branches/transforms/lib/matplotlib/image.py === --- branches/transforms/lib/matplotlib/image.py 2007-11-09 16:43:38 UTC (rev 4188) +++ branches/transforms/lib/matplotlib/image.py 2007-11-09 19:09:42 UTC (rev 4189) @@ -77,8 +77,6 @@ # reverse interp dict self
SF.net SVN: matplotlib: [4190] branches/transforms/lib
Revision: 4190 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4190view=rev Author: mdboom Date: 2007-11-09 11:23:42 -0800 (Fri, 09 Nov 2007) Log Message: --- Merging trunk to branch Added Paths: --- branches/transforms/lib/enthought/ branches/transforms/lib/enthought/etsconfig/ branches/transforms/lib/enthought/etsconfig/tests/ branches/transforms/lib/enthought/traits/ branches/transforms/lib/enthought/traits/plugins/ Removed Paths: - branches/transforms/lib/enthought/etsconfig/ branches/transforms/lib/enthought/etsconfig/tests/ branches/transforms/lib/enthought/traits/ branches/transforms/lib/enthought/traits/plugins/ branches/transforms/lib/pytz/ Copied: branches/transforms/lib/enthought (from rev 4188, trunk/matplotlib/lib/enthought) Copied: branches/transforms/lib/enthought/etsconfig (from rev 4188, trunk/matplotlib/lib/enthought/etsconfig) Copied: branches/transforms/lib/enthought/etsconfig/tests (from rev 4188, trunk/matplotlib/lib/enthought/etsconfig/tests) Copied: branches/transforms/lib/enthought/traits (from rev 4188, trunk/matplotlib/lib/enthought/traits) Copied: branches/transforms/lib/enthought/traits/plugins (from rev 4188, trunk/matplotlib/lib/enthought/traits/plugins) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4194] trunk/matplotlib/lib/matplotlib/axes.py
Revision: 4194 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4194view=rev Author: mdboom Date: 2007-11-09 12:14:29 -0800 (Fri, 09 Nov 2007) Log Message: --- Fix exception plotting an errorbar graph with only two data points. Modified Paths: -- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py === --- trunk/matplotlib/lib/matplotlib/axes.py 2007-11-09 20:00:39 UTC (rev 4193) +++ trunk/matplotlib/lib/matplotlib/axes.py 2007-11-09 20:14:29 UTC (rev 4194) @@ -3717,7 +3717,7 @@ plot_kw['mew']=kwargs['mew'] if xerr is not None: -if iterable(xerr) and len(xerr)==2: +if iterable(xerr) and len(xerr)==2 and iterable(xerr[0]) and iterable(xerr[1]): # using list comps rather than arrays to preserve units left = [thisx-thiserr for (thisx, thiserr) in cbook.safezip(x,xerr[0])] right = [thisx+thiserr for (thisx, thiserr) in cbook.safezip(x,xerr[1])] @@ -3751,7 +3751,7 @@ caplines.extend( self.plot(right, y, 'k|', **plot_kw) ) if yerr is not None: -if iterable(yerr) and len(yerr)==2: +if iterable(yerr) and len(yerr)==2 and iterable(yerr[0]) and iterable(yerr[1]): # using list comps rather than arrays to preserve units lower = [thisy-thiserr for (thisy, thiserr) in cbook.safezip(y,yerr[0])] upper = [thisy+thiserr for (thisy, thiserr) in cbook.safezip(y,yerr[1])] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins