You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(115) |
Aug
(120) |
Sep
(137) |
Oct
(170) |
Nov
(461) |
Dec
(263) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(120) |
Feb
(74) |
Mar
(35) |
Apr
(74) |
May
(245) |
Jun
(356) |
Jul
(240) |
Aug
(115) |
Sep
(78) |
Oct
(225) |
Nov
(98) |
Dec
(271) |
2009 |
Jan
(132) |
Feb
(84) |
Mar
(74) |
Apr
(56) |
May
(90) |
Jun
(79) |
Jul
(83) |
Aug
(296) |
Sep
(214) |
Oct
(76) |
Nov
(82) |
Dec
(66) |
2010 |
Jan
(46) |
Feb
(58) |
Mar
(51) |
Apr
(77) |
May
(58) |
Jun
(126) |
Jul
(128) |
Aug
(64) |
Sep
(50) |
Oct
(44) |
Nov
(48) |
Dec
(54) |
2011 |
Jan
(68) |
Feb
(52) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
|
|
|
1
|
2
|
3
|
4
(3) |
5
|
6
|
7
|
8
|
9
|
10
(5) |
11
(1) |
12
|
13
(1) |
14
(1) |
15
|
16
|
17
|
18
(2) |
19
(3) |
20
(3) |
21
(7) |
22
|
23
(2) |
24
(1) |
25
|
26
(4) |
27
(2) |
28
|
29
|
30
|
31
|
|
|
|
|
|
Revision: 5026 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5026&view=rev Author: mdboom Date: 2008年03月27日 07:42:26 -0700 (2008年3月27日) Log Message: ----------- Merged revisions 5024-5025 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_91_maint ........ r5025 | mdboom | 2008年03月27日 10:26:19 -0400 (2008年3月27日) | 4 lines Fix saving to Unicode filenames in Agg backend. Fix Qt and Qt4 GUI's to support saving to Unicode filenames in file save dialogs. Wx, Gtk and Tk GUIs already appear to work. ........ Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/backends/backend_agg.py trunk/matplotlib/lib/matplotlib/backends/backend_qt.py trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py trunk/matplotlib/src/_backend_agg.cpp Property Changed: ---------------- trunk/matplotlib/ Property changes on: trunk/matplotlib ___________________________________________________________________ Name: svnmerge-integrated - /branches/v0_91_maint:1-5023 + /branches/v0_91_maint:1-5025 Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008年03月27日 14:26:19 UTC (rev 5025) +++ trunk/matplotlib/CHANGELOG 2008年03月27日 14:42:26 UTC (rev 5026) @@ -1,3 +1,7 @@ +2008年03月27日 Fix saving to Unicode filenames with Agg backend + (other backends appear to already work...) + (Thanks, Christopher Barker) - MGD + 2008年03月26日 Fix SVG backend bug that prevents copying and pasting in Inkscape (thanks Kaushik Ghose) - MGD Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2008年03月27日 14:26:19 UTC (rev 5025) +++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2008年03月27日 14:42:26 UTC (rev 5026) @@ -286,19 +286,23 @@ def get_default_filetype(self): return 'png' - def print_raw(self, filename, *args, **kwargs): + def print_raw(self, filename_or_obj, *args, **kwargs): FigureCanvasAgg.draw(self) + renderer = self.get_renderer() original_dpi = renderer.dpi renderer.dpi = self.figure.dpi - renderer._renderer.write_rgba(str(filename)) + if type(filename_or_obj) in (str, unicode): + filename_or_obj = open(filename_or_obj, 'w') + renderer._renderer.write_rgba(filename_or_obj) renderer.dpi = original_dpi print_rgba = print_raw - def print_png(self, filename, *args, **kwargs): + def print_png(self, filename_or_obj, *args, **kwargs): FigureCanvasAgg.draw(self) renderer = self.get_renderer() original_dpi = renderer.dpi renderer.dpi = self.figure.dpi - filename = str(filename) # until we figure out unicode handling - renderer._renderer.write_png(filename, self.figure.dpi) + if type(filename_or_obj) in (str, unicode): + filename_or_obj = open(filename_or_obj, 'w') + self.get_renderer()._renderer.write_png(filename_or_obj, self.figure.dpi) renderer.dpi = original_dpi Modified: trunk/matplotlib/lib/matplotlib/backends/backend_qt.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_qt.py 2008年03月27日 14:26:19 UTC (rev 5025) +++ trunk/matplotlib/lib/matplotlib/backends/backend_qt.py 2008年03月27日 14:42:26 UTC (rev 5026) @@ -427,7 +427,7 @@ selectedFilter) if fname: try: - self.canvas.print_figure( fname.latin1() ) + self.canvas.print_figure( unicode(fname) ) except Exception, e: qt.QMessageBox.critical( self, "Error saving file", str(e), Modified: trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py 2008年03月27日 14:26:19 UTC (rev 5025) +++ trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py 2008年03月27日 14:42:26 UTC (rev 5026) @@ -376,7 +376,7 @@ self, "Choose a filename to save to", start, filters, selectedFilter) if fname: try: - self.canvas.print_figure( str(fname.toLatin1()) ) + self.canvas.print_figure( unicode(fname) ) except Exception, e: QtGui.QMessageBox.critical( self, "Error saving file", str(e), Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2008年03月27日 14:26:19 UTC (rev 5025) +++ trunk/matplotlib/src/_backend_agg.cpp 2008年03月27日 14:42:26 UTC (rev 5026) @@ -1286,12 +1286,33 @@ _VERBOSE("RendererAgg::write_rgba"); args.verify_length(1); - std::string fname = Py::String(args[0]); - std::ofstream of2( fname.c_str(), std::ios::binary|std::ios::out); - for (size_t i=0; i<NUMBYTES; i++) { - of2.write((char*)&(pixBuffer[i]), sizeof(char)); + FILE *fp = NULL; + bool close_file = false; + Py::Object py_fileobj = Py::Object(args[0]); + if (py_fileobj.isString()) { + std::string fileName = Py::String(py_fileobj); + const char *file_name = fileName.c_str(); + if ((fp = fopen(file_name, "wb")) == NULL) + throw Py::RuntimeError( Printf("Could not open file %s", file_name).str() ); + fwrite(pixBuffer, 1, NUMBYTES, fp); + close_file = true; + fclose(fp); + } else if (PyFile_CheckExact(py_fileobj.ptr())) { + fp = PyFile_AsFile(py_fileobj.ptr()); + fwrite(pixBuffer, 1, NUMBYTES, fp); + } else { + PyObject* write_method = PyObject_GetAttrString(py_fileobj.ptr(), "write"); + if (!(write_method && PyCallable_Check(write_method))) { + Py_XDECREF(write_method); + throw Py::TypeError("Object does not appear to be a 8-bit string path or a Python file-like object"); + } + + PyObject_CallFunction(write_method, "s#", pixBuffer, NUMBYTES); + + Py_XDECREF(write_method); } + return Py::Object(); } @@ -1326,18 +1347,22 @@ args.verify_length(1, 2); FILE *fp = NULL; + bool close_file = false; Py::Object py_fileobj = Py::Object(args[0]); if (py_fileobj.isString()) { std::string fileName = Py::String(py_fileobj); const char *file_name = fileName.c_str(); if ((fp = fopen(file_name, "wb")) == NULL) throw Py::RuntimeError( Printf("Could not open file %s", file_name).str() ); + close_file = true; + } else if (PyFile_CheckExact(py_fileobj.ptr())) { + fp = PyFile_AsFile(py_fileobj.ptr()); } else { PyObject* write_method = PyObject_GetAttrString(py_fileobj.ptr(), "write"); if (!(write_method && PyCallable_Check(write_method))) { Py_XDECREF(write_method); - throw Py::TypeError("Object does not appear to be a path or a Python file-like object"); + throw Py::TypeError("Object does not appear to be a 8-bit string path or a Python file-like object"); } Py_XDECREF(write_method); } @@ -1406,7 +1431,7 @@ */ } catch (...) { - if (fp) fclose(fp); + if (fp && close_file) fclose(fp); delete [] row_pointers; if (png_ptr && info_ptr) png_destroy_write_struct(&png_ptr, &info_ptr); throw; @@ -1414,7 +1439,7 @@ png_destroy_write_struct(&png_ptr, &info_ptr); delete [] row_pointers; - if (fp) fclose(fp); + if (fp && close_file) fclose(fp); return Py::Object(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5025 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5025&view=rev Author: mdboom Date: 2008年03月27日 07:26:19 -0700 (2008年3月27日) Log Message: ----------- Fix saving to Unicode filenames in Agg backend. Fix Qt and Qt4 GUI's to support saving to Unicode filenames in file save dialogs. Wx, Gtk and Tk GUIs already appear to work. Modified Paths: -------------- branches/v0_91_maint/CHANGELOG branches/v0_91_maint/lib/matplotlib/backends/backend_agg.py branches/v0_91_maint/lib/matplotlib/backends/backend_qt.py branches/v0_91_maint/lib/matplotlib/backends/backend_qt4.py branches/v0_91_maint/src/_backend_agg.cpp Modified: branches/v0_91_maint/CHANGELOG =================================================================== --- branches/v0_91_maint/CHANGELOG 2008年03月26日 14:43:20 UTC (rev 5024) +++ branches/v0_91_maint/CHANGELOG 2008年03月27日 14:26:19 UTC (rev 5025) @@ -1,3 +1,7 @@ +2008年03月27日 Fix saving to Unicode filenames with Agg backend + (other backends appear to already work...) + (Thanks, Christopher Barker) - MGD + 2008年03月26日 Fix SVG backend bug that prevents copying and pasting in Inkscape (thanks Kaushik Ghose) - MGD Modified: branches/v0_91_maint/lib/matplotlib/backends/backend_agg.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/backends/backend_agg.py 2008年03月26日 14:43:20 UTC (rev 5024) +++ branches/v0_91_maint/lib/matplotlib/backends/backend_agg.py 2008年03月27日 14:26:19 UTC (rev 5025) @@ -387,13 +387,17 @@ def get_default_filetype(self): return 'png' - def print_raw(self, filename, *args, **kwargs): + def print_raw(self, filename_or_obj, *args, **kwargs): self.draw() - self.get_renderer()._renderer.write_rgba(str(filename)) + if type(filename_or_obj) in (str, unicode): + filename_or_obj = open(filename_or_obj, 'w') + self.get_renderer()._renderer.write_rgba(filename_or_obj) print_rgba = print_raw - def print_png(self, filename, *args, **kwargs): + def print_png(self, filename_or_obj, *args, **kwargs): self.draw() - filename = str(filename) # until we figure out unicode handling - self.get_renderer()._renderer.write_png(filename, self.figure.dpi.get()) + if type(filename_or_obj) in (str, unicode): + filename_or_obj = open(filename_or_obj, 'w') + self.get_renderer()._renderer.write_png(filename_or_obj, + self.figure.dpi.get()) Modified: branches/v0_91_maint/lib/matplotlib/backends/backend_qt.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/backends/backend_qt.py 2008年03月26日 14:43:20 UTC (rev 5024) +++ branches/v0_91_maint/lib/matplotlib/backends/backend_qt.py 2008年03月27日 14:26:19 UTC (rev 5025) @@ -425,7 +425,7 @@ selectedFilter) if fname: try: - self.canvas.print_figure( fname.latin1() ) + self.canvas.print_figure( unicode(fname) ) except Exception, e: qt.QMessageBox.critical( self, "Error saving file", str(e), Modified: branches/v0_91_maint/lib/matplotlib/backends/backend_qt4.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/backends/backend_qt4.py 2008年03月26日 14:43:20 UTC (rev 5024) +++ branches/v0_91_maint/lib/matplotlib/backends/backend_qt4.py 2008年03月27日 14:26:19 UTC (rev 5025) @@ -425,12 +425,12 @@ selectedFilter = filter filters.append(filter) filters = ';;'.join(filters) - + fname = QtGui.QFileDialog.getSaveFileName( self, "Choose a filename to save to", start, filters, selectedFilter) if fname: try: - self.canvas.print_figure( str(fname.toLatin1()) ) + self.canvas.print_figure( unicode(fname) ) except Exception, e: QtGui.QMessageBox.critical( self, "Error saving file", str(e), Modified: branches/v0_91_maint/src/_backend_agg.cpp =================================================================== --- branches/v0_91_maint/src/_backend_agg.cpp 2008年03月26日 14:43:20 UTC (rev 5024) +++ branches/v0_91_maint/src/_backend_agg.cpp 2008年03月27日 14:26:19 UTC (rev 5025) @@ -2247,14 +2247,34 @@ _VERBOSE("RendererAgg::write_rgba"); args.verify_length(1); - std::string fname = Py::String( args[0]); - std::ofstream of2( fname.c_str(), std::ios::binary|std::ios::out); - for (size_t i=0; i<NUMBYTES; i++) { - of2.write((char*)&(pixBuffer[i]), sizeof(char)); + FILE *fp = NULL; + bool close_file = false; + Py::Object py_fileobj = Py::Object(args[0]); + if (py_fileobj.isString()) { + std::string fileName = Py::String(py_fileobj); + const char *file_name = fileName.c_str(); + if ((fp = fopen(file_name, "wb")) == NULL) + throw Py::RuntimeError( Printf("Could not open file %s", file_name).str() ); + fwrite(pixBuffer, 1, NUMBYTES, fp); + close_file = true; + fclose(fp); + } else if (PyFile_CheckExact(py_fileobj.ptr())) { + fp = PyFile_AsFile(py_fileobj.ptr()); + fwrite(pixBuffer, 1, NUMBYTES, fp); + } else { + PyObject* write_method = PyObject_GetAttrString(py_fileobj.ptr(), "write"); + if (!(write_method && PyCallable_Check(write_method))) { + Py_XDECREF(write_method); + throw Py::TypeError("Object does not appear to be a 8-bit string path or a Python file-like object"); + } + + PyObject_CallFunction(write_method, "s#", pixBuffer, NUMBYTES); + + Py_XDECREF(write_method); } + return Py::Object(); - } static void write_png_data(png_structp png_ptr, png_bytep data, png_size_t length) { @@ -2288,18 +2308,22 @@ args.verify_length(1, 2); FILE *fp = NULL; + bool close_file = false; Py::Object py_fileobj = Py::Object(args[0]); if (py_fileobj.isString()) { std::string fileName = Py::String(py_fileobj); const char *file_name = fileName.c_str(); if ((fp = fopen(file_name, "wb")) == NULL) throw Py::RuntimeError( Printf("Could not open file %s", file_name).str() ); + close_file = true; + } else if (PyFile_CheckExact(py_fileobj.ptr())) { + fp = PyFile_AsFile(py_fileobj.ptr()); } else { PyObject* write_method = PyObject_GetAttrString(py_fileobj.ptr(), "write"); if (!(write_method && PyCallable_Check(write_method))) { Py_XDECREF(write_method); - throw Py::TypeError("Object does not appear to be a path or a Python file-like object"); + throw Py::TypeError("Object does not appear to be a 8-bit string path or a Python file-like object"); } Py_XDECREF(write_method); } @@ -2368,7 +2392,7 @@ */ } catch (...) { - if (fp) fclose(fp); + if (fp && close_file) fclose(fp); delete [] row_pointers; if (png_ptr && info_ptr) png_destroy_write_struct(&png_ptr, &info_ptr); throw; @@ -2376,7 +2400,7 @@ png_destroy_write_struct(&png_ptr, &info_ptr); delete [] row_pointers; - if (fp) fclose(fp); + if (fp && close_file) fclose(fp); return Py::Object(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5022 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5022&view=rev Author: mdboom Date: 2008年03月26日 07:33:35 -0700 (2008年3月26日) Log Message: ----------- Change character ids so they are a hash on the path data itself. (To fix Kaushik Ghose's copy-and-paste in Inkscape bug). Modified Paths: -------------- branches/v0_91_maint/CHANGELOG Modified: branches/v0_91_maint/CHANGELOG =================================================================== --- branches/v0_91_maint/CHANGELOG 2008年03月26日 14:30:18 UTC (rev 5021) +++ branches/v0_91_maint/CHANGELOG 2008年03月26日 14:33:35 UTC (rev 5022) @@ -1,3 +1,6 @@ +2008年03月26日 Fix SVG backend bug that prevents copying and pasting in + Inkscape (thanks Kaushik Ghose) - MGD + 2008年03月23日 Fix a pdf backend bug which sometimes caused the outermost gsave to not be balanced with a grestore. - JKS This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5024 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5024&view=rev Author: mdboom Date: 2008年03月26日 07:43:20 -0700 (2008年3月26日) Log Message: ----------- Merged revisions 5012-5017,5019-5023 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_91_maint ........ r5013 | mmetz_bn | 2008年03月21日 13:19:37 -0400 (2008年3月21日) | 1 line Bugfix in ContourSet._process_linestyles ........ r5021 | mdboom | 2008年03月26日 10:30:18 -0400 (2008年3月26日) | 3 lines Change character ids so they are a hash on the path data itself. (To fix Kaushik Ghose's copy-and-paste in Inkscape bug). ........ r5022 | mdboom | 2008年03月26日 10:33:35 -0400 (2008年3月26日) | 3 lines Change character ids so they are a hash on the path data itself. (To fix Kaushik Ghose's copy-and-paste in Inkscape bug). ........ r5023 | mdboom | 2008年03月26日 10:35:50 -0400 (2008年3月26日) | 2 lines Oops in last commit. ........ Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/backends/backend_svg.py Property Changed: ---------------- trunk/matplotlib/ Property changes on: trunk/matplotlib ___________________________________________________________________ Name: svnmerge-integrated - /branches/v0_91_maint:1-5011,5018 + /branches/v0_91_maint:1-5023 Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008年03月26日 14:35:50 UTC (rev 5023) +++ trunk/matplotlib/CHANGELOG 2008年03月26日 14:43:20 UTC (rev 5024) @@ -1,3 +1,6 @@ +2008年03月26日 Fix SVG backend bug that prevents copying and pasting in + Inkscape (thanks Kaushik Ghose) - MGD + 2008年03月24日 Removed an unnecessary call to draw() in the backend_qt* mouseReleaseEvent. Thanks to Ted Drain - DSD Modified: trunk/matplotlib/lib/matplotlib/backends/backend_svg.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_svg.py 2008年03月26日 14:35:50 UTC (rev 5023) +++ trunk/matplotlib/lib/matplotlib/backends/backend_svg.py 2008年03月26日 14:43:20 UTC (rev 5024) @@ -1,6 +1,6 @@ from __future__ import division -import os, codecs, base64, tempfile, urllib, gzip +import os, codecs, base64, tempfile, urllib, gzip, md5 from matplotlib import verbose, __version__, rcParams from matplotlib.backend_bases import RendererBase, GraphicsContextBase,\ @@ -125,7 +125,7 @@ id = self._clipd.get(path) if id is None: - id = 'p%x' % len(self._clipd) + id = 'p%s' % md5.new(path).hexdigest() self._svgwriter.write('<defs>\n <clipPath id="%s">\n' % id) self._svgwriter.write(path) self._svgwriter.write('\n </clipPath>\n</defs>') @@ -189,7 +189,7 @@ key = self._convert_path(marker_path, marker_trans + Affine2D().scale(1.0, -1.0)) name = self._markers.get(key) if name is None: - name = 'm%x' % len(self._markers) + name = 'm%s' % md5.new(key).hexdigest() write('<defs><path id="%s" d="%s"/></defs>\n' % (name, key)) self._markers[key] = name @@ -209,9 +209,10 @@ write('<defs>\n') for i, (path, transform) in enumerate(self._iter_collection_raw_paths( master_transform, paths, all_transforms)): - name = 'coll%x_%x' % (self._path_collection_id, i) transform = Affine2D(transform.get_matrix()).scale(1.0, -1.0) d = self._convert_path(path, transform) + name = 'coll%x_%x_%s' % (self._path_collection_id, i, + md5.new(d).hexdigest()) write('<path id="%s" d="%s"/>\n' % (name, d)) path_codes.append(name) write('</defs>\n') @@ -398,8 +399,9 @@ if step[0] != 4: currx, curry = step[-2], -step[-1] - char_num = 'c%x' % len(self._char_defs) - path_element = '<path id="%s" d="%s"/>\n' % (char_num, ''.join(path_data)) + path_data = ''.join(path_data) + char_num = 'c_%s' % md5.new(path_data).hexdigest() + path_element = '<symbol id="%s"><path d="%s"/></symbol>\n' % (char_num, ''.join(path_data)) self._char_defs[char_id] = char_num return path_element This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5023 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5023&view=rev Author: mdboom Date: 2008年03月26日 07:35:50 -0700 (2008年3月26日) Log Message: ----------- Oops in last commit. Modified Paths: -------------- branches/v0_91_maint/lib/matplotlib/backends/backend_svg.py Modified: branches/v0_91_maint/lib/matplotlib/backends/backend_svg.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/backends/backend_svg.py 2008年03月26日 14:33:35 UTC (rev 5022) +++ branches/v0_91_maint/lib/matplotlib/backends/backend_svg.py 2008年03月26日 14:35:50 UTC (rev 5023) @@ -389,7 +389,7 @@ if step[0] != 4: currx, curry = step[-2], -step[-1] path_data = ''.join(path_data) - char_num = 'c_%x' % len(self._char_defs) # md5.new(path_data).hexdigest() + char_num = 'c_%s' % md5.new(path_data).hexdigest() path_element = '<symbol id="%s"><path d="%s"/></symbol>\n' % (char_num, ''.join(path_data)) self._char_defs[char_id] = char_num return path_element This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5021 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5021&view=rev Author: mdboom Date: 2008年03月26日 07:30:18 -0700 (2008年3月26日) Log Message: ----------- Change character ids so they are a hash on the path data itself. (To fix Kaushik Ghose's copy-and-paste in Inkscape bug). Modified Paths: -------------- branches/v0_91_maint/lib/matplotlib/backends/backend_svg.py Modified: branches/v0_91_maint/lib/matplotlib/backends/backend_svg.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/backends/backend_svg.py 2008年03月24日 12:58:47 UTC (rev 5020) +++ branches/v0_91_maint/lib/matplotlib/backends/backend_svg.py 2008年03月26日 14:30:18 UTC (rev 5021) @@ -1,6 +1,6 @@ from __future__ import division -import os, codecs, base64, tempfile, urllib, gzip +import os, codecs, base64, tempfile, urllib, gzip, md5 from matplotlib import agg from matplotlib import verbose, __version__, rcParams @@ -388,8 +388,9 @@ if step[0] != 4: currx, curry = step[-2], -step[-1] - char_num = 'c_%x' % len(self._char_defs) - path_element = '<path id="%s" d="%s"/>\n' % (char_num, ''.join(path_data)) + path_data = ''.join(path_data) + char_num = 'c_%x' % len(self._char_defs) # md5.new(path_data).hexdigest() + path_element = '<symbol id="%s"><path d="%s"/></symbol>\n' % (char_num, ''.join(path_data)) self._char_defs[char_id] = char_num return path_element This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5020 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5020&view=rev Author: dsdale Date: 2008年03月24日 05:58:47 -0700 (2008年3月24日) Log Message: ----------- removed an unnecessary call to draw in the qt backends mouseReleaseEvent Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/backends/backend_qt.py trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008年03月23日 17:47:51 UTC (rev 5019) +++ trunk/matplotlib/CHANGELOG 2008年03月24日 12:58:47 UTC (rev 5020) @@ -1,3 +1,6 @@ +2008年03月24日 Removed an unnecessary call to draw() in the backend_qt* + mouseReleaseEvent. Thanks to Ted Drain - DSD + 2008年03月23日 Fix a pdf backend bug which sometimes caused the outermost gsave to not be balanced with a grestore. - JKS Modified: trunk/matplotlib/lib/matplotlib/backends/backend_qt.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_qt.py 2008年03月23日 17:47:51 UTC (rev 5019) +++ trunk/matplotlib/lib/matplotlib/backends/backend_qt.py 2008年03月24日 12:58:47 UTC (rev 5020) @@ -121,7 +121,6 @@ button = self.buttond[event.button()] FigureCanvasBase.button_release_event( self, x, y, button ) if DEBUG: print 'button released' - self.draw() def keyPressEvent( self, event ): key = self._get_key( event ) Modified: trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py 2008年03月23日 17:47:51 UTC (rev 5019) +++ trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py 2008年03月24日 12:58:47 UTC (rev 5020) @@ -120,7 +120,6 @@ button = self.buttond[event.button()] FigureCanvasBase.button_release_event( self, x, y, button ) if DEBUG: print 'button released' - self.draw() def keyPressEvent( self, event ): key = self._get_key( event ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5019 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5019&view=rev Author: jouni Date: 2008年03月23日 10:47:51 -0700 (2008年3月23日) Log Message: ----------- Merged revisions 5018 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_91_maint ........ r5018 | jouni | 2008年03月23日 19:44:11 +0200 (2008年3月23日) | 3 lines Fix a pdf backend bug which sometimes caused the outermost gsave to not be balanced with a grestore. ........ Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py Property Changed: ---------------- trunk/matplotlib/ Property changes on: trunk/matplotlib ___________________________________________________________________ Name: svnmerge-integrated - /branches/v0_91_maint:1-5011 + /branches/v0_91_maint:1-5011,5018 Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008年03月23日 17:44:11 UTC (rev 5018) +++ trunk/matplotlib/CHANGELOG 2008年03月23日 17:47:51 UTC (rev 5019) @@ -1,3 +1,6 @@ +2008年03月23日 Fix a pdf backend bug which sometimes caused the outermost + gsave to not be balanced with a grestore. - JKS + 2008年03月20日 Fixed a minor bug in ContourSet._process_linestyles when len(linestyles)==Nlev - MM Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2008年03月23日 17:44:11 UTC (rev 5018) +++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2008年03月23日 17:47:51 UTC (rev 5019) @@ -1174,7 +1174,7 @@ self.tex_font_map = None def finalize(self): - self.gc.finalize() + self.file.output(*self.gc.finalize()) def check_gc(self, gc, fillcolor=None): orig_fill = gc._fillcolor This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5018 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5018&view=rev Author: jouni Date: 2008年03月23日 10:44:11 -0700 (2008年3月23日) Log Message: ----------- Fix a pdf backend bug which sometimes caused the outermost gsave to not be balanced with a grestore. Modified Paths: -------------- branches/v0_91_maint/CHANGELOG branches/v0_91_maint/lib/matplotlib/backends/backend_pdf.py Modified: branches/v0_91_maint/CHANGELOG =================================================================== --- branches/v0_91_maint/CHANGELOG 2008年03月21日 19:52:46 UTC (rev 5017) +++ branches/v0_91_maint/CHANGELOG 2008年03月23日 17:44:11 UTC (rev 5018) @@ -1,3 +1,6 @@ +2008年03月23日 Fix a pdf backend bug which sometimes caused the outermost + gsave to not be balanced with a grestore. - JKS + 2008年02月29日 Fix class Wx toolbar pan and zoom functions (Thanks Jeff Peery) - MGD Modified: branches/v0_91_maint/lib/matplotlib/backends/backend_pdf.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/backends/backend_pdf.py 2008年03月21日 19:52:46 UTC (rev 5017) +++ branches/v0_91_maint/lib/matplotlib/backends/backend_pdf.py 2008年03月23日 17:44:11 UTC (rev 5018) @@ -1159,7 +1159,7 @@ self.tex_font_map = None def finalize(self): - self.gc.finalize() + self.file.output(*self.gc.finalize()) def check_gc(self, gc, fillcolor=None): orig_fill = gc._fillcolor This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5017 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5017&view=rev Author: jdh2358 Date: 2008年03月21日 12:52:46 -0700 (2008年3月21日) Log Message: ----------- committed mark hammiltons cutils fix Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/config/cutils.py Modified: trunk/matplotlib/lib/matplotlib/config/cutils.py =================================================================== --- trunk/matplotlib/lib/matplotlib/config/cutils.py 2008年03月21日 17:57:47 UTC (rev 5016) +++ trunk/matplotlib/lib/matplotlib/config/cutils.py 2008年03月21日 19:52:46 UTC (rev 5017) @@ -79,7 +79,7 @@ raise RuntimeError("""\ '%s' is not a writable dir; you must set %s/.matplotlib to be a writable dir. You can also set environment variable MPLCONFIGDIR to any writable directory -where you want matplotlib data stored """%h) +where you want matplotlib data stored """%(p,h)) else: if not is_writable_dir(h): raise RuntimeError("Failed to create %s/.matplotlib; consider setting MPLCONFIGDIR to a writable directory for matplotlib configuration data"%h) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5016 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5016&view=rev Author: jdh2358 Date: 2008年03月21日 10:57:47 -0700 (2008年3月21日) Log Message: ----------- more cleanup Modified Paths: -------------- trunk/matplotlib/doc/make.py Modified: trunk/matplotlib/doc/make.py =================================================================== --- trunk/matplotlib/doc/make.py 2008年03月21日 17:54:20 UTC (rev 5015) +++ trunk/matplotlib/doc/make.py 2008年03月21日 17:57:47 UTC (rev 5016) @@ -34,7 +34,7 @@ os.system('pdflatex event_handling_tut.tex') def clean(): - patterns = ['#*', '*~', '*.tex', '*.log', '*.out', '*.aux'] + patterns = ['#*', '*~', '*.tex', '*.log', '*.out', '*.aux', '*.pdf'] for pattern in patterns: for fname in glob.glob(pattern): os.remove(fname) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5015 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5015&view=rev Author: jdh2358 Date: 2008年03月21日 10:54:20 -0700 (2008年3月21日) Log Message: ----------- added fig_x Modified Paths: -------------- trunk/matplotlib/doc/figures/make.py Added Paths: ----------- trunk/matplotlib/doc/figures/fig_x.py Added: trunk/matplotlib/doc/figures/fig_x.py =================================================================== --- trunk/matplotlib/doc/figures/fig_x.py (rev 0) +++ trunk/matplotlib/doc/figures/fig_x.py 2008年03月21日 17:54:20 UTC (rev 5015) @@ -0,0 +1,13 @@ +import numpy as np +import matplotlib.pyplot as plt +import matplotlib.lines as lines +fig = plt.figure() + +l1 = lines.Line2D([0, 1], [0, 1], transform=fig.transFigure, figure=fig) + +l2 = lines.Line2D([0, 1], [1, 0], transform=fig.transFigure, figure=fig) + +fig.lines.extend([l1, l2]) + +fig.savefig('fig_x') +plt.show() Modified: trunk/matplotlib/doc/figures/make.py =================================================================== --- trunk/matplotlib/doc/figures/make.py 2008年03月21日 17:51:06 UTC (rev 5014) +++ trunk/matplotlib/doc/figures/make.py 2008年03月21日 17:54:20 UTC (rev 5015) @@ -8,6 +8,7 @@ import dollar_ticks import fig_axes_customize_simple import fig_axes_labels_simple + import fig_x print 'all figures made' for fname in glob.glob('*.pyc'): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5014 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5014&view=rev Author: jdh2358 Date: 2008年03月21日 10:51:06 -0700 (2008年3月21日) Log Message: ----------- added api and event tutorials Added Paths: ----------- trunk/matplotlib/doc/artist_api_tut.txt trunk/matplotlib/doc/event_handling_tut.txt trunk/matplotlib/doc/figures/ trunk/matplotlib/doc/figures/dollar_ticks.py trunk/matplotlib/doc/figures/fig_axes_customize_simple.py trunk/matplotlib/doc/figures/fig_axes_labels_simple.py trunk/matplotlib/doc/figures/make.py trunk/matplotlib/doc/make.py Added: trunk/matplotlib/doc/artist_api_tut.txt =================================================================== --- trunk/matplotlib/doc/artist_api_tut.txt (rev 0) +++ trunk/matplotlib/doc/artist_api_tut.txt 2008年03月21日 17:51:06 UTC (rev 5014) @@ -0,0 +1,597 @@ +The matplotlib Artist API tutorial +================================== + +There are three layers to the matplotlib API. The FigureCanvas is the +area onto which the figure is drawn, the Renderer is the object which +knows how to draw on the FigureCanvas, and the Artist is the object +that knows how to use a renderer to paint onto the canvas. The +FigureCanvas and Renderer handle all the details of talking to user +interface toolkits like wxpython or drawing languages like postscript, +and the Artist handles all the high level constructs like +representing and laying out the figure, text, and lines. The typical +user will spend 95% of his time working with the Artists. + +There are two types Artists: primitives and containers. The +primitives represent the standard graphical objects we want to paint +onto our canvas: Line2D, Rectangle, Text, AxesImage, etc, and the +containers are places to put them (Axis, Axes and Figure). The +standard use is to create a Figure instance, use the Figure to create +one or more Axes or Subplot instances, and use the Axes instance +helper methods to create the primitives. In the example below, we +create a Figure instance using pyplot.figure, which is a convenience +method for instantiating Figure instances and connecting them with +your user interface or drawing toolkit FigureCanvas. As we will +discuss below, this is not necessary, and you can work directly with +postscript, pdf gtk, or wxpython FigureCanvas es, instantiate your +Figures directly and connect them yourselves, but since we are +focusing here on the Artist API we'll let pyplot handle some of those +details for us:: + + import matplotlib.pyplot as plt + fig = plt.figure() + ax = fig.add_subplot(2,1,1) # two rows, one column, first plot + +The Axes is probably the most important class in the matplotlib API, +and the one you will be working with most of the time. This is +because the Axes is the plotting area into which most of the objects +go, and the Axes has many special helper methods (ax.plot, ax.text, +ax.hist, ax.imshow) to create the most common graphics primitives +(Line2D, Text, Rectangle, Image, respectively). These helper methods +will take your data (eg numpy arrays and strings) create primitive +Artist instances as needed (eg Line2D), add them to the relevant +containers, and draw them when requested. Most of you are probably +familiar with the Subplot, which is just a special case of an Axes +that lives on a regular rows by columns grid of Subplot instances. If +you want to create an Axes at an arbitrary location, simply use the +add_axes method which takes a list of [left, bottom, width, height] +values in 0-1 relative figure coordinates:: + + ax2 = fig.add_axes([0.15, 0.1, 0.7, 0.3]) + +Continuing with our example:: + + import numpy as np + t = np.arange(0.0, 1.0, 0.01) + s = np.sin(2*np.pi*t) + line, = ax1.plot(t, s, color='blue', lw=2) + +In this example, ax is the Axes instance created by the +fig.add_subplot call above (remember Subplot is just a subclass of +Axes) and when you call ax.plot, it creates a Line2D instance and adds +it the the Axes.lines list. In the interactive ipython session below, +you can see that Axes.lines list is length one and contains the same +line that was returned by the "line, ax.plot(x, y, 'o')" call:: + + In [101]: ax.lines[0] + Out[101]: <matplotlib.lines.Line2D instance at 0x19a95710> + + In [102]: line + Out[102]: <matplotlib.lines.Line2D instance at 0x19a95710> + +If you make subsequent calls to ax.plot (and the hold state is "on" +which is the default) then additional lines will be added to the list. +You can remove lines later simply by calling the list methods; either +of these will work:: + + del ax.lines[0] + ax.lines.remove(line) # one or the other, not both! + +The Axes also has helper methods to configure and decorate the xaxis +and yaxis tick, ticklabels and axis labels:: + + xtext = ax.set_xlabel('my xdata') # returns a Text instance + ytext = ax.set_ylabel('my xdata') + +When you call ax.set_xlabel, it passes the information on the Text +instance of the XAxis. Each Axes instance contains an xaxis and a +yaxis instance, which handle the layout and drawing of the ticks, tick +labels and axis labels. + +Here are the most important matplotlib modules that contain the +classes referenced above + +=============== ================== +Artist Module +=============== ================== +Artist matplotlib.artist +Rectangle matplotlib.patches +Line2D matplotlib.lines +Axes matplotlib.axes +XAxis and YAxis matplotlib.axis +Figure matplotlib.figure +Text matplotlib.text +=============== ================== + +Try creating the figure below + +.. image:: figures/fig_axes_labels_simple.png + :scale: 75 + +Customizing your objects +======================== + +Every element in the figure is represented by a matplotlib Artist, and +each has an extensive list of properties to configure its appearance. +The figure itself contains a Rectangle exactly the size of the figure, +which you can use to set the background color and transparency of the +figures. Likewise, each Axes bounding box (the standard white box +with black edges in the typical matplotlib plot, has a Rectangle +instance that determines the color, transparency, and other properties +of the Axes. These instances are stored as member variables +Figure.figurePatch and Axes.axesPatch ("Patch" is a name inherited +from Matlab, and is a 2D "patch" of color on the figure, eg +rectangles, circles and polygons). Every matplotlib Artist has the +following properties + +========== ====================================================================== +Property Description +========== ====================================================================== +alpha The transparency - a scalar from 0-1 +animated A boolean that is used to facilitate animated drawing +axes The axes that the Artist lives in, possibly None +clip_box The bounding box that clips the Artist +clip_on Whether clipping is enabled +clip_path The path the artist is clipped to +contains A picking function to test whether the artist contains the pick point +figure The figure instance the aritst lives in, possibly None +label A text label (eg for auto-labeling) +picker A python object that controls object picking +transform The transformation +visible A boolean whether the artist should be drawn +zorder A number which determines the drawing order +========== ====================================================================== + +Each of the properties is accessed with an old-fashioned setter or +getter (yes we know this irritates pythonistas and we plan to support +direct access via properties or traits but it hasn't been done yet). +For example, to multiply the current alpha by a half:: + + a = o.get_alpha() + o.set_alpha(0.5*a) + +If you want to set a number of properties at once, you can also use +the "set" method with keyword arguments. For example:: + + o.set(alpha=0.5, zorder=2) + +If you are working interactively at the python shell, a handy way to +inspect the artist properties is to use the matplotlib.artist.getp +method, which lists the properties and their values (simply "getp") in +pylab. This works for classes derived from Artist as well, eg Figure +and Rectangle. Here are the Figure rectangle properties mentioned above:: + + + In [149]: matplotlib.artist.getp(fig.figurePatch) + alpha = 1.0 + animated = False + antialiased or aa = True + axes = None + clip_box = None + clip_on = False + clip_path = None + contains = None + edgecolor or ec = w + facecolor or fc = 0.75 + figure = Figure(8.125x6.125) + fill = 1 + hatch = None + height = 1 + label = + linewidth or lw = 1.0 + picker = None + transform = <Affine object at 0x134cca84> + verts = ((0, 0), (0, 1), (1, 1), (1, 0)) + visible = True + width = 1 + window_extent = <Bbox object at 0x134acbcc> + x = 0 + y = 0 + zorder = 1 + +The docstrings for all of the classes also contain the artist +properties, so you can consult the interactive "help", the online html +docs at http://matplotlib.sourceforge.net/classdocs.html or PDF documentation +at http://matplotlib.sourceforge.net/api.pdf for a listing of +properties for a give object. + +Getting at the objects to customize them +======================================== + +Now that we know how to inspect set the properties of a given +object we want to configure, we need to now how to get at that +object. As mentioned in the introduction, there are two kinds of +objects: primitives and containers. The primitives are usually the +things you want to configure (the font of a Text instance, the width +of a Line2D) although the containers also have some properties as +well -- for example the Axes Artist is a container that contains many +of the primitives in your plot, but it also has properties like the +xscale to control whether the xaxis is 'linear' or 'log'. In this +section we'll review where the various container objects store the +Artists that you want to get at. + +The Figure container +-------------------- + +The top level container Artist is the matplotlib.figure.Figure, and it +contains everything in the figure. The background of the figure is a +Rectangle which is stored in fig.figurePatch (where fig is your Figure +instance). As you add subplots (fig.add_subplot) and axes +(ax.add_axes)to the figure these will be appended to the fig.axes +list. These are also returned by the methods that create them:: + + In [156]: fig = plt.figure() + + In [157]: ax1 = fig.add_subplot(211) + + In [158]: ax2 = fig.add_axes([0.1, 0.1, 0.7, 0.3]) + + In [159]: ax1 + Out[159]: <matplotlib.axes.Subplot instance at 0xd54b26c> + + In [160]: print fig.axes + [<matplotlib.axes.Subplot instance at 0xd54b26c>, <matplotlib.axes.Axes instance at 0xd3f0b2c>] + + +Because the figure maintains the concept of the "current axes" (see +Figure.gca and Figure.sca) to support the pylab/pyplot state machine, +you should not insert or remove axes directly from the axes list, but +rather use the Figure.add_axes and Figure.add_subplot method to +insert, and the Figure.delaxes methods to delete. You are free +however, to iterate over the list of axes or index into it to get +access to Axes instances you want to customize. Here is an example +which turns all the axes grids on:: + + for ax in fig.axes: + ax.grid(True) + + +The figure also has its own text, lines, patches and images, which you +can use to add primitives directly. The default coordinate system for +the Figure will simply be in pixels (which is not usually what you +want) but you can control this by setting the transform property of +the Artist you are adding to the figure. More useful is "figure +coordinates" where 0,0 is the bottom, left of the figure and 1,1 is +the top, right of the figure which you can obtain by setting the +Artist transform to fig.transFigure:: + + In [191]: fig = plt.figure() + + In [192]: l1 = matplotlib.lines.Line2D([0, 1], [0, 1], transform=fig.transFigure, figure=fig) + + In [193]: l2 = matplotlib.lines.Line2D([0, 1], [1, 0], transform=fig.transFigure, figure=fig) + + In [194]: fig.lines.extend([l1, l2]) + + In [195]: fig.canvas.draw() + +.. image:: figures/fig_x.png + :scale: 75 + + +Here is a summary of the Artists the figure contains + +================ =============================================================== +Figure attribute Description +================ =============================================================== +axes A list of Axes instances (includes Subplot) +figurePatch The Rectangle background +images A list of FigureImages patches - useful for raw pixel display +legends A list of Figure Legend instances (different from Axes.legends) +lines A list of Figure Line2D instances (rarely used, see Axes.lines) +patches A list of Figure patches (rarely used, see Axes.patches) +texts A list Figure Text instances +================ =============================================================== + + +The Axes container +------------------ + +The matplotlib.axes.Axes is the center of the matplotlib universe -- +it contains the vast majority of all the Artists used in a figure with +many helper methods to create and these Artists to itself, as well as +helper methods to access and customize the Artists it contains. Like +the Figure, it contains a Patch ax.axesPatch which is Rectangle for +Cartesian coordinates and a Circle for polar coordinates; this patch +determines the shape, background and border of the plotting region:: + + ax = fig.add_subplot(111) + rect = ax.axesPatch # a Rectangle instance + rect.set_facecolor('green') + +When you call a plotting method, eg the canonical "ax.plot" and pass +in arrays or list of values, the method will a matplotlib.lines.Line2D +instance, update the line with all the Line2D properties passed as +keyword arguments, add the line to the Axes.lines container, and +returns it to you:: + + In [213]: x, y = np.random.rand(2, 100) + + In [214]: line, = ax.plot(x, y, '-', color='blue', linewidth=2) + +ax.plot returns a list of lines because you can pass in multiple x, y +pairs to plot, and we are unpacking the first element of the length +one list into the line variable. The line has been added to the +ax.lines list:: + + + In [229]: print ax.lines + [<matplotlib.lines.Line2D instance at 0xd378b0c>] + +Similarly, methods that create patches, like ax.bar creates a list of +rectangles, will add the patches to the ax.patches list:: + + In [233]: n, bins, rectangles = ax.hist(np.random.randn(1000), 50, facecolor='yellow') + + In [234]: rectangles + Out[234]: <a list of 50 Patch objects> + + In [235]: print len(ax.patches) + +You should not add objects directly to the ax.lines or ax.patches +unless you know exactly what you are doing, because the Axes needs to +do a few things when it creates and adds an object. It sets the figure +and axes property of the Artist, as well as the default Axes +transformation (unless a transformation is set). It also inspects the +data contained in the Artist to update the data structures controlling +auto-scaling, so that the view limits can be adjusted to contain the +plotted data. You can, nonetheless, create objects yourself and add +them directly to the Axes using helper methods like ax.add_line and +ax.add_patch. Here is an annotated interactive session illustrating +what is going on:: + + In [261]: fig = plt.figure() + + In [262]: ax = fig.add_subplot(111) + + # create a rectangle instance + In [263]: rect = matplotlib.patches.Rectangle( (1,1), width=5, height=12) + + # by default the axes instance is None + In [264]: print rect.get_axes() + None + + # and the transformation instance is set to the "identity transform" + In [265]: print rect.get_transform() + <Affine object at 0x13695544> + + # now we add the Rectangle to the Axes + In [266]: ax.add_patch(rect) + + # and notice that the ax.add_patch method has set the axes + # instance + In [267]: print rect.get_axes() + Subplot(49,81.25) + + # and the transformation has been set too + In [268]: print rect.get_transform() + <Affine object at 0x15009ca4> + + # the default axes transformation is ax.transData + In [269]: print ax.transData + <Affine object at 0x15009ca4> + + # notice that the xlimits of the Axes have not been changed + In [270]: print ax.get_xlim() + (0.0, 1.0) + + # but the data limits have been updated to encompass the rectangle + In [271]: print ax.dataLim.get_bounds() + (1.0, 1.0, 5.0, 12.0) + + # we can manually invoke the auto-scaling machinery + In [272]: ax.autoscale_view() + + # and now the xlim are updated to encompass the rectangle + In [273]: print ax.get_xlim() + (1.0, 6.0) + + # we have to manually force a figure draw + In [274]: ax.figure.canvas.draw() + + +There are many, many Axes helper methods for creating primitive +Artists and adding them to their respective containers. The table +below summarizes a small sampling of them, the kinds of Artist they +create, and where they store them + +============================== ==================== ======================= +Helper method Artist Container +============================== ==================== ======================= +ax.annotate - text annotations Annotate ax.texts +ax.bar - bar charts Rectangle ax.patches +ax.errorbar - error bar plots Line2D and Rectangle ax.lines and ax.patches +ax.fill - shared area Polygon ax.patches +ax.hist - histograms Rectangle ax.patches +ax.imshow - image data AxesImage ax.images +ax.legend - axes legends Legend ax.legends +ax.plot - xy plots Line2D ax.lines +ax.scatter - scatter charts PolygonCollection ax.collections +ax.text - text Text ax.texts +============================== ==================== ======================= + + +In addition to all of these Artists, the Axes contains two important +Artist containers: the XAxis and YAxis, which handle the drawing of +the ticks and labels. These are stored as instance variables xaxis +and yaxis. The XAxis and YAxis containers will be detailed below, but +note that the Axes contains many helper methods which forward calls on +to the Axis instances so you often do not need to work with them +directly unless you want to. For example, you can set the fontsize of +the XAxis ticklabels using the Axes helper method:: + + for label in ax.get_xticklabels(): + label.set_color('orange') + +Below is a summary of the Artists that the Axes contains + +============== ====================================== +Axes attribute Description +============== ====================================== +artists A list of Artist instances +axesPatch Rectangle instance for Axes background +collections A list of Collection instances +images A list of AxesImage +legends A list of Legend instances +lines A list of Line2D instances +patches A list of Patch instances +texts A list of Text instances +xaxis matplotlib.axis.XAxis instance +yaxis matplotlib.axis.YAxis instance +============== ====================================== + +The Axis containers +------------------- + +The matplotlib.axis.Axis instances handle the drawing of the tick lines, the grid +lines, the tick labels and the axis label. You can configure the left +and right ticks separately for the y axis, and the upper and lower +ticks separately for the x axis. The axis also stores the data and view +intervals used in auto-scaling, panning and zooming, as well as the +locator and formatter instances which control where the ticks are +placed and how they are represented as strings. + +Each axis object contains a label attribute (this is what the pylab +calls to xlabel and ylabel set) as well as a list of major and minor +ticks. The ticks are XTick and YTick instances, which contain the +actual line and text primitives that render the ticks and ticklabels. +Because the ticks are dynamically created as needed (eg when panning +and zooming), you should access the lists of major and minor ticks +through their accessor methods axis.get_major_ticks() and +axis.get_minor_ticks(). Although the ticks contain all the primitives +and will be covered below, the Axis methods contain accessor methods +to return the tick lines, tick labels, tick locations etc....:: + + In [285]: axis = ax.xaxis + + In [286]: axis.get_ticklocs() + Out[286]: array([ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.]) + + In [287]: axis.get_ticklabels() + Out[287]: <a list of 10 Text major ticklabel objects> + + # note there are twice as many ticklines as labels because by + # default there are tick lines at the top and bottom but only tick + # labels below the xaxis; this can be customized + In [288]: axis.get_ticklines() + Out[288]: <a list of 20 Line2D ticklines objects> + + # by default you get the major ticks back + In [291]: axis.get_ticklines() + Out[291]: <a list of 20 Line2D ticklines objects> + + # but you can also ask for the minor ticks + In [292]: axis.get_ticklines(minor=True) + Out[292]: <a list of 0 Line2D ticklines objects> + +Here is a summary of some of the useful accessor methods of the Axis +(these have corresponding setters where useful, such as +set_major_formatter) + +====================== ========================================================= +Accessor method Description +====================== ========================================================= +get_scale The scale of the axis, eg 'log' or 'linear' +get_view_interval The interval instance of the axis view limits +get_data_interval The interval instance of the axis data limits +get_gridlines A list of grid lines for the Axis +get_label The axis label - a Text instance +get_ticklabels A list of Text instances - keyword minor=True|False +get_ticklines A list of Line2D instances - keyword minor=True|False +get_ticklocs A list of Tick locations - keyword minor=True|False +get_major_locator The matplotlib.ticker.Locator instance for major ticks +get_major_formatter The matplotlib.ticker.Formatter instance for major ticks +get_minor_locator The matplotlib.ticker.Locator instance for minor ticks +get_minor_formatter The matplotlib.ticker.Formatter instance for minor ticks +get_major_ticks A list of Tick instances for major ticks +get_minor_ticks A list of Tick instances for minor ticks +grid Turn the grid on or off for the major or minor ticks +====================== ========================================================= + +Try creating the figure below + +.. image:: figures/fig_axes_customize_simple.png + :scale: 75 + +Exercise solution:: + + import numpy as np + import matplotlib.pyplot as plt + + # plt.figure creates a matplotlib.figure.Figure instance + fig = plt.figure() + rect = fig.figurePatch # a rectangle instance + rect.set_facecolor('lightgoldenrodyellow') + + ax1 = fig.add_axes([0.1, 0.3, 0.4, 0.4]) + rect = ax1.axesPatch + rect.set_facecolor('lightslategray') + + + for label in ax1.xaxis.get_ticklabels(): + # label is a Text instance + label.set_color('red') + label.set_rotation(45) + label.set_fontsize(16) + + for line in ax1.yaxis.get_ticklines(): + # line is a Line2D instance + line.set_color('green') + line.set_markersize(25) + line.set_markeredgewidth(3) + + fig.savefig('figures/fig_axes_customize_simple.png', dpi=150) + fig.savefig('figures/fig_axes_customize_simple.eps') + plt.show() + + + +The Tick containers +------------------- + +The matplotlib.axis.Tick is the final container object in our descent +from the Figure to the Axes to the Axis to the Tick. The Tick +contains the tick and grid line instances, as well as the label +instances for the upper and lower ticks. Each of these is accessible +directly as an attribute of the Tick. In addition, there are boolean +variables that determine whether the upper labels and ticks are on for +the xaxis and whether the right labels and ticks are on for the yaxis. + +============== ========================================================== +Tick attribute Description +============== ========================================================== +tick1line Line2D instance +tick2line Line2D instance +gridline Line2D instance +label1 Text instance +label2 Text instance +gridOn boolean which determines whether to draw the tickline +tick1On boolean which determines whether to draw the 1st tickline +tick2On boolean which determines whether to draw the 2nd tickline +label1On boolean which determines whether to draw tick label +label2On boolean which determines whether to draw tick label +============== ========================================================== + +Here is an example which sets the formatter for the upper ticks with +dollar signs and colors them green on the right side of the yaxis:: + + import numpy as np + import matplotlib.pyplot as plt + import matplotlib.ticker as ticker + + fig = plt.figure() + ax = fig.add_subplot(111) + ax.plot(100*np.random.rand(20)) + + formatter = ticker.FormatStrFormatter('$%1.2f') + ax.yaxis.set_major_formatter(formatter) + + for tick in ax.yaxis.get_major_ticks(): + tick.label1On = False + tick.label2On = True + tick.label2.set_color('green') + + plt.show() + + +.. image:: figures/dollar_ticks.png + :scale: 75 Added: trunk/matplotlib/doc/event_handling_tut.txt =================================================================== --- trunk/matplotlib/doc/event_handling_tut.txt (rev 0) +++ trunk/matplotlib/doc/event_handling_tut.txt 2008年03月21日 17:51:06 UTC (rev 5014) @@ -0,0 +1,470 @@ +Event Handling and Picking Tutorial +=================================== + +matplotlib works with 5 user interface toolkits (wxpython, tkinter, +qt, gtk and fltk) and in order to support features like interactive +panning and zooming of figures, it is helpful to the developers to +have an API for interacting with the figure via key presses and mouse +movements that is "GUI neutral" so we don't have to repeat a lot of +code across the different user interfaces. Although the event +handling API is GUI neutral, it is based on the GTK model, which was +the first user interface matplotlib supported. The events that are +triggered are also a bit richer vis-a-vis matplotlib than standard GUI +events, including information like which Axes the event occurred in. +The events also understand the matplotlib coordinate system, and +report event locations in both pixel and data coordinates. + + +Event connections +================= + +To receive events, you need to write a callback function and then +connect your function to the event manager, which is part of the +FigureCanvas. Here is a simple example that prints the location of +the mouse click and which button was pressed:: + + fig = plt.figure() + ax = fig.add_subplot(111) + ax.plot(np.random.rand(10)) + + def onclick(event): + print 'button=%d, x=%d, y=%d, xdata=%f, ydata=%f'%( + event.button, event.x, event.y, event.xdata, event.ydata) + + cid = fig.canvas.mpl_connect('button_press_event', onclick) + +The FigureCanvas method mpl_connect returns a connection id which is +simply an integer. When you want to disconnect the callback, just +call:: + + fig.canvas.mpl_disconnect(cid) + +Here are the events that you can connect to, the class instances that +are sent back to you when the event occurs, and the event descriptions + + +===================== =========== =================================== +Event name Class Description +===================== =========== =================================== +button_press_event MouseEvent mouse button is pressed +button_release_event MouseEvent mouse button is released +draw_event DrawEvent canvas draw +key_press_event KeyEvent key is pressed +key_release_event KeyEvent key is released +motion_notify_event MouseEvent mouse motion +pick_event PickEvent an object in the canvas is selected +resize_event ResizeEvent figure canvas is resized +scroll_event MouseEvent mouse scroll wheel is rolled +===================== =========== =================================== + + +Event attributes +================ + +All matplotlib events inherit from the base class +matplotlib.backend_bases.Event, which store the attributes + +=============== ================================================= +Event attribute Description +=============== ================================================= +name the event name +canvas the FigureCanvas instance generating the event +guiEvent the GUI event that triggered the matplotlib event +=============== ================================================= + +The most common events that are the bread and butter of event handling +are key press/release events and mouse press/release and movement +events. The KeyEvent and MouseEvent classes that handle these events +are both derived from the LocationEvent, which has the following +attributes + +======================= ======================================== +LocationEvent attribute Description +======================= ======================================== +x x position - pixels from left of canvas +y y position - pixels from right of canvas +button button pressed None, 1, 2, 3 +inaxes the Axes instance if mouse us over axes +xdata x coord of mouse in data coords +ydata y coord of mouse in data coords +======================= ======================================== + +Let's look a simple example of a canvas, where a simple line segment +is created every time a mouse is pressed:: + + class LineBuilder: + def __init__(self, line): + self.line = line + self.xs = list(line.get_xdata()) + self.ys = list(line.get_ydata()) + self.cid = line.figure.canvas.mpl_connect('button_press_event', self) + + def __call__(self, event): + print 'click', event + if event.inaxes!=self.line.axes: return + self.xs.append(event.xdata) + self.ys.append(event.ydata) + self.line.set_data(self.xs, self.ys) + self.line.figure.canvas.draw() + + fig = plt.figure() + ax = fig.add_subplot(111) + ax.set_title('click to build line segments') + line, = ax.plot([0], [0]) # empty line + linebuilder = LineBuilder(line) + + + +The MouseEvent that we just used is a LocationEvent, so we have access +to the data and pixel coordinates in event.x and event.xdata. In +addition to the LocationEvent attributes, it has + +==================== ============================================================== +MouseEvent attribute Description +==================== ============================================================== +button button pressed None, 1, 2, 3 +key the key pressed: None, chr(range(255)), shift, win, or control +==================== ============================================================== + +Draggable Rectangle Exercise +---------------------------- + +Write draggable rectangle class that is initialized with a Rectangle +instance but will move its x,y location when dragged. Hint: you will +need to store the orginal xy location of the rectangle which is stored +as rect.xy and connect to the press, motion and release mouse events. +When the mouse is pressed, check to see if the click occurs over your +rectangle (see rect.contains) and if it does, store the rectangle xy +and the location of the mouse click in data coords. In the motion +event callback, compute the deltax and deltay of the mouse movement, +and add those deltas to the origin of the rectangle you stored. The +redraw the figure. On the button release event, just reset all the +button press data you stored as None. + +Here is the solution:: + + import numpy as np + import matplotlib.pyplot as plt + + class DraggableRectangle: + def __init__(self, rect): + self.rect = rect + self.press = None + + def connect(self): + 'connect to all the events we need' + self.cidpress = self.rect.figure.canvas.mpl_connect( + 'button_press_event', self.on_press) + self.cidrelease = self.rect.figure.canvas.mpl_connect( + 'button_release_event', self.on_release) + self.cidmotion = self.rect.figure.canvas.mpl_connect( + 'motion_notify_event', self.on_motion) + + def on_press(self, event): + 'on button press we will see if the mouse is over us and store some data' + if event.inaxes != self.rect.axes: return + + contains, attrd = self.rect.contains(event) + if not contains: return + print 'event contains', self.rect.xy + x0, y0 = self.rect.xy + self.press = x0, y0, event.xdata, event.ydata + + def on_motion(self, event): + 'on motion we will move the rect if the mouse is over us' + if self.press is None: return + if event.inaxes != self.rect.axes: return + x0, y0, xpress, ypress = self.press + dx = event.xdata - xpress + dy = event.ydata - ypress + #print 'x0=%f, xpress=%f, event.xdata=%f, dx=%f, x0+dx=%f'%(x0, xpress, event.xdata, dx, x0+dx) + self.rect.set_x(x0+dx) + self.rect.set_y(y0+dy) + + self.rect.figure.canvas.draw() + + + def on_release(self, event): + 'on release we reset the press data' + self.press = None + self.rect.figure.canvas.draw() + + def disconnect(self): + 'disconnect all the stored connection ids' + self.rect.figure.canvas.mpl_disconnect(self.cidpress) + self.rect.figure.canvas.mpl_disconnect(self.cidrelease) + self.rect.figure.canvas.mpl_disconnect(self.cidmotion) + + fig = plt.figure() + ax = fig.add_subplot(111) + rects = ax.bar(range(10), 20*np.random.rand(10)) + drs = [] + for rect in rects: + dr = DraggableRectangle(rect) + dr.connect() + drs.append(dr) + + plt.show() + + +**Extra credit**: use the animation blit techniques discussed at +http://www.scipy.org/Cookbook/Matplotlib/Animations to make the +animated drawing faster and smoother. + +Extra credit solution:: + + # draggable rectangle with the animation blit techniques; see + # http://www.scipy.org/Cookbook/Matplotlib/Animations + import numpy as np + import matplotlib.pyplot as plt + + class DraggableRectangle: + lock = None # only one can be animated at a time + def __init__(self, rect): + self.rect = rect + self.press = None + self.background = None + + def connect(self): + 'connect to all the events we need' + self.cidpress = self.rect.figure.canvas.mpl_connect( + 'button_press_event', self.on_press) + self.cidrelease = self.rect.figure.canvas.mpl_connect( + 'button_release_event', self.on_release) + self.cidmotion = self.rect.figure.canvas.mpl_connect( + 'motion_notify_event', self.on_motion) + + def on_press(self, event): + 'on button press we will see if the mouse is over us and store some data' + if event.inaxes != self.rect.axes: return + if DraggableRectangle.lock is not None: return + contains, attrd = self.rect.contains(event) + if not contains: return + print 'event contains', self.rect.xy + x0, y0 = self.rect.xy + self.press = x0, y0, event.xdata, event.ydata + DraggableRectangle.lock = self + + # draw everything but the selected rectangle and store the pixel buffer + canvas = self.rect.figure.canvas + axes = self.rect.axes + self.rect.set_animated(True) + canvas.draw() + self.background = canvas.copy_from_bbox(self.rect.axes.bbox) + + # now redraw just the rectangle + axes.draw_artist(self.rect) + + # and blit just the redrawn area + canvas.blit(axes.bbox) + + def on_motion(self, event): + 'on motion we will move the rect if the mouse is over us' + if DraggableRectangle.lock is not self: + return + if event.inaxes != self.rect.axes: return + x0, y0, xpress, ypress = self.press + dx = event.xdata - xpress + dy = event.ydata - ypress + self.rect.set_x(x0+dx) + self.rect.set_y(y0+dy) + + + canvas = self.rect.figure.canvas + axes = self.rect.axes + # restore the background region + canvas.restore_region(self.background) + + # redraw just the current rectangle + axes.draw_artist(self.rect) + + # blit just the redrawn area + canvas.blit(axes.bbox) + + + + def on_release(self, event): + 'on release we reset the press data' + if DraggableRectangle.lock is not self: + return + + self.press = None + DraggableRectangle.lock = None + + # turn off the rect animation property and reset the background + self.rect.set_animated(False) + self.background = None + + # redraw the full figure + self.rect.figure.canvas.draw() + def disconnect(self): + 'disconnect all the stored connection ids' + self.rect.figure.canvas.mpl_disconnect(self.cidpress) + self.rect.figure.canvas.mpl_disconnect(self.cidrelease) + self.rect.figure.canvas.mpl_disconnect(self.cidmotion) + + fig = plt.figure() + ax = fig.add_subplot(111) + rects = ax.bar(range(10), 20*np.random.rand(10)) + drs = [] + for rect in rects: + dr = DraggableRectangle(rect) + dr.connect() + drs.append(dr) + + plt.show() + + +Object Picking +============== + +You can enable picking by setting the ``picker`` property of an Artist +(eg a matplotlib Line2D, Text, Patch, Polygon, AxesImage, +etc...) + +There are a variety of meanings of the picker property: + +- None : picking is disabled for this artist (default) + +- boolean : if True then picking will be enabled and the artist will + fire a pick event if the mouse event is over the artist + +- float : if picker is a number it is interpreted as an epsilon + tolerance in points and the the artist will fire off an event if its + data is within epsilon of the mouse event. For some artists like + lines and patch collections, the artist may provide additional data + to the pick event that is generated, eg the indices of the data + within epsilon of the pick event. + +- function : if picker is callable, it is a user supplied function + which determines whether the artist is hit by the mouse event. The + signature is ``hit, props = picker(artist, mouseevent)`` to + determine the hit test. If the mouse event is over the artist, + return hit=True and props is a dictionary of properties you want + added to the PickEvent attributes + + +After you have enabled an artist for picking by setting the ``picker`` +property, you need to connect to the figure canvas pick_event to get +pick callbacks on mouse press events. Eg:: + + def pick_handler(event): + mouseevent = event.mouseevent + artist = event.artist + # now do something with this... + + +The pick event (matplotlib.backend_bases.PickEvent) which is passed to +your callback is always fired with two attributes: + +- mouseevent : the mouse event that generate the pick event. The + mouse event in turn has attributes like x and y (the coords in + display space, eg pixels from left, bottom) and xdata, ydata (the + coords in data space). Additionally, you can get information about + which buttons were pressed, which keys were pressed, which Axes the + mouse is over, etc. See matplotlib.backend_bases.MouseEvent for + details. + +- artist : the matplotlib.artist that generated the pick event. + +Additionally, certain artists like Line2D and PatchCollection may +attach additional meta data like the indices into the data that meet +the picker criteria (eg all the points in the line that are within the +specified epsilon tolerance) + +Simple picking example +---------------------- + +In the example below, we set the line picker property to a scalar, so +it represents a tolerance in points (72 points per inch). The onpick +callback function will be called when the pick event it within the +tolerance distance from the line, and has the indices of the data +vertices that are within the pick distance tolerance. Our onpick +callback function simply prints the data that are under the pick +location. Different matplotlib Artists can attach different data to +the PickEvent. For example, Line2D attaches the ind property, which +are the indices into the line data under the pick point. See +Line2D.pick for details on the PickEvent properties of the line. Here +is the code:: + + import numpy as np + import matplotlib.pyplot as plt + + fig = plt.figure() + ax = fig.add_subplot(111) + ax.set_title('click on points') + + line, = ax.plot(np.random.rand(100), 'o', picker=5) # 5 points tolerance + + def onpick(event): + thisline = event.artist + xdata = thisline.get_xdata() + ydata = thisline.get_ydata() + ind = event.ind + print 'onpick points:', zip(xdata[ind], ydata[ind]) + + fig.canvas.mpl_connect('pick_event', onpick) + + plt.show() + + +Picking Exercise +---------------- + +Create a data set of 100 arrays of 1000 Gaussian random numbers and +compute the sample mean and standard deviation of each of them (hint: +numpy arrays have a mean and std method) and make a xy marker plot of +the 100 means vs the 100 standard deviations. Connect the line +created by the plot command to the pick event, and plot the original +time series of the data that generated the clicked on points. If more +than one point is within the tolerance of the clicked on point, you +can use multiple subplots to plot the multiple time series. + +Exercise solution:: + + """ + compute the mean and stddev of 100 data sets and plot mean vs stddev. + When you click on one of the mu, sigma points, plot the raw data from + the dataset that generated the mean and stddev + """ + import numpy as np + import matplotlib.pyplot as plt + + X = np.random.rand(100, 1000) + xs = np.mean(X, axis=1) + ys = np.std(X, axis=1) + + fig = plt.figure() + ax = fig.add_subplot(111) + ax.set_title('click on point to plot time series') + line, = ax.plot(xs, ys, 'o', picker=5) # 5 points tolerance + + + def onpick(event): + + if event.artist!=line: return True + + N = len(event.ind) + if not N: return True + + + figi = plt.figure() + for subplotnum, dataind in enumerate(event.ind): + ax = figi.add_subplot(N,1,subplotnum+1) + ax.plot(X[dataind]) + ax.text(0.05, 0.9, 'mu=%1.3f\nsigma=%1.3f'%(xs[dataind], ys[dataind]), + transform=ax.transAxes, va='top') + ax.set_ylim(-0.5, 1.5) + figi.show() + return True + + fig.canvas.mpl_connect('pick_event', onpick) + + plt.show() + + + + + + + Added: trunk/matplotlib/doc/figures/dollar_ticks.py =================================================================== --- trunk/matplotlib/doc/figures/dollar_ticks.py (rev 0) +++ trunk/matplotlib/doc/figures/dollar_ticks.py 2008年03月21日 17:51:06 UTC (rev 5014) @@ -0,0 +1,20 @@ +import numpy as np +import matplotlib.pyplot as plt +import matplotlib.ticker as ticker + +fig = plt.figure() +ax = fig.add_subplot(111) +ax.plot(100*np.random.rand(20)) + +formatter = ticker.FormatStrFormatter('$%1.2f') +ax.yaxis.set_major_formatter(formatter) + +for tick in ax.yaxis.get_major_ticks(): + tick.label1On = False + tick.label2On = True + tick.label2.set_color('green') + +fig.savefig('dollar_ticks') +plt.show() + + Added: trunk/matplotlib/doc/figures/fig_axes_customize_simple.py =================================================================== --- trunk/matplotlib/doc/figures/fig_axes_customize_simple.py (rev 0) +++ trunk/matplotlib/doc/figures/fig_axes_customize_simple.py 2008年03月21日 17:51:06 UTC (rev 5014) @@ -0,0 +1,29 @@ +import numpy as np +import matplotlib.pyplot as plt + +# plt.figure creates a matplotlib.figure.Figure instance +fig = plt.figure() +rect = fig.figurePatch # a rectangle instance +rect.set_facecolor('lightgoldenrodyellow') + +ax1 = fig.add_axes([0.1, 0.3, 0.4, 0.4]) +rect = ax1.axesPatch +rect.set_facecolor('lightslategray') + + +for label in ax1.xaxis.get_ticklabels(): + # label is a Text instance + label.set_color('red') + label.set_rotation(45) + label.set_fontsize(16) + +for line in ax1.yaxis.get_ticklines(): + # line is a Line2D instance + line.set_color('green') + line.set_markersize(25) + line.set_markeredgewidth(3) + + +fig.savefig('fig_axes_customize_simple') + +plt.show() Added: trunk/matplotlib/doc/figures/fig_axes_labels_simple.py =================================================================== --- trunk/matplotlib/doc/figures/fig_axes_labels_simple.py (rev 0) +++ trunk/matplotlib/doc/figures/fig_axes_labels_simple.py 2008年03月21日 17:51:06 UTC (rev 5014) @@ -0,0 +1,21 @@ +import numpy as np +import matplotlib.pyplot as plt + +fig = plt.figure() +fig.subplots_adjust(top=0.8) +ax1 = fig.add_subplot(211) +ax1.set_ylabel('volts') +ax1.set_title('a sine wave') + +t = np.arange(0.0, 1.0, 0.01) +s = np.sin(2*np.pi*t) +line, = ax1.plot(t, s, color='blue', lw=2) + +ax2 = fig.add_axes([0.15, 0.1, 0.7, 0.3]) +n, bins, patches = ax2.hist(np.random.randn(1000), 50, + facecolor='yellow', edgecolor='yellow') +ax2.set_xlabel('time (s)') + +fig.savefig('fig_axes_labels_simple') + +plt.show() Added: trunk/matplotlib/doc/figures/make.py =================================================================== --- trunk/matplotlib/doc/figures/make.py (rev 0) +++ trunk/matplotlib/doc/figures/make.py 2008年03月21日 17:51:06 UTC (rev 5014) @@ -0,0 +1,45 @@ +#!/usr/bin/env python +import sys, os, glob +import matplotlib +matplotlib.use('Agg') + +def figs(): + # each one of these will make a figure when imported + import dollar_ticks + import fig_axes_customize_simple + import fig_axes_labels_simple + + print 'all figures made' + for fname in glob.glob('*.pyc'): + os.remove(fname) + +def clean(): + patterns = ['#*', '*~', '*.png'] + for pattern in patterns: + for fname in glob.glob(pattern): + os.remove(fname) + print 'all clean' + + + +def all(): + figs() + +funcd = {'figs':figs, + 'clean':clean, + 'all':all, + } + +if len(sys.argv)>1: + for arg in sys.argv[1:]: + func = funcd.get(arg) + if func is None: + raise SystemExit('Do not know how to handle %s; valid args are'%( + arg, funcd.keys())) + func() +else: + all() + + + + Property changes on: trunk/matplotlib/doc/figures/make.py ___________________________________________________________________ Name: svn:executable + * Added: trunk/matplotlib/doc/make.py =================================================================== --- trunk/matplotlib/doc/make.py (rev 0) +++ trunk/matplotlib/doc/make.py 2008年03月21日 17:51:06 UTC (rev 5014) @@ -0,0 +1,71 @@ +#!/usr/bin/env python +import os, sys, glob + +def check_png(): + if not len(glob.glob('figures/*.png')): + raise SystemExit('No PNG files in figures dir; please run make.py in the figures directory first') + +def check_rst2latex(): + sin, sout = os.popen2('which rst2latex') + if not sout.read(): + raise SystemExit('Build requires rst2latex') + +def check_pdflatex(): + sin, sout = os.popen2('which pdflatex') + if not sout.read(): + raise SystemExit('Build requires pdflatex') + + + + +def artist_tut(): + check_png() + check_rst2latex() + check_pdflatex() + os.system('rst2latex artist_api_tut.txt > artist_api_tut.tex') + os.system('pdflatex artist_api_tut.tex') + + +def event_tut(): + check_png() + check_rst2latex() + check_pdflatex() + os.system('rst2latex event_handling_tut.txt > event_handling_tut.tex') + os.system('pdflatex event_handling_tut.tex') + +def clean(): + patterns = ['#*', '*~', '*.tex', '*.log', '*.out', '*.aux'] + for pattern in patterns: + for fname in glob.glob(pattern): + os.remove(fname) + print 'all clean' + +def all(): + artist_tut() + event_tut() + +funcd = {'artist_tut': artist_tut, + 'event_tut': event_tut, + 'clean': clean, + 'all': all, + } + +if len(sys.argv)>1: + for arg in sys.argv[1:]: + func = funcd.get(arg) + if func is None: + raise SystemExit('Do not know how to handle %s; valid args are'%( + arg, funcd.keys())) + func() +else: + all() + + + + + + + + + + Property changes on: trunk/matplotlib/doc/make.py ___________________________________________________________________ Name: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5013 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5013&view=rev Author: mmetz_bn Date: 2008年03月21日 10:19:37 -0700 (2008年3月21日) Log Message: ----------- Bugfix in ContourSet._process_linestyles Modified Paths: -------------- branches/v0_91_maint/lib/matplotlib/contour.py Modified: branches/v0_91_maint/lib/matplotlib/contour.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/contour.py 2008年03月21日 13:26:27 UTC (rev 5012) +++ branches/v0_91_maint/lib/matplotlib/contour.py 2008年03月21日 17:19:37 UTC (rev 5013) @@ -708,7 +708,7 @@ else: if cbook.is_string_like(linestyles): tlinestyles = [linestyles] * Nlev - elif cbook.iterable(linestyles) and len(linestyles) < Nlev: + elif cbook.iterable(linestyles) and len(linestyles) <= Nlev: tlinestyles = list(linestyles) * int(npy.ceil(Nlev/len(linestyles))) return tlinestyles This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5012 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5012&view=rev Author: mdboom Date: 2008年03月21日 06:26:27 -0700 (2008年3月21日) Log Message: ----------- Merged revisions 4999-5011 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_91_maint ........ r5011 | mdboom | 2008年03月21日 09:10:20 -0400 (2008年3月21日) | 3 lines Bugfix: [ 1912719 ] TypeError in Exception __get_configdir() Thanks, Andrea Tomasini ........ Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/__init__.py Property Changed: ---------------- trunk/matplotlib/ Property changes on: trunk/matplotlib ___________________________________________________________________ Name: svnmerge-integrated - /branches/v0_91_maint:1-4998 + /branches/v0_91_maint:1-5011 Modified: trunk/matplotlib/lib/matplotlib/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/__init__.py 2008年03月21日 13:10:20 UTC (rev 5011) +++ trunk/matplotlib/lib/matplotlib/__init__.py 2008年03月21日 13:26:27 UTC (rev 5012) @@ -397,7 +397,7 @@ if os.path.exists(p): if not _is_writable_dir(p): - raise RuntimeError("'%s' is not a writable dir; you must set %s/.matplotlib to be a writable dir. You can also set environment variable MPLCONFIGDIR to any writable directory where you want matplotlib data stored "%h) + raise RuntimeError("'%s' is not a writable dir; you must set %s/.matplotlib to be a writable dir. You can also set environment variable MPLCONFIGDIR to any writable directory where you want matplotlib data stored "% (h, h)) else: if not _is_writable_dir(h): raise RuntimeError("Failed to create %s/.matplotlib; consider setting MPLCONFIGDIR to a writable directory for matplotlib configuration data"%h) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5011 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5011&view=rev Author: mdboom Date: 2008年03月21日 06:10:20 -0700 (2008年3月21日) Log Message: ----------- Bugfix: [ 1912719 ] TypeError in Exception __get_configdir() Thanks, Andrea Tomasini Modified Paths: -------------- branches/v0_91_maint/lib/matplotlib/__init__.py Modified: branches/v0_91_maint/lib/matplotlib/__init__.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/__init__.py 2008年03月20日 20:30:44 UTC (rev 5010) +++ branches/v0_91_maint/lib/matplotlib/__init__.py 2008年03月21日 13:10:20 UTC (rev 5011) @@ -397,7 +397,7 @@ if os.path.exists(p): if not _is_writable_dir(p): - raise RuntimeError("'%s' is not a writable dir; you must set %s/.matplotlib to be a writable dir. You can also set environment variable MPLCONFIGDIR to any writable directory where you want matplotlib data stored "%h) + raise RuntimeError("'%s' is not a writable dir; you must set %s/.matplotlib to be a writable dir. You can also set environment variable MPLCONFIGDIR to any writable directory where you want matplotlib data stored "% (h, h)) else: if not _is_writable_dir(h): raise RuntimeError("Failed to create %s/.matplotlib; consider setting MPLCONFIGDIR to a writable directory for matplotlib configuration data"%h) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5010 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5010&view=rev Author: mmetz_bn Date: 2008年03月20日 13:30:44 -0700 (2008年3月20日) Log Message: ----------- Bugfix in ContourSet._process_linestyles Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/contour.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008年03月20日 16:57:41 UTC (rev 5009) +++ trunk/matplotlib/CHANGELOG 2008年03月20日 20:30:44 UTC (rev 5010) @@ -1,3 +1,6 @@ +2008年03月20日 Fixed a minor bug in ContourSet._process_linestyles when + len(linestyles)==Nlev - MM + 2008年03月19日 Changed ma import statements to "from numpy import ma"; this should work with past and future versions of numpy, whereas "import numpy.ma as ma" will work only Modified: trunk/matplotlib/lib/matplotlib/contour.py =================================================================== --- trunk/matplotlib/lib/matplotlib/contour.py 2008年03月20日 16:57:41 UTC (rev 5009) +++ trunk/matplotlib/lib/matplotlib/contour.py 2008年03月20日 20:30:44 UTC (rev 5010) @@ -713,7 +713,7 @@ else: if cbook.is_string_like(linestyles): tlinestyles = [linestyles] * Nlev - elif cbook.iterable(linestyles) and len(linestyles) < Nlev: + elif cbook.iterable(linestyles) and len(linestyles) <= Nlev: tlinestyles = list(linestyles) * int(npy.ceil(Nlev/len(linestyles))) return tlinestyles This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5009 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5009&view=rev Author: mmetz_bn Date: 2008年03月20日 09:57:41 -0700 (2008年3月20日) Log Message: ----------- scatter docs fixed Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008年03月20日 03:30:58 UTC (rev 5008) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008年03月20日 16:57:41 UTC (rev 5009) @@ -4172,6 +4172,8 @@ 'p' : pentagram 'h' : hexagon '8' : octagon + '+' : plus + 'x' : cross The marker can also be a tuple (numsides, style, angle), which will create a custom, regular symbol. @@ -4188,18 +4190,6 @@ Finally, marker can be (verts, 0), verts is a sequence of (x,y) vertices for a custom scatter symbol. - numsides is the number of sides - - style is the style of the regular symbol: - 0 : a regular polygon - 1 : a star-like symbol - 2 : an asterisk - - angle is the angle of rotation of the symbol - - Finally, marker can be (verts, 0), verts is a sequence of (x,y) - vertices for a custom scatter symbol. - s is a size argument in points squared. Any or all of x, y, s, and c may be masked arrays, in which This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5008 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5008&view=rev Author: efiring Date: 2008年03月19日 20:30:58 -0700 (2008年3月19日) Log Message: ----------- Updated the importation of numpy.ma; numerix.npyma is obsolete. Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/CODING_GUIDE trunk/matplotlib/examples/color_by_yvalue.py trunk/matplotlib/examples/contourf_demo.py trunk/matplotlib/examples/dynamic_collection.py trunk/matplotlib/examples/image_masked.py trunk/matplotlib/examples/masked_demo.py trunk/matplotlib/examples/quadmesh_demo.py trunk/matplotlib/examples/scatter_masked.py trunk/matplotlib/examples/step_demo.py trunk/matplotlib/lib/matplotlib/axes.py trunk/matplotlib/lib/matplotlib/cm.py trunk/matplotlib/lib/matplotlib/colors.py trunk/matplotlib/lib/matplotlib/contour.py trunk/matplotlib/lib/matplotlib/image.py trunk/matplotlib/lib/matplotlib/lines.py trunk/matplotlib/lib/matplotlib/path.py trunk/matplotlib/lib/matplotlib/pylab.py trunk/matplotlib/lib/matplotlib/quiver.py trunk/matplotlib/lib/matplotlib/scale.py trunk/matplotlib/lib/matplotlib/transforms.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008年03月19日 18:07:49 UTC (rev 5007) +++ trunk/matplotlib/CHANGELOG 2008年03月20日 03:30:58 UTC (rev 5008) @@ -1,7 +1,14 @@ -2008年03月14日 Removed an apparently unnecessary call to - FigureCanvasAgg.draw in backend_qt*agg. Thanks to Ted - Drain - DSD +2008年03月19日 Changed ma import statements to "from numpy import ma"; + this should work with past and future versions of + numpy, whereas "import numpy.ma as ma" will work only + with numpy >= 1.05, and "import numerix.npyma as ma" + is obsolete now that maskedarray is replacing the + earlier implementation, as of numpy 1.05. +2008年03月14日 Removed an apparently unnecessary call to + FigureCanvasAgg.draw in backend_qt*agg. Thanks to Ted + Drain - DSD + 2008年03月10日 Workaround a bug in backend_qt4agg's blitting due to a buffer width/bbox width mismatch in _backend_agg's copy_from_bbox - DSD Modified: trunk/matplotlib/CODING_GUIDE =================================================================== --- trunk/matplotlib/CODING_GUIDE 2008年03月19日 18:07:49 UTC (rev 5007) +++ trunk/matplotlib/CODING_GUIDE 2008年03月20日 03:30:58 UTC (rev 5008) @@ -12,7 +12,7 @@ # checking out the main src svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/matplotlib matplotlib --username=youruser --password=yourpass -# branch checkouts, eg the transforms branch +# branch checkouts, eg the transforms branch svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/transforms transbranch == Committing changes == @@ -47,15 +47,18 @@ import numpy as npy a = npy.array([1,2,3]) - + For masked arrays, use: - import matplotlib.numerix.npyma as ma + from numpy import ma - (This is needed to support the maskedarray module as an - alternative to the original numpy ma module; eventually, - the maskedarray implementation is likely to replace the - ma implementation.) + (The earlier recommendation, 'import matplotlib.numerix.npyma as ma', + was needed temporarily during the development of the maskedarray + implementation as a separate package. As of numpy 1.05, it + replaces the old implementation. + Note: "from numpy import ma" works with numpy < 1.05 *and* with + numpy >= 1.05. "import numpy.ma as ma" works *only* with + numpy >= 1.05, so for now we must not use it.) For matplotlib main module, use: @@ -64,8 +67,8 @@ For matplotlib modules (or any other modules), use: - import matplotlib.cbook as cbook - + import matplotlib.cbook as cbook + if cbook.iterable(z): pass @@ -125,7 +128,7 @@ (add-hook 'python-mode-hook (lambda () - (add-hook 'local-write-file-hooks 'delete-trailing-whitespace))) + (add-hook 'local-write-file-hooks 'delete-trailing-whitespace))) Modified: trunk/matplotlib/examples/color_by_yvalue.py =================================================================== --- trunk/matplotlib/examples/color_by_yvalue.py 2008年03月19日 18:07:49 UTC (rev 5007) +++ trunk/matplotlib/examples/color_by_yvalue.py 2008年03月20日 03:30:58 UTC (rev 5008) @@ -1,6 +1,6 @@ # use masked arrays to plot a line with different colors by y-value -import matplotlib.numerix.npyma as ma from numpy import logical_or, arange, sin, pi +from numpy import ma from matplotlib.pyplot import plot, show t = arange(0.0, 2.0, 0.01) Modified: trunk/matplotlib/examples/contourf_demo.py =================================================================== --- trunk/matplotlib/examples/contourf_demo.py 2008年03月19日 18:07:49 UTC (rev 5007) +++ trunk/matplotlib/examples/contourf_demo.py 2008年03月20日 03:30:58 UTC (rev 5008) @@ -1,6 +1,5 @@ #!/usr/bin/env python from pylab import * -import matplotlib.numerix.npyma as ma origin = 'lower' #origin = 'upper' Modified: trunk/matplotlib/examples/dynamic_collection.py =================================================================== --- trunk/matplotlib/examples/dynamic_collection.py 2008年03月19日 18:07:49 UTC (rev 5007) +++ trunk/matplotlib/examples/dynamic_collection.py 2008年03月20日 03:30:58 UTC (rev 5008) @@ -12,8 +12,8 @@ facecolors = [cm.jet(0.5)] collection = RegularPolyCollection( - fig.dpi, - numsides=5, # a pentagon + #fig.dpi, + 5, # a pentagon rotation=0, sizes=(50,), facecolors = facecolors, Modified: trunk/matplotlib/examples/image_masked.py =================================================================== --- trunk/matplotlib/examples/image_masked.py 2008年03月19日 18:07:49 UTC (rev 5007) +++ trunk/matplotlib/examples/image_masked.py 2008年03月20日 03:30:58 UTC (rev 5008) @@ -6,7 +6,7 @@ ''' from pylab import * -import matplotlib.numerix.npyma as ma +from numpy import ma import matplotlib.colors as colors delta = 0.025 Modified: trunk/matplotlib/examples/masked_demo.py =================================================================== --- trunk/matplotlib/examples/masked_demo.py 2008年03月19日 18:07:49 UTC (rev 5007) +++ trunk/matplotlib/examples/masked_demo.py 2008年03月20日 03:30:58 UTC (rev 5008) @@ -6,7 +6,6 @@ break the line at the data gaps. ''' -import matplotlib.numerix.npyma as ma from pylab import * x = ma.arange(0, 2*pi, 0.02) Modified: trunk/matplotlib/examples/quadmesh_demo.py =================================================================== --- trunk/matplotlib/examples/quadmesh_demo.py 2008年03月19日 18:07:49 UTC (rev 5007) +++ trunk/matplotlib/examples/quadmesh_demo.py 2008年03月20日 03:30:58 UTC (rev 5008) @@ -9,7 +9,7 @@ import numpy as npy from matplotlib.pyplot import figure, show, savefig from matplotlib import cm, colors -from matplotlib.numerix import npyma as ma +from numpy import ma n = 56 x = npy.linspace(-1.5,1.5,n) Modified: trunk/matplotlib/examples/scatter_masked.py =================================================================== --- trunk/matplotlib/examples/scatter_masked.py 2008年03月19日 18:07:49 UTC (rev 5007) +++ trunk/matplotlib/examples/scatter_masked.py 2008年03月20日 03:30:58 UTC (rev 5008) @@ -1,6 +1,5 @@ #!/usr/bin/env python from pylab import * -import matplotlib.numerix.npyma as ma N = 100 r0 = 0.6 Modified: trunk/matplotlib/examples/step_demo.py =================================================================== --- trunk/matplotlib/examples/step_demo.py 2008年03月19日 18:07:49 UTC (rev 5007) +++ trunk/matplotlib/examples/step_demo.py 2008年03月20日 03:30:58 UTC (rev 5008) @@ -1,5 +1,5 @@ import numpy as npy -from matplotlib.numerix import npyma as ma +from numpy import ma from matplotlib.pyplot import step, legend, xlim, ylim, show x = npy.arange(1, 7, 0.4) Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008年03月19日 18:07:49 UTC (rev 5007) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008年03月20日 03:30:58 UTC (rev 5008) @@ -2,9 +2,8 @@ import math, warnings, new import numpy as npy +from numpy import ma -import matplotlib.numerix.npyma as ma - import matplotlib rcParams = matplotlib.rcParams Modified: trunk/matplotlib/lib/matplotlib/cm.py =================================================================== --- trunk/matplotlib/lib/matplotlib/cm.py 2008年03月19日 18:07:49 UTC (rev 5007) +++ trunk/matplotlib/lib/matplotlib/cm.py 2008年03月20日 03:30:58 UTC (rev 5008) @@ -3,9 +3,9 @@ """ import numpy as npy +from numpy import ma import matplotlib as mpl import matplotlib.colors as colors -import matplotlib.numerix.npyma as ma import matplotlib.cbook as cbook from matplotlib._cm import * Modified: trunk/matplotlib/lib/matplotlib/colors.py =================================================================== --- trunk/matplotlib/lib/matplotlib/colors.py 2008年03月19日 18:07:49 UTC (rev 5007) +++ trunk/matplotlib/lib/matplotlib/colors.py 2008年03月20日 03:30:58 UTC (rev 5008) @@ -35,7 +35,7 @@ """ import re import numpy as npy -import matplotlib.numerix.npyma as ma +from numpy import ma import matplotlib.cbook as cbook cnames = { Modified: trunk/matplotlib/lib/matplotlib/contour.py =================================================================== --- trunk/matplotlib/lib/matplotlib/contour.py 2008年03月19日 18:07:49 UTC (rev 5007) +++ trunk/matplotlib/lib/matplotlib/contour.py 2008年03月20日 03:30:58 UTC (rev 5008) @@ -6,7 +6,7 @@ import warnings import matplotlib as mpl import numpy as npy -import matplotlib.numerix.npyma as ma +from numpy import ma import matplotlib._cntr as _cntr import matplotlib.path as path import matplotlib.ticker as ticker Modified: trunk/matplotlib/lib/matplotlib/image.py =================================================================== --- trunk/matplotlib/lib/matplotlib/image.py 2008年03月19日 18:07:49 UTC (rev 5007) +++ trunk/matplotlib/lib/matplotlib/image.py 2008年03月20日 03:30:58 UTC (rev 5008) @@ -7,9 +7,8 @@ import os, warnings import numpy as npy +from numpy import ma -import matplotlib.numerix.npyma as ma - from matplotlib import rcParams from matplotlib import artist as martist from matplotlib import colors as mcolors Modified: trunk/matplotlib/lib/matplotlib/lines.py =================================================================== --- trunk/matplotlib/lib/matplotlib/lines.py 2008年03月19日 18:07:49 UTC (rev 5007) +++ trunk/matplotlib/lib/matplotlib/lines.py 2008年03月20日 03:30:58 UTC (rev 5008) @@ -7,8 +7,7 @@ from __future__ import division import numpy as npy - -from matplotlib.numerix import npyma as ma +from numpy import ma from matplotlib import verbose import artist from artist import Artist Modified: trunk/matplotlib/lib/matplotlib/path.py =================================================================== --- trunk/matplotlib/lib/matplotlib/path.py 2008年03月19日 18:07:49 UTC (rev 5007) +++ trunk/matplotlib/lib/matplotlib/path.py 2008年03月20日 03:30:58 UTC (rev 5008) @@ -8,7 +8,7 @@ from weakref import WeakValueDictionary import numpy as npy -from matplotlib.numerix import npyma as ma +from numpy import ma from matplotlib._path import point_in_path, get_path_extents, \ point_in_path_collection, get_path_collection_extents, \ Modified: trunk/matplotlib/lib/matplotlib/pylab.py =================================================================== --- trunk/matplotlib/lib/matplotlib/pylab.py 2008年03月19日 18:07:49 UTC (rev 5007) +++ trunk/matplotlib/lib/matplotlib/pylab.py 2008年03月20日 03:30:58 UTC (rev 5008) @@ -198,12 +198,7 @@ silent_list, iterable, enumerate, dedent import numpy as npy -# The masked array namespace is brought in as ma; getting -# this from numerix allows one to select either numpy.ma or -# Pierre G-M's maskedarray implementation, which may -# replace the present numpy.ma implementation in a future -# numpy release. -from matplotlib.numerix import npyma as ma +from numpy import ma from matplotlib import mpl # pulls in most modules Modified: trunk/matplotlib/lib/matplotlib/quiver.py =================================================================== --- trunk/matplotlib/lib/matplotlib/quiver.py 2008年03月19日 18:07:49 UTC (rev 5007) +++ trunk/matplotlib/lib/matplotlib/quiver.py 2008年03月20日 03:30:58 UTC (rev 5008) @@ -143,7 +143,7 @@ """ import numpy as npy -import matplotlib.numerix.npyma as ma +from numpy import ma import matplotlib.collections as collections import matplotlib.transforms as transforms import matplotlib.text as text Modified: trunk/matplotlib/lib/matplotlib/scale.py =================================================================== --- trunk/matplotlib/lib/matplotlib/scale.py 2008年03月19日 18:07:49 UTC (rev 5007) +++ trunk/matplotlib/lib/matplotlib/scale.py 2008年03月20日 03:30:58 UTC (rev 5008) @@ -1,6 +1,6 @@ import textwrap import numpy as npy -from matplotlib.numerix import npyma as ma +from numpy import ma MaskedArray = ma.MaskedArray from cbook import dedent Modified: trunk/matplotlib/lib/matplotlib/transforms.py =================================================================== --- trunk/matplotlib/lib/matplotlib/transforms.py 2008年03月19日 18:07:49 UTC (rev 5007) +++ trunk/matplotlib/lib/matplotlib/transforms.py 2008年03月20日 03:30:58 UTC (rev 5008) @@ -24,7 +24,7 @@ """ import numpy as npy -from matplotlib.numerix import npyma as ma +from numpy import ma from matplotlib._path import affine_transform from numpy.linalg import inv This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5007 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5007&view=rev Author: sameerd Date: 2008年03月19日 11:07:49 -0700 (2008年3月19日) Log Message: ----------- Added outerjoin, lefjoin and rightjoin support to rec_join Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/mlab.py Added Paths: ----------- trunk/matplotlib/examples/rec_join_demo.py Added: trunk/matplotlib/examples/rec_join_demo.py =================================================================== --- trunk/matplotlib/examples/rec_join_demo.py (rev 0) +++ trunk/matplotlib/examples/rec_join_demo.py 2008年03月19日 18:07:49 UTC (rev 5007) @@ -0,0 +1,27 @@ +import numpy as np +import matplotlib.mlab as mlab + + +r = mlab.csv2rec('data/aapl.csv') +r.sort() +r1 = r[-10:] + +# Create a new array +r2 = np.empty(12, dtype=[('date', '|O4'), ('high', np.float), + ('marker', np.float)]) +r2 = r2.view(np.recarray) +r2.date = r.date[-17:-5] +r2.high = r.high[-17:-5] +r2.marker = np.arange(12) + +print "r1:" +print mlab.rec2txt(r1) +print "r2:" +print mlab.rec2txt(r2) + +defaults = {'marker':-1, 'close':np.NaN, 'low':-4444.} + +for s in ('inner', 'outer', 'leftouter'): + rec = mlab.rec_join(['date', 'high'], r1, r2, + jointype=s, defaults=defaults) + print "\n%sjoin :\n%s" % (s, mlab.rec2txt(rec)) Modified: trunk/matplotlib/lib/matplotlib/mlab.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mlab.py 2008年03月19日 14:36:57 UTC (rev 5006) +++ trunk/matplotlib/lib/matplotlib/mlab.py 2008年03月19日 18:07:49 UTC (rev 5007) @@ -2044,12 +2044,19 @@ return npy.rec.fromarrays(arrays, names=names) -def rec_join(key, r1, r2): + +def rec_join(key, r1, r2, jointype='inner', defaults=None): """ join record arrays r1 and r2 on key; key is a tuple of field names. if r1 and r2 have equal values on all the keys in the key tuple, then their fields will be merged into a new record array containing the intersection of the fields of r1 and r2 + + The jointype keyword can be 'inner', 'outer', 'leftouter'. + To do a rightouter join just reverse r1 and r2. + + The defaults keyword is a dictionary filled with + {column_name:default_value} pairs. """ for name in key: @@ -2067,17 +2074,22 @@ r1keys = set(r1d.keys()) r2keys = set(r2d.keys()) - keys = r1keys & r2keys + common_keys = r1keys & r2keys - r1ind = npy.array([r1d[k] for k in keys]) - r2ind = npy.array([r2d[k] for k in keys]) + r1ind = npy.array([r1d[k] for k in common_keys]) + r2ind = npy.array([r2d[k] for k in common_keys]) - # Make sure that the output rows have the same relative order as r1 - sortind = r1ind.argsort() + common_len = len(common_keys) + left_len = right_len = 0 + if jointype == "outer" or jointype == "leftouter": + left_keys = r1keys.difference(r2keys) + left_ind = npy.array([r1d[k] for k in left_keys]) + left_len = len(left_ind) + if jointype == "outer": + right_keys = r2keys.difference(r1keys) + right_ind = npy.array([r2d[k] for k in right_keys]) + right_len = len(right_ind) - r1 = r1[r1ind[sortind]] - r2 = r2[r2ind[sortind]] - r2 = rec_drop_fields(r2, r1.dtype.names) @@ -2103,13 +2115,31 @@ [desc for desc in r2.dtype.descr if desc[0] not in key ] ) - newrec = npy.empty(len(r1), dtype=newdtype) + newrec = npy.empty(common_len + left_len + right_len, dtype=newdtype) + + if jointype != 'inner' and defaults is not None: # fill in the defaults enmasse + newrec_fields = newrec.dtype.fields.keys() + for k, v in defaults.items(): + if k in newrec_fields: + newrec[k] = v + for field in r1.dtype.names: - newrec[field] = r1[field] + newrec[field][:common_len] = r1[field][r1ind] + if jointype == "outer" or jointype == "leftouter": + newrec[field][common_len:(common_len+left_len)] = r1[field][left_ind] for field in r2.dtype.names: - newrec[field] = r2[field] + newrec[field][:common_len] = r2[field][r2ind] + if jointype == "outer": + newrec[field][-right_len:] = r2[field][right_ind[right_ind.argsort()]] + # sort newrec using the same order as r1 + sort_indices = r1ind.copy() + if jointype == "outer" or jointype == "leftouter": + sort_indices = npy.append(sort_indices, left_ind) + newrec[:(common_len+left_len)] = newrec[sort_indices.argsort()] + + return newrec.view(npy.recarray) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5006 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5006&view=rev Author: dsdale Date: 2008年03月19日 07:36:57 -0700 (2008年3月19日) Log Message: ----------- fix cursor mapping in backend_qt4 Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py 2008年03月19日 13:13:05 UTC (rev 5005) +++ trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py 2008年03月19日 14:36:57 UTC (rev 5006) @@ -21,8 +21,8 @@ DEBUG = False cursord = { - cursors.MOVE : QtCore.Qt.PointingHandCursor, - cursors.HAND : QtCore.Qt.WaitCursor, + cursors.MOVE : QtCore.Qt.SizeAllCursor, + cursors.HAND : QtCore.Qt.PointingHandCursor, cursors.POINTER : QtCore.Qt.ArrowCursor, cursors.SELECT_REGION : QtCore.Qt.CrossCursor, } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5005 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5005&view=rev Author: dsdale Date: 2008年03月19日 06:13:05 -0700 (2008年3月19日) Log Message: ----------- minor tweaks to filesave.svg Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/mpl-data/images/filesave.svg Modified: trunk/matplotlib/lib/matplotlib/mpl-data/images/filesave.svg =================================================================== --- trunk/matplotlib/lib/matplotlib/mpl-data/images/filesave.svg 2008年03月18日 18:46:07 UTC (rev 5004) +++ trunk/matplotlib/lib/matplotlib/mpl-data/images/filesave.svg 2008年03月19日 13:13:05 UTC (rev 5005) @@ -1,428 +1,450 @@ -<?xml version="1.0" standalone="no"?> -<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" -"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" -[ - <!ATTLIST svg - xmlns:xlink CDATA #FIXED "http://www.w3.org/1999/xlink"> -]> -<!-- Created with Sodipodi ("http://www.sodipodi.com/") --> +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> <svg + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + version="1.0" width="128pt" height="128pt" - id="svg1" - sodipodi:version="0.27" - sodipodi:docname="/mnt/windows/Themes/Work/Blue-Sphere/filesave.svg" - sodipodi:docbase="/mnt/windows/Themes/Work/Blue-Sphere/" - xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:xlink="http://www.w3.org/1999/xlink"> + id="svg1"> <defs id="defs22"> <linearGradient id="linearGradient408"> <stop - offset="0.000000" - style="stop-color:#fbddb2;stop-opacity:0.992157;" - id="stop409" /> + id="stop409" + style="stop-color:#fbddb2;stop-opacity:0.99215698" + offset="0" /> <stop - offset="1.000000" - style="stop-color:#efa81a;stop-opacity:0.952941;" - id="stop410" /> + id="stop410" + style="stop-color:#efa81a;stop-opacity:0.952941" + offset="1" /> </linearGradient> <linearGradient id="linearGradient458"> <stop - offset="0.000000" - style="stop-color:#cdffff;stop-opacity:0.690196;" - id="stop459" /> + id="stop459" + style="stop-color:#cdffff;stop-opacity:0.69019598" + offset="0" /> <stop - offset="1.000000" - style="stop-color:#0c5c7d;stop-opacity:0.780392;" - id="stop460" /> + id="stop460" + style="stop-color:#0c5c7d;stop-opacity:0.78039199" + offset="1" /> </linearGradient> <linearGradient id="linearGradient320"> <stop - offset="0.000000" - style="stop-color:#5f9eb2;stop-opacity:0.882353;" - id="stop321" /> + id="stop321" + style="stop-color:#5f9eb2;stop-opacity:0.88235301" + offset="0" /> <stop - offset="1.000000" - style="stop-color:#0c5c7d;stop-opacity:0.870588;" - id="stop322" /> + id="stop322" + style="stop-color:#0c5c7d;stop-opacity:0.870588" + offset="1" /> </linearGradient> <linearGradient id="linearGradient314"> <stop - offset="0.000000" - style="stop-color:#0c5c7d;stop-opacity:1;" - id="stop315" /> + id="stop315" + style="stop-color:#0c5c7d;stop-opacity:1" + offset="0" /> <stop - offset="1.000000" - style="stop-color:#0c5c7d;stop-opacity:1;" - id="stop316" /> + id="stop316" + style="stop-color:#0c5c7d;stop-opacity:1" + offset="1" /> </linearGradient> <linearGradient id="linearGradient310"> <stop - offset="0.000000" - style="stop-color:#0c5c7d;stop-opacity:0.780392;" - id="stop311" /> + id="stop311" + style="stop-color:#0c5c7d;stop-opacity:0.78039199" + offset="0" /> <stop - offset="1.000000" - style="stop-color:#cdffff;stop-opacity:0.690196;" - id="stop312" /> + id="stop312" + style="stop-color:#cdffff;stop-opacity:0.69019598" + offset="1" /> </linearGradient> <linearGradient id="linearGradient307"> <stop - offset="0.000000" - style="stop-color:#cdffff;stop-opacity:1;" - id="stop308" /> + id="stop308" + style="stop-color:#cdffff;stop-opacity:1" + offset="0" /> <stop - offset="1.000000" - style="stop-color:#0c5c7d;stop-opacity:1;" - id="stop309" /> + id="stop309" + style="stop-color:#0c5c7d;stop-opacity:1" + offset="1" /> </linearGradient> <linearGradient id="linearGradient291"> <stop - offset="0.000000" - style="stop-color:#0c5c7d;stop-opacity:0.615686;" - id="stop292" /> + id="stop292" + style="stop-color:#0c5c7d;stop-opacity:0.615686" + offset="0" /> <stop - offset="1.000000" - style="stop-color:#004468;stop-opacity:0.917647;" - id="stop293" /> + id="stop293" + style="stop-color:#004468;stop-opacity:0.917647" + offset="1" /> </linearGradient> <linearGradient id="linearGradient235"> <stop - offset="0.000000" - style="stop-color:#eaffff;stop-opacity:1;" - id="stop236" /> + id="stop236" + style="stop-color:#eaffff;stop-opacity:1" + offset="0" /> <stop - offset="1.000000" - style="stop-color:#97e2ff;stop-opacity:0.992157;" - id="stop237" /> + id="stop237" + style="stop-color:#97e2ff;stop-opacity:0.99215698" + offset="1" /> </linearGradient> <linearGradient id="linearGradient232"> <stop - offset="0.000000" - style="stop-color:#fcfcfc;stop-opacity:1;" - id="stop233" /> + id="stop233" + style="stop-color:#fcfcfc;stop-opacity:1" + offset="0" /> <stop - offset="1.000000" - style="stop-color:#afb2b5;stop-opacity:1;" - id="stop234" /> + id="stop234" + style="stop-color:#afb2b5;stop-opacity:1" + offset="1" /> </linearGradient> <linearGradient id="linearGradient216"> <stop - offset="0.000000" - style="stop-color:#f5f5f5;stop-opacity:1;" - id="stop217" /> + id="stop217" + style="stop-color:#f5f5f5;stop-opacity:1" + offset="0" /> <stop - offset="1.000000" - style="stop-color:#949494;stop-opacity:1;" - id="stop218" /> + id="stop218" + style="stop-color:#949494;stop-opacity:1" + offset="1" /> </linearGradient> <linearGradient id="linearGradient211"> <stop - offset="0.000000" - style="stop-color:#d7ffff;stop-opacity:0.458824;" - id="stop212" /> + id="stop212" + style="stop-color:#d7ffff;stop-opacity:0.45882401" + offset="0" /> <stop - offset="1.000000" - style="stop-color:#2ea6b9;stop-opacity:0.823529;" - id="stop213" /> + id="stop213" + style="stop-color:#2ea6b9;stop-opacity:0.82352901" + offset="1" /> </linearGradient> <linearGradient id="linearGradient168"> <stop - offset="0.000000" - style="stop-color:#cdffff;stop-opacity:0.87451;" - id="stop169" /> + id="stop169" + style="stop-color:#cdffff;stop-opacity:0.87450999" + offset="0" /> <stop - offset="1.000000" - style="stop-color:#0c5c7d;stop-opacity:0.866667;" - id="stop170" /> + id="stop170" + style="stop-color:#0c5c7d;stop-opacity:0.86666697" + offset="1" /> </linearGradient> <linearGradient id="linearGradient90"> <stop - offset="0.000000" - style="stop-color:#cdffff;stop-opacity:1;" - id="stop91" /> + id="stop91" + style="stop-color:#cdffff;stop-opacity:1" + offset="0" /> <stop - offset="1.000000" - style="stop-color:#006b97;stop-opacity:0.905882;" - id="stop92" /> + id="stop92" + style="stop-color:#006b97;stop-opacity:0.905882" + offset="1" /> </linearGradient> <linearGradient id="linearGradient67"> <stop - offset="0.000000" - style="stop-color:#d7ffff;stop-opacity:0.898039;" - id="stop70" /> + id="stop70" + style="stop-color:#d7ffff;stop-opacity:0.89803898" + offset="0" /> <stop - offset="1.000000" - style="stop-color:#2ea6b9;stop-opacity:0.952941;" - id="stop69" /> + id="stop69" + style="stop-color:#2ea6b9;stop-opacity:0.952941" + offset="1" /> </linearGradient> <linearGradient id="linearGradient57"> <stop - offset="0.000000" - style="stop-color:#ffffff;stop-opacity:1;" - id="stop59" /> + id="stop59" + style="stop-color:#ffffff;stop-opacity:1" + offset="0" /> <stop - offset="1.000000" - style="stop-color:#797979;stop-opacity:1;" - id="stop58" /> + id="stop58" + style="stop-color:#797979;stop-opacity:1" + offset="1" /> </linearGradient> <defs id="defs4"> <radialGradient + cx="869.60303" + cy="1973.58" + r="2106.6499" + fx="869.60303" + fy="1973.58" id="1" - cx="869.603027" - cy="1973.579956" - r="2106.649902" - fx="869.603027" - fy="1973.579956" - gradientUnits="userSpaceOnUse" - xlink:href="#linearGradient67" /> + xlink:href="#linearGradient67" + gradientUnits="userSpaceOnUse" /> </defs> <defs id="defs11"> <linearGradient - id="2" - x1="255.848" + x1="255.84801" y1="119.147" x2="375.686" - y2="34.1009" + y2="34.100899" + id="2" gradientUnits="userSpaceOnUse"> <stop - offset="0" - style="stop-color:#ffffff" - id="stop13" /> + id="stop13" + style="stop-color:#ffffff;stop-opacity:1" + offset="0" /> <stop - offset="1" - style="stop-color:#000000" - id="stop14" /> + id="stop14" + style="stop-color:#000000;stop-opacity:1" + offset="1" /> </linearGradient> </defs> <defs id="defs16"> <linearGradient + x1="275.05301" + y1="109.384" + x2="356.48099" + y2="30.8643" id="3" - x1="275.053009" - y1="109.384003" - x2="356.480988" - y2="30.864300" - gradientUnits="userSpaceOnUse" - xlink:href="#linearGradient57" /> + xlink:href="#linearGradient57" + gradientUnits="userSpaceOnUse" /> </defs> <radialGradient - xlink:href="#linearGradient291" - id="radialGradient88" - cx="7.8608e-19" + cx="7.8608002e-19" cy="1.31835e-24" - fx="7.8608e-19" + r="0.56394601" + fx="7.8608002e-19" fy="1.31835e-24" - r="0.563946" + id="radialGradient88" + xlink:href="#linearGradient291" gradientUnits="objectBoundingBox" gradientTransform="matrix(1.18884,0.249702,0,0.841157,0.2,0.299442)" spreadMethod="pad" /> <linearGradient - xlink:href="#linearGradient310" - id="linearGradient89" x1="-0.258715" y1="-0.109747" x2="0.241703" y2="1.23657" + id="linearGradient89" + xlink:href="#linearGradient310" gradientUnits="objectBoundingBox" - gradientTransform="matrix(1.72489,1.17189,-0.0575163,0.540671,0.503708,0.486073)" + gradientTransform="matrix(1.72489,1.17189,-5.75163e-2,0.540671,0.503708,0.486073)" spreadMethod="pad" /> <linearGradient - xlink:href="#linearGradient408" - id="linearGradient210" x1="0.240647" - y1="1.19614" + y1="1.1961401" x2="0.248069" y2="-0.301604" + id="linearGradient210" + xlink:href="#linearGradient408" gradientUnits="objectBoundingBox" - gradientTransform="matrix(0.945877,-1.683e-07,5.89965e-08,1.05722,0.264368,0.249996)" + gradientTransform="matrix(0.945877,-1.683e-7,5.89965e-8,1.05722,0.264368,0.249996)" spreadMethod="pad" /> <linearGradient - xlink:href="#linearGradient320" - id="linearGradient215" x1="0" y1="0" x2="1" y2="0" + id="linearGradient215" + xlink:href="#linearGradient320" gradientUnits="objectBoundingBox" - gradientTransform="matrix(1,3.24414e-08,0,1,4.00643e-08,4.14905e-08)" spreadMethod="pad" /> <linearGradient - x1="0.0434782" + x1="0.043478198" y1="0.101563" x2="0.900621" y2="1.03125" + id="linearGradient231" xlink:href="#linearGradient216" - id="linearGradient231" gradientUnits="objectBoundingBox" - gradientTransform="translate(1.75173e-09,-1.08106e-08)" spreadMethod="pad" /> <linearGradient - x1="-0.267823" + x1="-0.26782301" y1="-0.113611" - x2="0.250212" + x2="0.25021201" y2="1.2801" + id="linearGradient238" xlink:href="#linearGradient310" - id="linearGradient238" gradientUnits="objectBoundingBox" - gradientTransform="matrix(-1.66776,-1.248,0.0590927,-0.555388,0.492831,1.02592)" + gradientTransform="matrix(-1.66776,-1.248,5.90927e-2,-0.555388,0.492831,1.02592)" spreadMethod="pad" /> <radialGradient - cx="3.03981e-14" + cx="3.0398102e-14" cy="1.05578e-10" - r="0.773346" - fx="3.03981e-14" + r="0.77334601" + fx="3.0398102e-14" fy="1.05578e-10" + id="radialGradient280" xlink:href="#linearGradient232" - id="radialGradient280" gradientUnits="objectBoundingBox" - gradientTransform="matrix(0.945877,-9.10109e-07,-9.55425e-11,1.05722,0.264368,0.249996)" + gradientTransform="matrix(0.945877,-9.10109e-7,0,1.05722,0.264368,0.249996)" spreadMethod="pad" /> <linearGradient x1="-0.000235766" - y1="0.492188" + y1="0.49218801" x2="1.28544" - y2="0.492188" + y2="0.49218801" + id="linearGradient290" xlink:href="#linearGradient216" - id="linearGradient290" gradientUnits="objectBoundingBox" - gradientTransform="translate(0.000274928,-9.34616e-09)" + gradientTransform="translate(2.74928e-4,0)" spreadMethod="pad" /> <linearGradient + x1="3.2426901" + y1="0.60926002" + x2="3.0476601" + y2="0.82825398" + id="linearGradient305" xlink:href="#linearGradient320" - id="linearGradient305" - x1="3.24269" - y1="0.60926" - x2="3.04766" - y2="0.828254" gradientUnits="objectBoundingBox" - gradientTransform="matrix(1,2.88381e-09,-9.73077e-09,1,-2.65767,-0.201237)" + gradientTransform="translate(-2.65767,-0.201237)" spreadMethod="pad" /> <radialGradient - xlink:href="#linearGradient408" - id="radialGradient306" cx="1.13941e-09" - cy="2.74646e-09" + cy="2.7464599e-09" + r="0.30980599" fx="1.13941e-09" - fy="2.74646e-09" - r="0.309806" + fy="2.7464599e-09" + id="radialGradient306" + xlink:href="#linearGradient408" gradientUnits="objectBoundingBox" gradientTransform="matrix(0.959059,0,0,1.04269,0.394554,0.45127)" spreadMethod="pad" /> <radialGradient - xlink:href="#linearGradient458" - id="radialGradient317" cx="-2.66079e-08" - cy="6.64885e-09" + cy="6.6488499e-09" + r="0.30992299" fx="-2.66079e-08" - fy="6.64885e-09" - r="0.309923" + fy="6.6488499e-09" + id="radialGradient317" + xlink:href="#linearGradient458" gradientUnits="objectBoundingBox" - gradientTransform="matrix(1.72489,1.17189,-0.0575163,0.540669,0.503699,0.486073)" + gradientTransform="matrix(1.72489,1.17189,-5.75163e-2,0.540669,0.503699,0.486073)" spreadMethod="pad" /> <linearGradient x1="-0.0287253" y1="0.0341933" - x2="-0.0612692" - y2="0.311325" + x2="-0.061269201" + y2="0.31132501" + id="linearGradient319" xlink:href="#linearGradient314" - id="linearGradient319" gradientUnits="objectBoundingBox" - gradientTransform="matrix(1.07397,0.00217354,-0.000316583,0.931124,0.53185,0.277306)" + gradientTransform="matrix(1.07397,2.17354e-3,-3.16583e-4,0.931124,0.53185,0.277306)" spreadMethod="pad" /> <linearGradient x1="-0.258715" y1="-0.109747" x2="0.241703" - y2="1.236570" - xlink:href="#linearGradient408" - id="linearGradient416" /> + y2="1.23657" + id="linearGradient416" + xlink:href="#linearGradient408" /> <linearGradient x1="0.107623" - y1="0.133438" + y1="0.13343801" x2="1.00448" - y2="0.986385" + y2="0.98638499" + id="linearGradient418" xlink:href="#linearGradient232" - id="linearGradient418" gradientUnits="objectBoundingBox" - gradientTransform="matrix(1,-5.11905e-06,0,1,-8.06426e-09,2.67899e-08)" + gradientTransform="matrix(1,-5.11905e-6,0,1,0,2.67899e-8)" spreadMethod="pad" /> + <radialGradient + cx="-53.452854" + cy="225.88168" + r="202.19385" + fx="-53.452854" + fy="225.88168" + id="radialGradient2665" + xlink:href="#linearGradient291" + gradientUnits="userSpaceOnUse" + gradientTransform="scale(1.0092616,0.9908233)" + spreadMethod="pad" /> + <linearGradient + x1="-40.478325" + y1="341.18823" + x2="119.32612" + y2="514.5177" + id="linearGradient2667" + xlink:href="#linearGradient216" + gradientUnits="userSpaceOnUse" + gradientTransform="scale(1.0699513,0.934622)" + spreadMethod="pad" /> + <linearGradient + x1="-27.638033" + y1="348.34726" + x2="137.4688" + y2="505.37048" + id="linearGradient2669" + xlink:href="#linearGradient232" + gradientUnits="userSpaceOnUse" + gradientTransform="scale(1.0708712,0.9338191)" + spreadMethod="pad" /> + <linearGradient + x1="52.739735" + y1="343.64432" + x2="53.019871" + y2="287.11353" + id="linearGradient2671" + xlink:href="#linearGradient408" + gradientUnits="userSpaceOnUse" + gradientTransform="scale(3.2987788,0.3031425)" + spreadMethod="pad" /> </defs> - <sodipodi:namedview - id="base"> - <sodipodi:guide - orientation="horizontal" - position="26.447950" - id="sodipodi:guide411" /> - </sodipodi:namedview> - <path - style="font-size:12;fill:url(#radialGradient88);fill-opacity:0.99;stroke:#0c5c7d;stroke-width:9.27151;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:0.99;" - d="M -49.21 250.253 C -50.4531 237.758 -40.2031 227.28 -26.5727 228.549 L 281.811 293.495 C 293.021 296.711 300.174 303.367 303.271 318.626 L 303.001 556.999 L 271.496 574.417 L -20.6248 515.348 L -49.1325 483.196 L -49.21 250.253 z " - id="path208" - transform="matrix(0.296773,-0.0721048,0,0.349857,28.4112,-45.4513)" - sodipodi:nodetypes="ccccccccc" /> - <path - style="font-size:12;fill:url(#linearGradient231);fill-opacity:0.699301;stroke-width:8.96855;stroke:#1c2942;stroke-opacity:0.992157;" - d="M -46.2318 305.669 L 141.393 358.659 L 143.013 470.95 L -47.4986 417.316 L -46.2318 305.669 z " - id="path230" - transform="matrix(0.269105,-0.0838627,0,0.297149,54.9543,7.17835)" - sodipodi:nodetypes="ccccc" /> - <path - style="font-size:12;fill:#ffffff;fill-opacity:0.992157;stroke-width:39.1707;stroke:#1c2942;stroke-opacity:0.992157;" - d="M -54.9317 113.669 L 347.321 224.163 L 346.804 333.491 L -55.046 228.132 L -54.9317 113.669 z " - id="path313" - transform="matrix(-0.016227,0.0165668,-0.000179088,-0.0625738,25.0483,59.5183)" - sodipodi:nodetypes="ccccc" /> - <path - style="font-size:12;fill:url(#linearGradient418);fill-opacity:0.699301;stroke-width:6.63037;stroke:#0c5c7d;stroke-opacity:0.992157;" - d="M -46.2318 305.669 L 141.393 358.659 L 143.013 470.95 L -47.4986 417.316 L -46.2318 305.669 z " - id="path412" - transform="matrix(0.380378,-0.105483,0,0.373757,48.6308,-81.8436)" - sodipodi:nodetypes="ccccc" /> - <path - style="font-size:12;fill:#1c2942;stroke:#0c5d7d;stroke-width:2.5;stroke-opacity:0.99;fill-opacity:0.992157;" - d="M 147.259 91.7372 L 267.273 92.474 L 265.636 100.679 L 145.264 100.165 L 147.259 91.7372 z " - id="path414" - transform="matrix(0.367419,-0.00258761,0.0925713,0.528669,-11.381,6.77426)" /> - <path - style="font-size:12;fill:#1c2942;fill-opacity:0.992157;stroke-width:8.96855;" - d="M -40.0588 122.695 L 347.321 224.163 L 346.804 333.491 L -40.0941 229.996 L -40.0588 122.695 z " - id="path415" - transform="matrix(-0.0337107,0.0638003,-0.000372046,-0.240978,62.4693,163.387)" - sodipodi:nodetypes="ccccc" /> - <path - style="font-size:12;fill:url(#linearGradient210);stroke:#580400;stroke-width:2.5;stroke-opacity:0.992157;" - d="M 147.259 91.7372 L 267.273 92.474 L 265.636 100.679 L 145.264 100.165 L 147.259 91.7372 z " - id="path417" - transform="matrix(0.576626,-0.00406098,0.145281,0.829691,-66.2039,-37.2798)" /> - <path - style="font-size:12;fill:#1c2942;stroke:#0c5d7d;stroke-width:2.5;stroke-opacity:0.99;fill-opacity:0.992157;" - d="M 147.259 91.7372 L 267.273 92.474 L 265.636 100.679 L 145.264 100.165 L 147.259 91.7372 z " - id="path419" - transform="matrix(0.367419,-0.00258761,0.0925713,0.528669,-11.381,16.8689)" /> - <path - style="font-size:12;fill:#ffffff;fill-opacity:0.992157;stroke-width:39.1707;stroke:#1c2942;stroke-opacity:0.992157;" - d="M -54.9317 113.669 L 347.321 224.163 L 346.804 333.491 L -55.046 228.132 L -54.9317 113.669 z " - id="path420" - transform="matrix(-0.016227,0.0165668,-0.000179088,-0.0625738,112.872,59.0136)" - sodipodi:nodetypes="ccccc" /> -</svg> \ No newline at end of file + <g + transform="matrix(1.1494743,0,0,1.1494743,3.4337672,-19.658227)" + id="g2646"> + <path + d="M -49.21,250.253 C -50.4531,237.758 -40.2031,227.28 -26.5727,228.549 L 281.811,293.495 C 293.021,296.711 300.174,303.367 303.271,318.626 L 303.001,556.999 L 271.496,574.417 L -20.6248,515.348 L -49.1325,483.196 L -49.21,250.253 z" + transform="matrix(0.296773,-7.21048e-2,0,0.349857,28.4112,-45.4513)" + id="path208" + style="font-size:12px;fill:url(#radialGradient2665);fill-opacity:0.98999999;stroke:#0c5c7d;stroke-width:9.27151012;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:0.98999999" /> + <path + d="M -46.2318,305.669 L 141.393,358.659 L 143.013,470.95 L -47.4986,417.316 L -46.2318,305.669 z" + transform="matrix(0.269105,-8.38627e-2,0,0.297149,54.9543,7.17835)" + id="path230" + style="font-size:12px;fill:url(#linearGradient2667);fill-opacity:0.69930103;stroke:#1c2942;stroke-width:8.96854973;stroke-opacity:0.99215698" /> + <path + d="M -54.9317,113.669 L 347.321,224.163 L 346.804,333.491 L -55.046,228.132 L -54.9317,113.669 z" + transform="matrix(-1.6227e-2,1.65668e-2,-1.79088e-4,-6.25738e-2,25.0483,59.5183)" + id="path313" + style="font-size:12px;fill:#ffffff;fill-opacity:0.99215698;stroke:#1c2942;stroke-width:39.17070007;stroke-opacity:0.99215698" /> + <path + d="M -46.2318,305.669 L 141.393,358.659 L 143.013,470.95 L -47.4986,417.316 L -46.2318,305.669 z" + transform="matrix(0.380378,-0.105483,0,0.373757,48.6308,-81.8436)" + id="path412" + style="font-size:12px;fill:url(#linearGradient2669);fill-opacity:0.69930103;stroke:#0c5c7d;stroke-width:6.63037014;stroke-opacity:0.99215698" /> + <path + d="M 147.259,91.7372 L 267.273,92.474 L 265.636,100.679 L 145.264,100.165 L 147.259,91.7372 z" + transform="matrix(0.367419,-2.58761e-3,9.25713e-2,0.528669,-11.381,6.77426)" + id="path414" + style="font-size:12px;fill:#1c2942;fill-opacity:0.99215698;stroke:#0c5d7d;stroke-width:2.5;stroke-opacity:0.98999999" /> + <path + d="M -40.0588,122.695 L 347.321,224.163 L 346.804,333.491 L -40.0941,229.996 L -40.0588,122.695 z" + transform="matrix(-3.37107e-2,6.38003e-2,-3.72046e-4,-0.240978,62.4693,163.387)" + id="path415" + style="font-size:12px;fill:#1c2942;fill-opacity:0.99215698;stroke-width:8.96854973" /> + <path + d="M 147.259,91.7372 L 267.273,92.474 L 265.636,100.679 L 145.264,100.165 L 147.259,91.7372 z" + transform="matrix(0.576626,-4.06098e-3,0.145281,0.829691,-66.2039,-37.2798)" + id="path417" + style="font-size:12px;fill:url(#linearGradient2671);stroke:#580400;stroke-width:2.5;stroke-opacity:0.99215698" /> + <path + d="M 147.259,91.7372 L 267.273,92.474 L 265.636,100.679 L 145.264,100.165 L 147.259,91.7372 z" + transform="matrix(0.367419,-2.58761e-3,9.25713e-2,0.528669,-11.381,16.8689)" + id="path419" + style="font-size:12px;fill:#1c2942;fill-opacity:0.99215698;stroke:#0c5d7d;stroke-width:2.5;stroke-opacity:0.98999999" /> + <path + d="M -54.9317,113.669 L 347.321,224.163 L 346.804,333.491 L -55.046,228.132 L -54.9317,113.669 z" + transform="matrix(-1.6227e-2,1.65668e-2,-1.79088e-4,-6.25738e-2,112.872,59.0136)" + id="path420" + style="font-size:12px;fill:#ffffff;fill-opacity:0.99215698;stroke:#1c2942;stroke-width:39.17070007;stroke-opacity:0.99215698" /> + </g> +</svg> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5004 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5004&view=rev Author: mdboom Date: 2008年03月18日 11:46:07 -0700 (2008年3月18日) Log Message: ----------- Fixing merge error. (Thanks Manuel Metz) Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008年03月18日 18:35:10 UTC (rev 5003) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008年03月18日 18:46:07 UTC (rev 5004) @@ -4188,7 +4188,6 @@ Finally, marker can be (verts, 0), verts is a sequence of (x,y) vertices for a custom scatter symbol. -<<<<<<< .working numsides is the number of sides @@ -4202,9 +4201,6 @@ Finally, marker can be (verts, 0), verts is a sequence of (x,y) vertices for a custom scatter symbol. -======= - ->>>>>>> .merge-right.r4987 s is a size argument in points squared. Any or all of x, y, s, and c may be masked arrays, in which This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5003 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5003&view=rev Author: mdboom Date: 2008年03月18日 11:35:10 -0700 (2008年3月18日) Log Message: ----------- Fixing set_alpha bug when there is no facecolors (thanks Michael Fitzgerald) Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/collections.py Modified: trunk/matplotlib/lib/matplotlib/collections.py =================================================================== --- trunk/matplotlib/lib/matplotlib/collections.py 2008年03月14日 12:22:28 UTC (rev 5002) +++ trunk/matplotlib/lib/matplotlib/collections.py 2008年03月18日 18:35:10 UTC (rev 5003) @@ -153,7 +153,7 @@ if self.have_units(): paths = [] - for path in self._paths: + for path in self.get_paths(): vertices = path.vertices xs, ys = vertices[:, 0], vertices[:, 1] xs = self.convert_xunits(xs) @@ -305,7 +305,8 @@ except TypeError: raise TypeError('alpha must be a float') else: artist.Artist.set_alpha(self, alpha) - self._facecolors[:, 3] = alpha + if len(self._facecolors): + self._facecolors[:, 3] = alpha self._edgecolors[:, 3] = alpha def get_linewidths(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5002 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5002&view=rev Author: dsdale Date: 2008年03月14日 05:22:28 -0700 (2008年3月14日) Log Message: ----------- removed an unnecessary call to FigureCanvasAgg.draw in the qt*agg backends Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/examples/embedding_in_wx.py trunk/matplotlib/lib/matplotlib/backends/backend_qt4agg.py trunk/matplotlib/lib/matplotlib/backends/backend_qtagg.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008年03月13日 16:27:17 UTC (rev 5001) +++ trunk/matplotlib/CHANGELOG 2008年03月14日 12:22:28 UTC (rev 5002) @@ -1,3 +1,7 @@ +2008年03月14日 Removed an apparently unnecessary call to + FigureCanvasAgg.draw in backend_qt*agg. Thanks to Ted + Drain - DSD + 2008年03月10日 Workaround a bug in backend_qt4agg's blitting due to a buffer width/bbox width mismatch in _backend_agg's copy_from_bbox - DSD Modified: trunk/matplotlib/examples/embedding_in_wx.py =================================================================== --- trunk/matplotlib/examples/embedding_in_wx.py 2008年03月13日 16:27:17 UTC (rev 5001) +++ trunk/matplotlib/examples/embedding_in_wx.py 2008年03月14日 12:22:28 UTC (rev 5002) @@ -37,8 +37,6 @@ figure resizable or not. """ -import matplotlib -matplotlib.use('WX') from matplotlib.backends.backend_wx import Toolbar, FigureCanvasWx,\ FigureManager Modified: trunk/matplotlib/lib/matplotlib/backends/backend_qt4agg.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_qt4agg.py 2008年03月13日 16:27:17 UTC (rev 5001) +++ trunk/matplotlib/lib/matplotlib/backends/backend_qt4agg.py 2008年03月14日 12:22:28 UTC (rev 5002) @@ -130,7 +130,6 @@ if DEBUG: print "FigureCanvasQtAgg.draw", self self.replot = True - FigureCanvasAgg.draw(self) self.update() def blit(self, bbox=None): Modified: trunk/matplotlib/lib/matplotlib/backends/backend_qtagg.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_qtagg.py 2008年03月13日 16:27:17 UTC (rev 5001) +++ trunk/matplotlib/lib/matplotlib/backends/backend_qtagg.py 2008年03月14日 12:22:28 UTC (rev 5002) @@ -135,7 +135,6 @@ if DEBUG: print "FigureCanvasQtAgg.draw", self self.replot = True - FigureCanvasAgg.draw(self) self.repaint( False ) def blit(self, bbox=None): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.