From: <md...@us...> - 2009-02-23 15:00:36
|
Revision: 6926 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6926&view=rev Author: mdboom Date: 2009-02-23 15:00:29 +0000 (Mon, 23 Feb 2009) Log Message: ----------- Merged revisions 6920,6925 via svnmerge from https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_98_5_maint ........ r6920 | mmetz_bn | 2009-02-18 09:44:08 -0500 (Wed, 18 Feb 2009) | 1 line Added scatter_hist example ........ r6925 | mdboom | 2009-02-23 09:58:08 -0500 (Mon, 23 Feb 2009) | 2 lines Applied Fernando Perez's fix for LaTeX output. ........ Modified Paths: -------------- trunk/matplotlib/doc/sphinxext/inheritance_diagram.py Property Changed: ---------------- trunk/matplotlib/ trunk/matplotlib/doc/pyplots/README trunk/matplotlib/doc/sphinxext/gen_gallery.py trunk/matplotlib/doc/sphinxext/gen_rst.py trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6918 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6925 Modified: svn:mergeinfo - /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918 + /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925 Property changes on: trunk/matplotlib/doc/pyplots/README ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925 Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918 + /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925 Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918 + /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925 Modified: trunk/matplotlib/doc/sphinxext/inheritance_diagram.py =================================================================== --- trunk/matplotlib/doc/sphinxext/inheritance_diagram.py 2009-02-23 14:58:08 UTC (rev 6925) +++ trunk/matplotlib/doc/sphinxext/inheritance_diagram.py 2009-02-23 15:00:29 UTC (rev 6926) @@ -370,7 +370,7 @@ graph.run_dot(['-Tpdf', '-o%s' % pdf_path], name, parts, graph_options={'size': '"6.0,6.0"'}) - return '\\includegraphics{%s}' % pdf_path + return '\n\\includegraphics{%s}\n\n' % pdf_path def visit_inheritance_diagram(inner_func): """ Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 + /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2009-02-23 17:43:32
|
Revision: 6929 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6929&view=rev Author: mdboom Date: 2009-02-23 17:43:26 +0000 (Mon, 23 Feb 2009) Log Message: ----------- Merged revisions 6927-6928 via svnmerge from https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_98_5_maint ........ r6927 | mdboom | 2009-02-23 12:30:07 -0500 (Mon, 23 Feb 2009) | 2 lines Add credit to Allen Haldane in comments. ........ r6928 | mdboom | 2009-02-23 12:38:35 -0500 (Mon, 23 Feb 2009) | 2 lines C++ standards compliance for use with Sun C++ compiler. These should be equivalent to what was there before on gcc. ........ Modified Paths: -------------- trunk/matplotlib/CXX/Extensions.hxx trunk/matplotlib/agg24/include/agg_alpha_mask_u8.h trunk/matplotlib/src/path_converters.h Property Changed: ---------------- trunk/matplotlib/ trunk/matplotlib/doc/pyplots/README trunk/matplotlib/doc/sphinxext/gen_gallery.py trunk/matplotlib/doc/sphinxext/gen_rst.py Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6925 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6928 Modified: svn:mergeinfo - /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925 + /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928 Modified: trunk/matplotlib/CXX/Extensions.hxx =================================================================== --- trunk/matplotlib/CXX/Extensions.hxx 2009-02-23 17:38:35 UTC (rev 6928) +++ trunk/matplotlib/CXX/Extensions.hxx 2009-02-23 17:43:26 UTC (rev 6929) @@ -203,7 +203,7 @@ { typedef PyObject *(*method_varargs_call_handler_t)( PyObject *_self, PyObject *_args ); typedef PyObject *(*method_keyword_call_handler_t)( PyObject *_self, PyObject *_args, PyObject *_dict ); - }; + } template<class T> class MethodDefExt : public PyMethodDef Modified: trunk/matplotlib/agg24/include/agg_alpha_mask_u8.h =================================================================== --- trunk/matplotlib/agg24/include/agg_alpha_mask_u8.h 2009-02-23 17:38:35 UTC (rev 6928) +++ trunk/matplotlib/agg24/include/agg_alpha_mask_u8.h 2009-02-23 17:43:26 UTC (rev 6929) @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -30,15 +30,15 @@ { static unsigned calculate(const int8u* p) { return *p; } }; - + //=====================================================rgb_to_gray_mask_u8 template<unsigned R, unsigned G, unsigned B> struct rgb_to_gray_mask_u8 { - static unsigned calculate(const int8u* p) - { - return (p[R]*77 + p[G]*150 + p[B]*29) >> 8; + static unsigned calculate(const int8u* p) + { + return (p[R]*77 + p[G]*150 + p[B]*29) >> 8; } }; @@ -50,7 +50,7 @@ typedef int8u cover_type; typedef alpha_mask_u8<Step, Offset, MaskF> self_type; enum cover_scale_e - { + { cover_shift = 8, cover_none = 0, cover_full = 255 @@ -64,12 +64,12 @@ MaskF& mask_function() { return m_mask_function; } const MaskF& mask_function() const { return m_mask_function; } - + //-------------------------------------------------------------------- cover_type pixel(int x, int y) const { - if(x >= 0 && y >= 0 && - x < (int)m_rbuf->width() && + if(x >= 0 && y >= 0 && + x < (int)m_rbuf->width() && y < (int)m_rbuf->height()) { return (cover_type)m_mask_function.calculate( @@ -81,13 +81,13 @@ //-------------------------------------------------------------------- cover_type combine_pixel(int x, int y, cover_type val) const { - if(x >= 0 && y >= 0 && - x < (int)m_rbuf->width() && + if(x >= 0 && y >= 0 && + x < (int)m_rbuf->width() && y < (int)m_rbuf->height()) { - return (cover_type)((cover_full + val * + return (cover_type)((cover_full + val * m_mask_function.calculate( - m_rbuf->row_ptr(y) + x * Step + Offset)) >> + m_rbuf->row_ptr(y) + x * Step + Offset)) >> cover_shift); } return 0; @@ -112,7 +112,7 @@ if(x < 0) { count += x; - if(count <= 0) + if(count <= 0) { memset(dst, 0, num_pix * sizeof(cover_type)); return; @@ -126,7 +126,7 @@ { int rest = x + count - xmax - 1; count -= rest; - if(count <= 0) + if(count <= 0) { memset(dst, 0, num_pix * sizeof(cover_type)); return; @@ -162,7 +162,7 @@ if(x < 0) { count += x; - if(count <= 0) + if(count <= 0) { memset(dst, 0, num_pix * sizeof(cover_type)); return; @@ -176,7 +176,7 @@ { int rest = x + count - xmax - 1; count -= rest; - if(count <= 0) + if(count <= 0) { memset(dst, 0, num_pix * sizeof(cover_type)); return; @@ -187,8 +187,8 @@ const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; do { - *covers = (cover_type)((cover_full + (*covers) * - m_mask_function.calculate(mask)) >> + *covers = (cover_type)((cover_full + (*covers) * + m_mask_function.calculate(mask)) >> cover_shift); ++covers; mask += Step; @@ -214,7 +214,7 @@ if(y < 0) { count += y; - if(count <= 0) + if(count <= 0) { memset(dst, 0, num_pix * sizeof(cover_type)); return; @@ -228,7 +228,7 @@ { int rest = y + count - ymax - 1; count -= rest; - if(count <= 0) + if(count <= 0) { memset(dst, 0, num_pix * sizeof(cover_type)); return; @@ -263,7 +263,7 @@ if(y < 0) { count += y; - if(count <= 0) + if(count <= 0) { memset(dst, 0, num_pix * sizeof(cover_type)); return; @@ -277,7 +277,7 @@ { int rest = y + count - ymax - 1; count -= rest; - if(count <= 0) + if(count <= 0) { memset(dst, 0, num_pix * sizeof(cover_type)); return; @@ -288,8 +288,8 @@ const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; do { - *covers = (cover_type)((cover_full + (*covers) * - m_mask_function.calculate(mask)) >> + *covers = (cover_type)((cover_full + (*covers) * + m_mask_function.calculate(mask)) >> cover_shift); ++covers; mask += m_rbuf->stride(); @@ -302,11 +302,11 @@ alpha_mask_u8(const self_type&); const self_type& operator = (const self_type&); - rendering_buffer* m_rbuf; + agg::rendering_buffer* m_rbuf; MaskF m_mask_function; }; - + typedef alpha_mask_u8<1, 0> alpha_mask_gray8; //----alpha_mask_gray8 typedef alpha_mask_u8<3, 0> alpha_mask_rgb24r; //----alpha_mask_rgb24r @@ -354,7 +354,7 @@ typedef int8u cover_type; typedef amask_no_clip_u8<Step, Offset, MaskF> self_type; enum cover_scale_e - { + { cover_shift = 8, cover_none = 0, cover_full = 255 @@ -376,13 +376,13 @@ m_rbuf->row_ptr(y) + x * Step + Offset); } - + //-------------------------------------------------------------------- cover_type combine_pixel(int x, int y, cover_type val) const { - return (cover_type)((cover_full + val * + return (cover_type)((cover_full + val * m_mask_function.calculate( - m_rbuf->row_ptr(y) + x * Step + Offset)) >> + m_rbuf->row_ptr(y) + x * Step + Offset)) >> cover_shift); } @@ -407,8 +407,8 @@ const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; do { - *dst = (cover_type)((cover_full + (*dst) * - m_mask_function.calculate(mask)) >> + *dst = (cover_type)((cover_full + (*dst) * + m_mask_function.calculate(mask)) >> cover_shift); ++dst; mask += Step; @@ -436,8 +436,8 @@ const int8u* mask = m_rbuf->row_ptr(y) + x * Step + Offset; do { - *dst = (cover_type)((cover_full + (*dst) * - m_mask_function.calculate(mask)) >> + *dst = (cover_type)((cover_full + (*dst) * + m_mask_function.calculate(mask)) >> cover_shift); ++dst; mask += m_rbuf->stride(); @@ -449,11 +449,11 @@ amask_no_clip_u8(const self_type&); const self_type& operator = (const self_type&); - rendering_buffer* m_rbuf; + agg::rendering_buffer* m_rbuf; MaskF m_mask_function; }; - + typedef amask_no_clip_u8<1, 0> amask_no_clip_gray8; //----amask_no_clip_gray8 typedef amask_no_clip_u8<3, 0> amask_no_clip_rgb24r; //----amask_no_clip_rgb24r Property changes on: trunk/matplotlib/doc/pyplots/README ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928 Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925 + /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928 Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925 + /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928 Modified: trunk/matplotlib/src/path_converters.h =================================================================== --- trunk/matplotlib/src/path_converters.h 2009-02-23 17:38:35 UTC (rev 6928) +++ trunk/matplotlib/src/path_converters.h 2009-02-23 17:43:26 UTC (rev 6929) @@ -515,15 +515,15 @@ the last line. Once it gets too big, the lines cannot be combined. */ - /* This code was originally written by someone else (John - Hunter?) and I have modified to work in-place -- meaning - not creating an entirely new path list each time. In order - to do that without too much additional code complexity, it - keeps a small queue around so that multiple points can be - emitted in a single call, and those points will be popped - from the queue in subsequent calls. The following block - will empty the queue before proceeding to the main loop - below. -- Michael Droettboom */ + /* This code was originally written by Allan Haldane and I + have modified to work in-place -- meaning not creating an + entirely new path list each time. In order to do that + without too much additional code complexity, it keeps a + small queue around so that multiple points can be emitted + in a single call, and those points will be popped from the + queue in subsequent calls. The following block will empty + the queue before proceeding to the main loop below. + -- Michael Droettboom */ if (queue_flush(&cmd, x, y)) { return cmd; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2009-02-24 21:15:57
|
Revision: 6931 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6931&view=rev Author: efiring Date: 2009-02-24 21:15:49 +0000 (Tue, 24 Feb 2009) Log Message: ----------- Deleted numerix Modified Paths: -------------- trunk/matplotlib/CHANGELOG Removed Paths: ------------- trunk/matplotlib/lib/matplotlib/numerix/ Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2009-02-24 15:38:33 UTC (rev 6930) +++ trunk/matplotlib/CHANGELOG 2009-02-24 21:15:49 UTC (rev 6931) @@ -1,3 +1,5 @@ +2009-02-25 Remove numerix; it remains in the maintenance branches. - EF + 2009-02-21 Improve scatter argument handling; add an early error message, allow inputs to have more than one dimension. - EF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2009-02-24 23:22:16
|
Revision: 6932 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6932&view=rev Author: efiring Date: 2009-02-24 21:56:19 +0000 (Tue, 24 Feb 2009) Log Message: ----------- Removal of numerix, stage 2. The only vestiges are a couple method names, and a validator with a warning to catch numerix keys in matplotlibrc files. Modified Paths: -------------- trunk/matplotlib/doc/api/api_changes.rst trunk/matplotlib/doc/devel/outline.rst trunk/matplotlib/examples/misc/rc_traits.py trunk/matplotlib/lib/matplotlib/backends/backend_ps.py trunk/matplotlib/lib/matplotlib/config/mplconfig.py trunk/matplotlib/lib/matplotlib/config/rcsetup.py trunk/matplotlib/lib/matplotlib/rcsetup.py trunk/matplotlib/matplotlibrc.template trunk/matplotlib/setup.py trunk/matplotlib/setupext.py trunk/matplotlib/test/mplTest/units/UnitDblConverter.py trunk/matplotlib/test/test_backends/TestAgg.py trunk/matplotlib/unit/agg_memleak.py trunk/matplotlib/unit/ft2font_memleak.py trunk/matplotlib/unit/inside_poly_memleak.py trunk/matplotlib/unit/inside_poly_profile.py Modified: trunk/matplotlib/doc/api/api_changes.rst =================================================================== --- trunk/matplotlib/doc/api/api_changes.rst 2009-02-24 21:15:49 UTC (rev 6931) +++ trunk/matplotlib/doc/api/api_changes.rst 2009-02-24 21:56:19 UTC (rev 6932) @@ -19,11 +19,13 @@ Changes for 0.98.x ================== +* Removed numerix package. + * Added new :func:`matplotlib.image.imsave` and exposed it to the :mod:`matplotlib.pyplot` interface. * Remove support for pyExcelerator in exceltools -- use xlwt - instead + instead * Changed the defaults of acorr and xcorr to use usevlines=True, maxlags=10 and normed=True since these are the best defaults Modified: trunk/matplotlib/doc/devel/outline.rst =================================================================== --- trunk/matplotlib/doc/devel/outline.rst 2009-02-24 21:15:49 UTC (rev 6931) +++ trunk/matplotlib/doc/devel/outline.rst 2009-02-24 21:56:19 UTC (rev 6932) @@ -107,7 +107,6 @@ config/rcsetup Darren needs conversion config/tconfig Darren needs conversion config/verbose Darren needs conversion -numerix/__init__ needs conversion projections/__init__ Mike converted projections/geo Mike converted (not included--experimental) projections/polar Mike converted Modified: trunk/matplotlib/examples/misc/rc_traits.py =================================================================== --- trunk/matplotlib/examples/misc/rc_traits.py 2009-02-24 21:15:49 UTC (rev 6931) +++ trunk/matplotlib/examples/misc/rc_traits.py 2009-02-24 21:56:19 UTC (rev 6932) @@ -131,7 +131,6 @@ class RC(traits.HasTraits): backend = traits.Trait(*backends) - numerix = traits.Trait('Numeric', 'numarray') interactive = flexible_false_trait toolbar = traits.Trait('toolbar2', 'classic', None) timezone = traits.Trait(*timezones) Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2009-02-24 21:15:49 UTC (rev 6931) +++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2009-02-24 21:56:19 UTC (rev 6932) @@ -112,7 +112,7 @@ def seq_allequal(seq1, seq2): """ - seq1 and seq2 are either None or sequences or numerix arrays + seq1 and seq2 are either None or sequences or arrays Return True if both are None or both are seqs with identical elements """ Modified: trunk/matplotlib/lib/matplotlib/config/mplconfig.py =================================================================== --- trunk/matplotlib/lib/matplotlib/config/mplconfig.py 2009-02-24 21:15:49 UTC (rev 6931) +++ trunk/matplotlib/lib/matplotlib/config/mplconfig.py 2009-02-24 21:56:19 UTC (rev 6932) @@ -58,7 +58,6 @@ toolbar = T.Trait('toolbar2', 'toolbar2', None) timezone = T.Trait('UTC', pytz.all_timezones) datapath = T.Trait(cutils.get_data_path()) - numerix = T.Trait('numpy', 'numpy', 'numeric', 'numarray') units = T.false class backend(TConfig): @@ -290,7 +289,6 @@ self.tconfig_map = { 'backend' : (self.tconfig.backend, 'use'), 'backend_fallback' : (self.tconfig.backend, 'fallback'), - 'numerix' : (self.tconfig, 'numerix'), 'toolbar' : (self.tconfig, 'toolbar'), 'datapath' : (self.tconfig, 'datapath'), 'units' : (self.tconfig, 'units'), Modified: trunk/matplotlib/lib/matplotlib/config/rcsetup.py =================================================================== --- trunk/matplotlib/lib/matplotlib/config/rcsetup.py 2009-02-24 21:15:49 UTC (rev 6931) +++ trunk/matplotlib/lib/matplotlib/config/rcsetup.py 2009-02-24 21:56:19 UTC (rev 6932) @@ -75,10 +75,6 @@ 'QtAgg', 'Qt4Agg', 'SVG', 'Template', 'TkAgg', 'WX', 'WXAgg', ], ignorecase=True) -validate_numerix = ValidateInStrings('numerix',[ - 'Numeric','numarray','numpy', - ], ignorecase=True) - validate_toolbar = ValidateInStrings('toolbar',[ 'None','classic','toolbar2', ], ignorecase=True) @@ -298,7 +294,6 @@ # a map from key -> value, converter defaultParams = { 'backend' : ['WXAgg', validate_backend], - 'numerix' : ['numpy', validate_numerix], 'toolbar' : ['toolbar2', validate_toolbar], 'datapath' : [None, validate_path_exists], # handled by _get_data_path_cached 'units' : [False, validate_bool], Modified: trunk/matplotlib/lib/matplotlib/rcsetup.py =================================================================== --- trunk/matplotlib/lib/matplotlib/rcsetup.py 2009-02-24 21:15:49 UTC (rev 6931) +++ trunk/matplotlib/lib/matplotlib/rcsetup.py 2009-02-24 21:56:19 UTC (rev 6932) @@ -106,10 +106,18 @@ if s.startswith('module://'): return s else: return _validate_standard_backends(s) -validate_numerix = ValidateInStrings('numerix',[ - 'Numeric','numarray','numpy', - ], ignorecase=True) +def validate_numerix(v): + # 2009/02/24: start warning; later, remove all traces + try: + if v == 'obsolete': + return v + except ValueError: + pass + warnings.warn('rcParams key "numerix" is obsolete and has no effect;\n' + ' please delete it from your matplotlibrc file') + + validate_toolbar = ValidateInStrings('toolbar',[ 'None','classic','toolbar2', ], ignorecase=True) @@ -323,7 +331,7 @@ defaultParams = { 'backend' : ['Agg', validate_backend], # agg is certainly present 'backend_fallback' : [True, validate_bool], # agg is certainly present - 'numerix' : ['numpy', validate_numerix], + 'numerix' : ['obsolete', validate_numerix], 'maskedarray' : ['obsolete', validate_maskedarray], #to be removed 'toolbar' : ['toolbar2', validate_toolbar], 'datapath' : [None, validate_path_exists], # handled by _get_data_path_cached Modified: trunk/matplotlib/matplotlibrc.template =================================================================== --- trunk/matplotlib/matplotlibrc.template 2009-02-24 21:15:49 UTC (rev 6931) +++ trunk/matplotlib/matplotlibrc.template 2009-02-24 21:56:19 UTC (rev 6932) @@ -34,7 +34,6 @@ # conflicts, we will automatically try and find a compatible one for # you if backend_fallback is True #backend_fallback: True -numerix : %(numerix)s # numpy, Numeric or numarray #interactive : False #toolbar : toolbar2 # None | classic | toolbar2 #timezone : UTC # a pytz timezone string, eg US/Central or Europe/Paris Modified: trunk/matplotlib/setup.py =================================================================== --- trunk/matplotlib/setup.py 2009-02-24 21:15:49 UTC (rev 6931) +++ trunk/matplotlib/setup.py 2009-02-24 21:56:19 UTC (rev 6932) @@ -18,7 +18,7 @@ # This dict will be updated as we try to select the best option during # the build process. However, values in setup.cfg will be used, if # defined. -rc = {'backend':'Agg', 'numerix':'numpy'} +rc = {'backend':'Agg'} # BEFORE importing disutils, remove MANIFEST. distutils doesn't properly # update it when the contents of directories change. @@ -52,13 +52,6 @@ 'matplotlib.projections', # 'matplotlib.toolkits', 'mpl_toolkits', - 'matplotlib.numerix', - 'matplotlib.numerix.mlab', - 'matplotlib.numerix.ma', - 'matplotlib.numerix.npyma', - 'matplotlib.numerix.linear_algebra', - 'matplotlib.numerix.random_array', - 'matplotlib.numerix.fft', 'matplotlib.sphinxext' ] @@ -224,14 +217,12 @@ # Write the default matplotlibrc file if options['backend']: rc['backend'] = options['backend'] -if options['numerix']: rc['numerix'] = options['numerix'] template = file('matplotlibrc.template').read() file('lib/matplotlib/mpl-data/matplotlibrc', 'w').write(template%rc) # Write the default matplotlib.conf file template = file('lib/matplotlib/mpl-data/matplotlib.conf.template').read() template = template.replace("datapath = ", "#datapath = ") -template = template.replace("numerix = 'numpy'", "numerix = '%s'"%rc['numerix']) template = template.replace(" use = 'Agg'", " use = '%s'"%rc['backend']) file('lib/matplotlib/mpl-data/matplotlib.conf', 'w').write(template) Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2009-02-24 21:15:49 UTC (rev 6931) +++ trunk/matplotlib/setupext.py 2009-02-24 21:56:19 UTC (rev 6932) @@ -106,8 +106,7 @@ 'build_macosx': 'auto', 'build_image': True, 'build_windowing': True, - 'backend': None, - 'numerix': None} + 'backend': None} # Based on the contents of setup.cfg, determine the build options if os.path.exists("setup.cfg"): @@ -142,10 +141,7 @@ try: options['backend'] = config.get("rc_options", "backend") except: pass - try: options['numerix'] = config.get("rc_options", "numerix") - except: pass - if options['display_status']: def print_line(char='='): print char * 76 Modified: trunk/matplotlib/test/mplTest/units/UnitDblConverter.py =================================================================== --- trunk/matplotlib/test/mplTest/units/UnitDblConverter.py 2009-02-24 21:15:49 UTC (rev 6931) +++ trunk/matplotlib/test/mplTest/units/UnitDblConverter.py 2009-02-24 21:56:19 UTC (rev 6932) @@ -9,9 +9,9 @@ #=========================================================================== # Place all imports after here. # +import numpy as np import matplotlib.units as units import matplotlib.ticker as ticker -import matplotlib.numerix as nx import matplotlib.projections.polar as polar from matplotlib.cbook import iterable # @@ -27,7 +27,7 @@ # This was copied from matplotlib example code. def rad_fn(x, pos = None ): """Radian function formatter.""" - n = int((x / nx.pi) * 2.0 + 0.25) + n = int((x / np.pi) * 2.0 + 0.25) if n == 0: return str(x) elif n == 1: Modified: trunk/matplotlib/test/test_backends/TestAgg.py =================================================================== --- trunk/matplotlib/test/test_backends/TestAgg.py 2009-02-24 21:15:49 UTC (rev 6931) +++ trunk/matplotlib/test/test_backends/TestAgg.py 2009-02-24 21:56:19 UTC (rev 6932) @@ -11,7 +11,7 @@ import sys, time, os from matplotlib.ft2font import FT2Font -from matplotlib.numerix import rand +from numpy.random import rand from matplotlib.backend_bases import GraphicsContextBase from matplotlib.backends._backend_agg import RendererAgg @@ -89,7 +89,7 @@ font.set_size( 12, 72 ) o.draw_text_image( font.get_image(), 30, 40, gc ) - + o.write_png( fname % i ) val = report_memory( i ) if i==1: start = val Modified: trunk/matplotlib/unit/agg_memleak.py =================================================================== --- trunk/matplotlib/unit/agg_memleak.py 2009-02-24 21:15:49 UTC (rev 6931) +++ trunk/matplotlib/unit/agg_memleak.py 2009-02-24 21:56:19 UTC (rev 6932) @@ -1,6 +1,10 @@ +""" +And another broken test... +""" + import sys, time, os from matplotlib.ft2font import FT2Font -from matplotlib.numerix import rand +from numpy.random import rand from matplotlib.backend_bases import GraphicsContextBase from matplotlib.backends._backend_agg import RendererAgg @@ -23,7 +27,7 @@ ys = [400*int(rand()) for k in range(8)] rgb = (1,0,0) pnts = zip(xs, ys) - o.draw_polygon(gc, rgb, pnts) + o.draw_polygon(gc, rgb, pnts) # no such method?? o.draw_polygon(gc, None, pnts) for j in range(50): Modified: trunk/matplotlib/unit/ft2font_memleak.py =================================================================== --- trunk/matplotlib/unit/ft2font_memleak.py 2009-02-24 21:15:49 UTC (rev 6931) +++ trunk/matplotlib/unit/ft2font_memleak.py 2009-02-24 21:56:19 UTC (rev 6932) @@ -1,7 +1,10 @@ +""" +This appears to be obsolete as of 2009/02/24; a key import fails. +""" import sys, time, os -from matplotlib.numerix import rand +from numpy.random import rand from matplotlib.ft2font import FT2Font -from matplotlib.backends.backend_ps import encodeTTFasPS +from matplotlib.backends.backend_ps import encodeTTFasPS # doesn't exist... fname = '/usr/local/share/matplotlib/Vera.ttf' Modified: trunk/matplotlib/unit/inside_poly_memleak.py =================================================================== --- trunk/matplotlib/unit/inside_poly_memleak.py 2009-02-24 21:15:49 UTC (rev 6931) +++ trunk/matplotlib/unit/inside_poly_memleak.py 2009-02-24 21:56:19 UTC (rev 6932) @@ -1,8 +1,11 @@ #!/usr/bin/env python +""" +Another broken test... +""" import os, sys, time import matplotlib.nxutils as nxutils -import matplotlib.numerix as nx +from numpy.random import rand def report_memory(i): pid = os.getpid() @@ -14,12 +17,12 @@ for i in range(500): report_memory(i) - verts = nx.mlab.rand(100, 2) - b = nxutils.pnpoly(x, y, verts) + verts = rand(100, 2) + b = nxutils.pnpoly(x, y, verts) # x, y don't exist for i in range(500): report_memory(i) - verts = nx.mlab.rand(100, 2) - points = nx.mlab.rand(10000,2) + verts = rand(100, 2) + points = rand(10000,2) mask = nxutils.points_inside_poly(points, verts) Modified: trunk/matplotlib/unit/inside_poly_profile.py =================================================================== --- trunk/matplotlib/unit/inside_poly_profile.py 2009-02-24 21:15:49 UTC (rev 6931) +++ trunk/matplotlib/unit/inside_poly_profile.py 2009-02-24 21:56:19 UTC (rev 6932) @@ -1,7 +1,11 @@ +""" +Broken. +""" + import os, sys, time import matplotlib.nxutils as nxutils -import matplotlib.numerix as nx +from numpy.random import rand import matplotlib.mlab import matplotlib.patches as patches if 1: @@ -10,13 +14,14 @@ t0 = time.time() for i in range(numtrials): - points = nx.mlab.rand(numpoints,2) + points = rand(numpoints,2) mask = matplotlib.mlab._inside_poly_deprecated(points, verts) + ### no such thing told = time.time() - t0 t0 = time.time() for i in range(numtrials): - points = nx.mlab.rand(numpoints,2) + points = rand(numpoints,2) mask = nxutils.points_inside_poly(points, verts) tnew = time.time() - t0 print numverts, numpoints, told, tnew, told/tnew This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2009-02-25 07:37:02
|
Revision: 6933 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6933&view=rev Author: efiring Date: 2009-02-25 07:36:55 +0000 (Wed, 25 Feb 2009) Log Message: ----------- Restore a stripped-down numerix with a deprecation warning. Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/setup.py Added Paths: ----------- trunk/matplotlib/lib/matplotlib/numerix/ trunk/matplotlib/lib/matplotlib/numerix/__init__.py trunk/matplotlib/lib/matplotlib/numerix/_sp_imports.py trunk/matplotlib/lib/matplotlib/numerix/fft/ trunk/matplotlib/lib/matplotlib/numerix/fft/__init__.py trunk/matplotlib/lib/matplotlib/numerix/linear_algebra/ trunk/matplotlib/lib/matplotlib/numerix/linear_algebra/__init__.py trunk/matplotlib/lib/matplotlib/numerix/ma/ trunk/matplotlib/lib/matplotlib/numerix/ma/__init__.py trunk/matplotlib/lib/matplotlib/numerix/mlab/ trunk/matplotlib/lib/matplotlib/numerix/mlab/__init__.py trunk/matplotlib/lib/matplotlib/numerix/random_array/ trunk/matplotlib/lib/matplotlib/numerix/random_array/__init__.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2009-02-24 21:56:19 UTC (rev 6932) +++ trunk/matplotlib/CHANGELOG 2009-02-25 07:36:55 UTC (rev 6933) @@ -1,4 +1,5 @@ -2009-02-25 Remove numerix; it remains in the maintenance branches. - EF +2009-02-25 Deprecate numerix, and strip out all but the numpy + part of the code. - EF 2009-02-21 Improve scatter argument handling; add an early error message, allow inputs to have more than one dimension. - EF Added: trunk/matplotlib/lib/matplotlib/numerix/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/numerix/__init__.py (rev 0) +++ trunk/matplotlib/lib/matplotlib/numerix/__init__.py 2009-02-25 07:36:55 UTC (rev 6933) @@ -0,0 +1,84 @@ +""" +numerix imports numpy with some compatibility adjustments for old +code that had been based on Numeric. + +It is deprecated and will go away soon. +""" + +import sys, os, struct +from matplotlib import rcParams, verbose + +import warnings +msg = """ +********************************************************** +matplotlib.numerix and all its subpackages are deprecated. +They will be removed soon. Please use numpy instead. +********************************************************** +""" +warnings.warn(msg, DeprecationWarning) + +which = "numpy", "defaulted" # This is now the only choice + +try: + import numpy.oldnumeric as numpy + from numpy.oldnumeric import * +except ImportError: + import numpy + from numpy import * + print 'except asarray', asarray +from _sp_imports import nx, infinity, rand, randn, isnan, all, any +from _sp_imports import UInt8, UInt16, UInt32, Infinity +try: + from numpy.oldnumeric.matrix import Matrix +except ImportError: + Matrix = matrix +version = 'numpy %s' % numpy.__version__ +from numpy import nan + + +from mlab import amin, amax +newaxis = NewAxis +from numpy import angle +def typecode(a): + return a.dtype.char +def iscontiguous(a): + return a.flags.contiguous +def byteswapped(a): + return a.byteswap() +def itemsize(a): + return a.itemsize + +verbose.report('numerix %s'%version) +# a bug fix for blas numeric suggested by Fernando Perez +matrixmultiply=dot +asum = sum + + +def _import_fail_message(module, version): + """Prints a message when the array package specific version of an extension + fails to import correctly. + """ + _dict = { "which" : which[0], + "module" : module, + "specific" : version + module + } + print """ +The import of the %(which)s version of the %(module)s module, +%(specific)s, failed. This is is either because %(which)s was +unavailable when matplotlib was compiled, because a dependency of +%(specific)s could not be satisfied, or because the build flag for +this module was turned off in setup.py. If it appears that +%(specific)s was not built, make sure you have a working copy of +%(which)s and then re-install matplotlib. Otherwise, the following +traceback gives more details:\n""" % _dict + +g = globals() +l = locals() +__import__('ma', g, l) +__import__('fft', g, l) +__import__('linear_algebra', g, l) +__import__('random_array', g, l) +__import__('mlab', g, l) + +la = linear_algebra +ra = random_array Added: trunk/matplotlib/lib/matplotlib/numerix/_sp_imports.py =================================================================== --- trunk/matplotlib/lib/matplotlib/numerix/_sp_imports.py (rev 0) +++ trunk/matplotlib/lib/matplotlib/numerix/_sp_imports.py 2009-02-25 07:36:55 UTC (rev 6933) @@ -0,0 +1,34 @@ +try: + from numpy.oldnumeric import Int8, UInt8, \ + Int16, UInt16, \ + Int32, UInt32, \ + Float32, Float64, \ + Complex32, Complex64, \ + Float, Int, Complex +except ImportError: + from numpy import Int8, UInt8, \ + Int16, UInt16, \ + Int32, UInt32, \ + Float32, Float64, \ + Complex32, Complex64, \ + Float, Int, Complex + +class _TypeNamespace: + """Numeric compatible type aliases for use with extension functions.""" + Int8 = Int8 + UInt8 = UInt8 + Int16 = Int16 + UInt16 = UInt16 + Int32 = Int32 + UInt32 = UInt32 + Float32 = Float32 + Float64 = Float64 + Complex32 = Complex32 + Complex64 = Complex64 + +nx = _TypeNamespace() + +from numpy import inf, infty, Infinity +from numpy.random import rand, randn +infinity = Infinity +from numpy import all, isnan, any Added: trunk/matplotlib/lib/matplotlib/numerix/fft/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/numerix/fft/__init__.py (rev 0) +++ trunk/matplotlib/lib/matplotlib/numerix/fft/__init__.py 2009-02-25 07:36:55 UTC (rev 6933) @@ -0,0 +1,4 @@ +try: + from numpy.oldnumeric.fft import * +except ImportError: + from numpy.dft.old import * Added: trunk/matplotlib/lib/matplotlib/numerix/linear_algebra/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/numerix/linear_algebra/__init__.py (rev 0) +++ trunk/matplotlib/lib/matplotlib/numerix/linear_algebra/__init__.py 2009-02-25 07:36:55 UTC (rev 6933) @@ -0,0 +1,4 @@ +try: + from numpy.oldnumeric.linear_algebra import * +except ImportError: + from numpy.linalg.old import * Added: trunk/matplotlib/lib/matplotlib/numerix/ma/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/numerix/ma/__init__.py (rev 0) +++ trunk/matplotlib/lib/matplotlib/numerix/ma/__init__.py 2009-02-25 07:36:55 UTC (rev 6933) @@ -0,0 +1,9 @@ +try: + from numpy.ma import * # numpy 1.05 and later +except ImportError: + from numpy.core.ma import * # earlier +def getmaskorNone(obj): + _msk = getmask(obj) + if _msk is nomask: + return None + return _msk Added: trunk/matplotlib/lib/matplotlib/numerix/mlab/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/numerix/mlab/__init__.py (rev 0) +++ trunk/matplotlib/lib/matplotlib/numerix/mlab/__init__.py 2009-02-25 07:36:55 UTC (rev 6933) @@ -0,0 +1,7 @@ +try: + from numpy.oldnumeric.mlab import * +except ImportError: + from numpy.lib.mlab import * + +amin = min +amax = max Added: trunk/matplotlib/lib/matplotlib/numerix/random_array/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/numerix/random_array/__init__.py (rev 0) +++ trunk/matplotlib/lib/matplotlib/numerix/random_array/__init__.py 2009-02-25 07:36:55 UTC (rev 6933) @@ -0,0 +1,4 @@ +try: + from numpy.oldnumeric.random_array import * +except ImportError: + from numpy.random import * Modified: trunk/matplotlib/setup.py =================================================================== --- trunk/matplotlib/setup.py 2009-02-24 21:56:19 UTC (rev 6932) +++ trunk/matplotlib/setup.py 2009-02-25 07:36:55 UTC (rev 6933) @@ -52,7 +52,15 @@ 'matplotlib.projections', # 'matplotlib.toolkits', 'mpl_toolkits', - 'matplotlib.sphinxext' + 'matplotlib.sphinxext', + # The following are deprecated and will be removed. + 'matplotlib.numerix', + 'matplotlib.numerix.mlab', + 'matplotlib.numerix.ma', + 'matplotlib.numerix.linear_algebra', + 'matplotlib.numerix.random_array', + 'matplotlib.numerix.fft', + ] py_modules = ['pylab'] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2009-02-25 15:46:04
|
Revision: 6935 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6935&view=rev Author: mdboom Date: 2009-02-25 15:45:45 +0000 (Wed, 25 Feb 2009) Log Message: ----------- Merged revisions 6934 via svnmerge from https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_98_5_maint ........ r6934 | mdboom | 2009-02-25 10:39:34 -0500 (Wed, 25 Feb 2009) | 2 lines Fix crashes with empty data and step draw style. ........ Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/lines.py Property Changed: ---------------- trunk/matplotlib/ trunk/matplotlib/doc/pyplots/README trunk/matplotlib/doc/sphinxext/gen_gallery.py trunk/matplotlib/doc/sphinxext/gen_rst.py trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6928 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6934 Modified: svn:mergeinfo - /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928 + /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934 Property changes on: trunk/matplotlib/doc/pyplots/README ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934 Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928 + /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934 Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928 + /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934 Modified: trunk/matplotlib/lib/matplotlib/lines.py =================================================================== --- trunk/matplotlib/lib/matplotlib/lines.py 2009-02-25 15:39:34 UTC (rev 6934) +++ trunk/matplotlib/lib/matplotlib/lines.py 2009-02-25 15:45:45 UTC (rev 6935) @@ -486,10 +486,11 @@ funcname = self._lineStyles.get(self._linestyle, '_draw_nothing') if funcname != '_draw_nothing': tpath, affine = self._transformed_path.get_transformed_path_and_affine() - self._lineFunc = getattr(self, funcname) - funcname = self.drawStyles.get(self._drawstyle, '_draw_lines') - drawFunc = getattr(self, funcname) - drawFunc(renderer, gc, tpath, affine.frozen()) + if len(tpath.vertices): + self._lineFunc = getattr(self, funcname) + funcname = self.drawStyles.get(self._drawstyle, '_draw_lines') + drawFunc = getattr(self, funcname) + drawFunc(renderer, gc, tpath, affine.frozen()) if self._marker is not None: gc = renderer.new_gc() @@ -500,25 +501,25 @@ funcname = self._markers.get(self._marker, '_draw_nothing') if funcname != '_draw_nothing': tpath, affine = self._transformed_path.get_transformed_points_and_affine() - - # subsample the markers if markevery is not None - markevery = self.get_markevery() - if markevery is not None: - if iterable(markevery): - startind, stride = markevery + if len(tpath.vertices): + # subsample the markers if markevery is not None + markevery = self.get_markevery() + if markevery is not None: + if iterable(markevery): + startind, stride = markevery + else: + startind, stride = 0, markevery + if tpath.codes is not None: + codes = tpath.codes[startind::stride] + else: + codes = None + vertices = tpath.vertices[startind::stride] + subsampled = Path(vertices, codes) else: - startind, stride = 0, markevery - if tpath.codes is not None: - codes = tpath.codes[startind::stride] - else: - codes = None - vertices = tpath.vertices[startind::stride] - subsampled = Path(vertices, codes) - else: - subsampled = tpath + subsampled = tpath - markerFunc = getattr(self, funcname) - markerFunc(renderer, gc, subsampled, affine.frozen()) + markerFunc = getattr(self, funcname) + markerFunc(renderer, gc, subsampled, affine.frozen()) renderer.close_group('line2d') Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925 + /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2009-02-26 00:12:45
|
Revision: 6936 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6936&view=rev Author: efiring Date: 2009-02-26 00:12:33 +0000 (Thu, 26 Feb 2009) Log Message: ----------- Improve tick location subsetting in FixedLocator. Now it includes zero, if present. Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/ticker.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2009-02-25 15:45:45 UTC (rev 6935) +++ trunk/matplotlib/CHANGELOG 2009-02-26 00:12:33 UTC (rev 6936) @@ -1,4 +1,6 @@ -2009-02-25 Deprecate numerix, and strip out all but the numpy +2009-02-25 Improve tick location subset choice in FixedLocator. - EF + +2009-02-24 Deprecate numerix, and strip out all but the numpy part of the code. - EF 2009-02-21 Improve scatter argument handling; add an early error Modified: trunk/matplotlib/lib/matplotlib/ticker.py =================================================================== --- trunk/matplotlib/lib/matplotlib/ticker.py 2009-02-25 15:45:45 UTC (rev 6935) +++ trunk/matplotlib/lib/matplotlib/ticker.py 2009-02-26 00:12:33 UTC (rev 6936) @@ -708,10 +708,14 @@ Tick locations are fixed. If nbins is not None, the array of possible positions will be subsampled to keep the number of ticks <= nbins +1. + The subsampling will be done so as to include the smallest + absolute value; for example, if zero is included in the + array of possibilities, then it is guaranteed to be one of + the chosen ticks. """ def __init__(self, locs, nbins=None): - self.locs = locs + self.locs = np.asarray(locs) self.nbins = nbins if self.nbins is not None: self.nbins = max(self.nbins, 2) @@ -721,7 +725,12 @@ if self.nbins is None: return self.locs step = max(int(0.99 + len(self.locs) / float(self.nbins)), 1) - return self.locs[::step] + ticks = self.locs[::step] + for i in range(1,step): + ticks1 = self.locs[i::step] + if np.absolute(ticks1).min() < np.absolute(ticks).min(): + ticks = ticks1 + return ticks This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-02-26 19:44:35
|
Revision: 6937 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6937&view=rev Author: jouni Date: 2009-02-26 19:44:30 +0000 (Thu, 26 Feb 2009) Log Message: ----------- Support image clipping in the pdf backend Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2009-02-26 00:12:33 UTC (rev 6936) +++ trunk/matplotlib/CHANGELOG 2009-02-26 19:44:30 UTC (rev 6937) @@ -1,3 +1,5 @@ +2009-02-26 Support image clipping in pdf backend. - JKS + 2009-02-25 Improve tick location subset choice in FixedLocator. - EF 2009-02-24 Deprecate numerix, and strip out all but the numpy Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2009-02-26 00:12:33 UTC (rev 6936) +++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2009-02-26 19:44:30 UTC (rev 6937) @@ -39,7 +39,7 @@ from matplotlib.ft2font import FT2Font, FIXED_WIDTH, ITALIC, LOAD_NO_SCALE, \ LOAD_NO_HINTING, KERNING_UNFITTED from matplotlib.mathtext import MathTextParser -from matplotlib.transforms import Affine2D, Bbox, BboxBase +from matplotlib.transforms import Affine2D, Bbox, BboxBase, TransformedPath from matplotlib.path import Path from matplotlib import ttconv @@ -1268,10 +1268,12 @@ return self.image_dpi/72.0 def draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None): - # MGDTODO: Support clippath here gc = self.new_gc() if bbox is not None: gc.set_clip_rectangle(bbox) + if clippath is not None: + clippath = TransformedPath(clippath, clippath_trans) + gc.set_clip_path(clippath) self.check_gc(gc) h, w = im.get_size_out() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lee...@us...> - 2009-02-26 20:12:43
|
Revision: 6939 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6939&view=rev Author: leejjoon Date: 2009-02-26 20:12:38 +0000 (Thu, 26 Feb 2009) Log Message: ----------- Add optional bbox_to_anchor argument for legend class Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/examples/pylab_examples/legend_demo3.py trunk/matplotlib/lib/matplotlib/legend.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2009-02-26 19:54:48 UTC (rev 6938) +++ trunk/matplotlib/CHANGELOG 2009-02-26 20:12:38 UTC (rev 6939) @@ -1,3 +1,5 @@ +2009-02-26 Add optional bbox_to_anchor argument for legend class - JJL + 2009-02-26 Support image clipping in pdf backend. - JKS 2009-02-25 Improve tick location subset choice in FixedLocator. - EF Modified: trunk/matplotlib/examples/pylab_examples/legend_demo3.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/legend_demo3.py 2009-02-26 19:54:48 UTC (rev 6938) +++ trunk/matplotlib/examples/pylab_examples/legend_demo3.py 2009-02-26 20:12:38 UTC (rev 6939) @@ -3,7 +3,6 @@ matplotlib.rcParams['legend.fancybox'] = True import matplotlib.pyplot as plt import numpy as np -import pylab def myplot(ax): t1 = np.arange(0.0, 1.0, 0.1) @@ -18,7 +17,8 @@ ax2 = plt.subplot(3,1,2) myplot(ax2) -ax2.legend(loc=1, ncol=2, shadow=True, title="Legend") +ax2.legend(loc="center left", bbox_to_anchor=[0.5, 0.5], + ncol=2, shadow=True, title="Legend") ax2.get_legend().get_title().set_color("red") ax3 = plt.subplot(3,1,3) @@ -26,8 +26,6 @@ ax3.legend(loc=1, ncol=4, mode="expand", shadow=True) -#title('Damped oscillation') - plt.draw() plt.show() Modified: trunk/matplotlib/lib/matplotlib/legend.py =================================================================== --- trunk/matplotlib/lib/matplotlib/legend.py 2009-02-26 19:54:48 UTC (rev 6938) +++ trunk/matplotlib/lib/matplotlib/legend.py 2009-02-26 20:12:38 UTC (rev 6939) @@ -32,7 +32,7 @@ from matplotlib.lines import Line2D from matplotlib.patches import Patch, Rectangle, Shadow, FancyBboxPatch from matplotlib.collections import LineCollection, RegularPolyCollection -from matplotlib.transforms import Bbox +from matplotlib.transforms import Bbox, TransformedBbox, BboxTransformTo from matplotlib.offsetbox import HPacker, VPacker, TextArea, DrawingArea @@ -112,6 +112,7 @@ fancybox=None, # True use a fancy box, false use a rounded box, none use rc shadow = None, title = None, # set a title for the legend + bbox_to_anchor = None, # bbox thaw the legend will be anchored. ): """ - *parent* : the artist that contains the legend @@ -137,6 +138,7 @@ borderaxespad the pad between the axes and legend border columnspacing the spacing between columns title the legend title + bbox_to_anchor the bbox that the legend will be anchored. ================ ================================================================== The dimensions of pad and spacing are given as a fraction of the @@ -249,7 +251,8 @@ self._loc = loc self._mode = mode - + self.set_bbox_to_anchor(bbox_to_anchor) + # We use FancyBboxPatch to draw a legend frame. The location # and size of the box will be updated during the drawing time. self.legendPatch = FancyBboxPatch( @@ -294,6 +297,7 @@ a.set_transform(self.get_transform()) + def _findoffset_best(self, width, height, xdescent, ydescent, renderer): "Heper function to locate the legend at its best position" ox, oy = self._find_best_position(width, height, renderer) @@ -305,11 +309,11 @@ if iterable(self._loc) and len(self._loc)==2: # when loc is a tuple of axes(or figure) coordinates. fx, fy = self._loc - bbox = self.parent.bbox + bbox = self.get_bbox_to_anchor() x, y = bbox.x0 + bbox.width * fx, bbox.y0 + bbox.height * fy else: bbox = Bbox.from_bounds(0, 0, width, height) - x, y = self._get_anchored_bbox(self._loc, bbox, self.parent.bbox, renderer) + x, y = self._get_anchored_bbox(self._loc, bbox, self.get_bbox_to_anchor(), renderer) return x+xdescent, y+ydescent @@ -340,7 +344,7 @@ # width of the paret (minus pads) if self._mode in ["expand"]: pad = 2*(self.borderaxespad+self.borderpad)*fontsize - self._legend_box.set_width(self.parent.bbox.width-pad) + self._legend_box.set_width(self.get_bbox_to_anchor().width-pad) if self._drawFrame: # update the location and size of the legend @@ -671,6 +675,48 @@ return self.legendPatch.get_window_extent() + def get_bbox_to_anchor(self): + """ + return the bbox that the legend will be anchored + """ + if self._bbox_to_anchor is None: + return self.parent.bbox + else: + return self._bbox_to_anchor + + + def set_bbox_to_anchor(self, bbox, transform=None): + """ + set the bbox that the legend will be anchored. + + *bbox* can be a Bbox instance, a list of [left, bottom, width, + height] in normalized axes coordinate, or a list of [left, + bottom] where the width and height will be assumed to be zero. + """ + if bbox is None: + self._bbox_to_anchor = None + return + elif isinstance(bbox, Bbox): + self._bbox_to_anchor = bbox + else: + try: + l = len(bbox) + except TypeError: + raise ValueError("Invalid argument for bbox : %s" % str(bbox)) + + if l == 2: + bbox = [bbox[0], bbox[1], 0, 0] + + self._bbox_to_anchor = Bbox.from_bounds(*bbox) + + if transform is None: + transform = BboxTransformTo(self.parent.bbox) + + self._bbox_to_anchor = TransformedBbox(self._bbox_to_anchor, + transform) + + + def _get_anchored_bbox(self, loc, bbox, parentbbox, renderer): """ Place the *bbox* inside the *parentbbox* according to a given @@ -719,7 +765,8 @@ verts, bboxes, lines = self._auto_legend_data() bbox = Bbox.from_bounds(0, 0, width, height) - consider = [self._get_anchored_bbox(x, bbox, self.parent.bbox, renderer) for x in range(1, len(self.codes))] + consider = [self._get_anchored_bbox(x, bbox, self.get_bbox_to_anchor(), + renderer) for x in range(1, len(self.codes))] #tx, ty = self.legendPatch.get_x(), self.legendPatch.get_y() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2009-02-27 13:34:55
|
Revision: 6942 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6942&view=rev Author: mdboom Date: 2009-02-27 13:32:10 +0000 (Fri, 27 Feb 2009) Log Message: ----------- Merged revisions 6941 via svnmerge from https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_98_5_maint ........ r6941 | mdboom | 2009-02-27 08:30:13 -0500 (Fri, 27 Feb 2009) | 2 lines Fix glyph alignment with STIX mathtext ........ Modified Paths: -------------- trunk/matplotlib/src/ft2font.cpp Property Changed: ---------------- trunk/matplotlib/ trunk/matplotlib/doc/pyplots/README trunk/matplotlib/doc/sphinxext/gen_gallery.py trunk/matplotlib/doc/sphinxext/gen_rst.py trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6938 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6941 Modified: svn:mergeinfo - /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934 + /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941 Property changes on: trunk/matplotlib/doc/pyplots/README ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941 Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934 + /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941 Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934 + /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934 + /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941 Modified: trunk/matplotlib/src/ft2font.cpp =================================================================== --- trunk/matplotlib/src/ft2font.cpp 2009-02-27 13:30:13 UTC (rev 6941) +++ trunk/matplotlib/src/ft2font.cpp 2009-02-27 13:32:10 UTC (rev 6942) @@ -1255,8 +1255,14 @@ throw Py::TypeError("Usage: draw_glyph_to_bitmap(bitmap, x,y,glyph)"); FT2Image* im = static_cast<FT2Image*>(args[0].ptr()); - long x = Py::Int(args[1]); - long y = Py::Int(args[2]); + double xd = Py::Float(args[1]); + double yd = Py::Float(args[2]); + long x = (long)mpl_round(xd); + long y = (long)mpl_round(yd); + FT_Vector sub_offset; + sub_offset.x = int((xd - (double)x) * 64.0); + sub_offset.y = int((yd - (double)y) * 64.0); + if (!Glyph::check(args[3].ptr())) throw Py::TypeError("Usage: draw_glyph_to_bitmap(bitmap, x,y,glyph)"); Glyph* glyph = static_cast<Glyph*>(args[3].ptr()); @@ -1266,7 +1272,7 @@ error = FT_Glyph_To_Bitmap(&glyphs[glyph->glyphInd], ft_render_mode_normal, - 0, //no additional translation + &sub_offset, //no additional translation 1 //destroy image; ); if (error) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2009-02-28 18:51:46
|
Revision: 6944 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6944&view=rev Author: efiring Date: 2009-02-28 18:51:37 +0000 (Sat, 28 Feb 2009) Log Message: ----------- Prevent double-rendering of shared axis in twinx, twiny Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2009-02-28 07:46:14 UTC (rev 6943) +++ trunk/matplotlib/CHANGELOG 2009-02-28 18:51:37 UTC (rev 6944) @@ -1,3 +1,5 @@ +2009-02-28 Prevent double-rendering of shared axis in twinx, twiny - EF + 2009-02-26 Add optional bbox_to_anchor argument for legend class - JJL 2009-02-26 Support image clipping in pdf backend. - JKS Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2009-02-28 07:46:14 UTC (rev 6943) +++ trunk/matplotlib/lib/matplotlib/axes.py 2009-02-28 18:51:37 UTC (rev 6944) @@ -532,6 +532,11 @@ self._frameon = frameon self._axisbelow = rcParams['axes.axisbelow'] + # Attributes for controlling whether axis objects are drawn. + # They are helpers for twinx and twiny. + self._xaxison = True + self._yaxison = True + self._hold = rcParams['axes.hold'] self._connected = {} # a dict from events to (id, func) self.cla() @@ -1647,7 +1652,10 @@ else: self.xaxis.set_zorder(2.5) self.yaxis.set_zorder(2.5) - artists.extend([self.xaxis, self.yaxis]) + if self._xaxison: + artists.append(self.xaxis) + if self._yaxison: + artists.append(self.yaxis) if not inframe: artists.append(self.title) artists.extend(self.tables) if self.legend_ is not None: @@ -6602,6 +6610,7 @@ ax2.yaxis.tick_right() ax2.yaxis.set_label_position('right') self.yaxis.tick_left() + ax2._xaxison = False return ax2 def twiny(self): @@ -6621,6 +6630,7 @@ ax2.xaxis.tick_top() ax2.xaxis.set_label_position('top') self.xaxis.tick_bottom() + ax2._yaxison = False return ax2 def get_shared_x_axes(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2009-03-02 23:04:32
|
Revision: 6947 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6947&view=rev Author: mdboom Date: 2009-03-02 23:04:27 +0000 (Mon, 02 Mar 2009) Log Message: ----------- Merged revisions 6946 via svnmerge from https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_98_5_maint ........ r6946 | mdboom | 2009-03-02 17:50:44 -0500 (Mon, 02 Mar 2009) | 2 lines Fix bug in doc build. ........ Modified Paths: -------------- trunk/matplotlib/doc/conf.py Property Changed: ---------------- trunk/matplotlib/ trunk/matplotlib/doc/pyplots/README trunk/matplotlib/doc/sphinxext/gen_gallery.py trunk/matplotlib/doc/sphinxext/gen_rst.py trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6941 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6946 Modified: svn:mergeinfo - /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941 + /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946 Modified: trunk/matplotlib/doc/conf.py =================================================================== --- trunk/matplotlib/doc/conf.py 2009-03-02 22:50:44 UTC (rev 6946) +++ trunk/matplotlib/doc/conf.py 2009-03-02 23:04:27 UTC (rev 6947) @@ -28,7 +28,7 @@ # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['matplotlib.sphinxext.mathmpl', 'math_symbol_table', - 'sphinx.ext.autodoc', # 'matplotlib.sphinxext.only_directives', + 'sphinx.ext.autodoc', 'matplotlib.sphinxext.only_directives', 'matplotlib.sphinxext.plot_directive', 'inheritance_diagram', 'gen_gallery', 'gen_rst'] Property changes on: trunk/matplotlib/doc/pyplots/README ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946 Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941 + /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946 Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941 + /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 + /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 + /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941 + /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2009-03-03 15:07:05
|
Revision: 6949 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6949&view=rev Author: mdboom Date: 2009-03-03 15:06:54 +0000 (Tue, 03 Mar 2009) Log Message: ----------- Merged revisions 6948 via svnmerge from https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_98_5_maint ........ r6948 | mdboom | 2009-03-03 08:25:23 -0500 (Tue, 03 Mar 2009) | 2 lines Fix plotting() docstring. ........ Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/pyplot.py Property Changed: ---------------- trunk/matplotlib/ trunk/matplotlib/doc/pyplots/README trunk/matplotlib/doc/sphinxext/gen_gallery.py trunk/matplotlib/doc/sphinxext/gen_rst.py trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6946 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6948 Modified: svn:mergeinfo - /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946 + /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948 Property changes on: trunk/matplotlib/doc/pyplots/README ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948 Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946 + /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948 Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946 + /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948 Modified: trunk/matplotlib/lib/matplotlib/pyplot.py =================================================================== --- trunk/matplotlib/lib/matplotlib/pyplot.py 2009-03-03 13:25:23 UTC (rev 6948) +++ trunk/matplotlib/lib/matplotlib/pyplot.py 2009-03-03 15:06:54 UTC (rev 6949) @@ -1149,6 +1149,7 @@ def plotting(): """ Plotting commands + =============== ========================================================= Command Description =============== ========================================================= Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946 + /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946 + /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946 + /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2009-03-03 22:08:48
|
Revision: 6951 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6951&view=rev Author: mdboom Date: 2009-03-03 22:08:38 +0000 (Tue, 03 Mar 2009) Log Message: ----------- Merged revisions 6950 via svnmerge from https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_98_5_maint ........ r6950 | mdboom | 2009-03-03 17:06:53 -0500 (Tue, 03 Mar 2009) | 2 lines Add workaround for change in handling of absolute paths in image directive in recent Sphinx hg versions. ........ Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py Property Changed: ---------------- trunk/matplotlib/ trunk/matplotlib/doc/pyplots/README trunk/matplotlib/doc/sphinxext/gen_gallery.py trunk/matplotlib/doc/sphinxext/gen_rst.py trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6948 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6950 Modified: svn:mergeinfo - /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948 + /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950 Property changes on: trunk/matplotlib/doc/pyplots/README ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950 Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948 + /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950 Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948 + /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948 + /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948 + /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950 Modified: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py =================================================================== --- trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py 2009-03-03 22:06:53 UTC (rev 6950) +++ trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py 2009-03-03 22:08:38 UTC (rev 6951) @@ -30,7 +30,11 @@ from docutils.parsers.rst.directives.images import Image align = Image.align from docutils import nodes +import sphinx +sphinx_version = sphinx.__version__.split(".") +sphinx_version = tuple([int(x) for x in sphinx_version[:2]]) + import matplotlib import matplotlib.cbook as cbook matplotlib.use('Agg') @@ -92,11 +96,11 @@ [%(links)s] - .. image:: %(tmpdir)s/%(outname)s.png + .. image:: %(prefix)s%(tmpdir)s/%(outname)s.png %(options)s .. latexonly:: - .. image:: %(tmpdir)s/%(outname)s.pdf + .. image:: %(prefix)s%(tmpdir)s/%(outname)s.pdf %(options)s """ @@ -262,7 +266,17 @@ # tmpdir is where we build all the output files. This way the # plots won't have to be redone when generating latex after html. - tmpdir = os.path.abspath(os.path.join('build', outdir)) + + # Prior to Sphinx 0.6, absolute image paths were treated as + # relative to the root of the filesystem. 0.6 and after, they are + # treated as relative to the root of the documentation tree. We need + # to support both methods here. + tmpdir = os.path.join('build', outdir) + if sphinx_version < (0, 6): + tmpdir = os.path.abspath(tmpdir) + prefix = '' + else: + prefix = '/' if not os.path.exists(tmpdir): cbook.mkdirs(tmpdir) Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948 + /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2009-03-04 13:27:11
|
Revision: 6953 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6953&view=rev Author: mdboom Date: 2009-03-04 13:27:00 +0000 (Wed, 04 Mar 2009) Log Message: ----------- Merged revisions 6952 via svnmerge from https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_98_5_maint ........ r6952 | mdboom | 2009-03-04 08:25:41 -0500 (Wed, 04 Mar 2009) | 2 lines Fix for Python 2.4 compatibility. ........ Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py Property Changed: ---------------- trunk/matplotlib/ trunk/matplotlib/doc/pyplots/README trunk/matplotlib/doc/sphinxext/gen_gallery.py trunk/matplotlib/doc/sphinxext/gen_rst.py trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6950 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6952 Modified: svn:mergeinfo - /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950 + /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952 Property changes on: trunk/matplotlib/doc/pyplots/README ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952 Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950 + /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952 Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950 + /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950 + /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950 + /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952 Modified: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py =================================================================== --- trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py 2009-03-04 13:25:41 UTC (rev 6952) +++ trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py 2009-03-04 13:27:00 UTC (rev 6953) @@ -136,8 +136,6 @@ try: fd = open(fname) module = imp.load_module("__main__", fd, fname, ('py', 'r', imp.PY_SOURCE)) - except: - raise finally: del sys.path[0] os.chdir(pwd) Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950 + /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lee...@us...> - 2009-03-05 04:45:08
|
Revision: 6956 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6956&view=rev Author: leejjoon Date: 2009-03-05 04:45:00 +0000 (Thu, 05 Mar 2009) Log Message: ----------- hashing of FontProperties accounts current rcParams Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/font_manager.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2009-03-04 20:53:29 UTC (rev 6955) +++ trunk/matplotlib/CHANGELOG 2009-03-05 04:45:00 UTC (rev 6956) @@ -1,3 +1,5 @@ +2009-02-28 hashing of FontProperties accounts current rcParams - JJL + 2009-02-28 Prevent double-rendering of shared axis in twinx, twiny - EF 2009-02-26 Add optional bbox_to_anchor argument for legend class - JJL Modified: trunk/matplotlib/lib/matplotlib/font_manager.py =================================================================== --- trunk/matplotlib/lib/matplotlib/font_manager.py 2009-03-04 20:53:29 UTC (rev 6955) +++ trunk/matplotlib/lib/matplotlib/font_manager.py 2009-03-05 04:45:00 UTC (rev 6956) @@ -705,10 +705,9 @@ return parse_fontconfig_pattern(pattern) def __hash__(self): - l = self.__dict__.items() - l.sort() + l = [(k, getattr(self, "get" + k)()) for k in sorted(self.__dict__)] return hash(repr(l)) - + def __str__(self): return self.get_fontconfig_pattern() @@ -1181,7 +1180,7 @@ """ debug = False if prop is None: - return self.defaultFont + prop = FontProperties() if is_string_like(prop): prop = FontProperties(prop) fname = prop.get_file() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2009-03-07 19:32:52
|
Revision: 6961 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6961&view=rev Author: efiring Date: 2009-03-07 19:32:39 +0000 (Sat, 07 Mar 2009) Log Message: ----------- Merged revisions 6960 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_5_maint ........ r6960 | efiring | 2009-03-07 09:19:40 -1000 (Sat, 07 Mar 2009) | 4 lines Remove references to handle graphics; it is registered trademark of Mathworks, and the pyplot resemblance is only superficial. ........ Modified Paths: -------------- trunk/matplotlib/doc/_templates/index.html trunk/matplotlib/doc/pyplots/tex_demo.png trunk/matplotlib/doc/users/pyplot_tutorial.rst trunk/matplotlib/examples/pylab_examples/axes_props.py trunk/matplotlib/lib/matplotlib/pylab.py trunk/matplotlib/lib/matplotlib/pyplot.py Property Changed: ---------------- trunk/matplotlib/ trunk/matplotlib/doc/pyplots/README trunk/matplotlib/doc/sphinxext/gen_gallery.py trunk/matplotlib/doc/sphinxext/gen_rst.py trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6952 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6960 Modified: svn:mergeinfo - /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952 + /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960 Modified: trunk/matplotlib/doc/_templates/index.html =================================================================== --- trunk/matplotlib/doc/_templates/index.html 2009-03-07 19:19:40 UTC (rev 6960) +++ trunk/matplotlib/doc/_templates/index.html 2009-03-07 19:32:39 UTC (rev 6961) @@ -35,7 +35,7 @@ <p>For the power user, you have full control of line styles, font properties, axes properties, etc, via an object oriented interface - or via a handle graphics interface familiar to Matlab® users. + or via a set of functions familiar to Matlab® users. The pylab mode provides all of the <a href="api/pyplot_api.html">pyplot</a> plotting functions listed below, as well as non-plotting functions from <a href="http://scipy.org/Numpy_Example_List_With_Doc">numpy</a> and @@ -473,7 +473,7 @@ </th> <td align="left"> - get a handle graphics property + get a graphics property </td> </tr> @@ -792,7 +792,7 @@ </th> <td align="left"> - set a handle graphics property + set a graphics property </td> </tr> Property changes on: trunk/matplotlib/doc/pyplots/README ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960 Modified: trunk/matplotlib/doc/pyplots/tex_demo.png =================================================================== (Binary files differ) Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952 + /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960 Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952 + /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960 Modified: trunk/matplotlib/doc/users/pyplot_tutorial.rst =================================================================== --- trunk/matplotlib/doc/users/pyplot_tutorial.rst 2009-03-07 19:19:40 UTC (rev 6960) +++ trunk/matplotlib/doc/users/pyplot_tutorial.rst 2009-03-07 19:32:39 UTC (rev 6961) @@ -78,10 +78,10 @@ line.set_antialiased(False) # turn off antialising * Use the :func:`~matplotlib.pyplot.setp` command. The example below - uses matlab handle graphics style command to set multiple properties + uses a Matlab-style command to set multiple properties on a list of lines. ``setp`` works transparently with a list of objects or a single object. You can either use python keyword arguments or - matlab-style string/value pairs:: + Matlab-style string/value pairs:: lines = plt.plot(x1, y1, x2, y2) # use keyword args Modified: trunk/matplotlib/examples/pylab_examples/axes_props.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/axes_props.py 2009-03-07 19:19:40 UTC (rev 6960) +++ trunk/matplotlib/examples/pylab_examples/axes_props.py 2009-03-07 19:32:39 UTC (rev 6961) @@ -10,7 +10,7 @@ plot(t, s) grid(True) -# matlab handle graphics style +# matlab style xticklines = getp(gca(), 'xticklines') yticklines = getp(gca(), 'yticklines') xgridlines = getp(gca(), 'xgridlines') Modified: trunk/matplotlib/lib/matplotlib/pylab.py =================================================================== --- trunk/matplotlib/lib/matplotlib/pylab.py 2009-03-07 19:19:40 UTC (rev 6960) +++ trunk/matplotlib/lib/matplotlib/pylab.py 2009-03-07 19:32:39 UTC (rev 6961) @@ -42,7 +42,7 @@ gca - return the current axes gcf - return the current figure gci - get the current image, or None - getp - get a handle graphics property + getp - get a graphics property grid - set whether gridding is on hist - make a histogram hold - set the axes hold state @@ -70,7 +70,7 @@ rgrids - customize the radial grids and labels for polar savefig - save the current figure scatter - make a scatter plot - setp - set a handle graphics property + setp - set a graphics property semilogx - log x axis semilogy - log y axis show - show the figures Modified: trunk/matplotlib/lib/matplotlib/pyplot.py =================================================================== --- trunk/matplotlib/lib/matplotlib/pyplot.py 2009-03-07 19:19:40 UTC (rev 6960) +++ trunk/matplotlib/lib/matplotlib/pyplot.py 2009-03-07 19:32:39 UTC (rev 6961) @@ -194,7 +194,7 @@ *number* attribute holding this number. If *num* is an integer, and ``figure(num)`` already exists, make it - active and return the handle to it. If ``figure(num)`` does not exist + active and return a reference to it. If ``figure(num)`` does not exist it will be created. Numbering starts at 1, matlab style:: figure(1) @@ -265,7 +265,7 @@ return figManager.canvas.figure def gcf(): - "Return a handle to the current figure." + "Return a reference to the current figure." figManager = _pylab_helpers.Gcf.get_active() if figManager is not None: @@ -1177,7 +1177,7 @@ gca return the current axes gcf return the current figure gci get the current image, or None - getp get a handle graphics property + getp get a graphics property hist make a histogram hold set the hold state on current axes legend add a legend to the axes @@ -1194,7 +1194,7 @@ rc control the default params savefig save the current figure scatter make a scatter plot - setp set a handle graphics property + setp set a graphics property semilogx log x axis semilogy log y axis show show the figures @@ -1241,7 +1241,7 @@ def colors(): """ - This is a do nothing function to provide you with help on how + This is a do-nothing function to provide you with help on how matplotlib handles colors. Commands which take color arguments can use several formats to Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952 + /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952 + /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952 + /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2009-03-08 06:37:15
|
Revision: 6966 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6966&view=rev Author: efiring Date: 2009-03-08 06:37:06 +0000 (Sun, 08 Mar 2009) Log Message: ----------- Let pyplot users find out if a figure number exists, or list fignums. Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/doc/api/api_changes.rst trunk/matplotlib/lib/matplotlib/pyplot.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2009-03-07 23:47:02 UTC (rev 6965) +++ trunk/matplotlib/CHANGELOG 2009-03-08 06:37:06 UTC (rev 6966) @@ -1,3 +1,5 @@ +2009-03-07 Add pyplot access to figure number list - EF + 2009-02-28 hashing of FontProperties accounts current rcParams - JJL 2009-02-28 Prevent double-rendering of shared axis in twinx, twiny - EF Modified: trunk/matplotlib/doc/api/api_changes.rst =================================================================== --- trunk/matplotlib/doc/api/api_changes.rst 2009-03-07 23:47:02 UTC (rev 6965) +++ trunk/matplotlib/doc/api/api_changes.rst 2009-03-08 06:37:06 UTC (rev 6966) @@ -19,8 +19,12 @@ Changes for 0.98.x ================== -* Removed numerix package. +* Added new :func:`matplotlib.pyplot.fignum_exists` and + :func:`matplotlib.pyplot.get_fignums`; they merely expose + information that had been hidden in :mod:`matplotlib._pylab_helpers`. +* Deprecated numerix package. + * Added new :func:`matplotlib.image.imsave` and exposed it to the :mod:`matplotlib.pyplot` interface. @@ -46,7 +50,7 @@ ================ ================ -* Removed the configobj and experiemtnal traits rc support +* Removed the configobj and experimental traits rc support * Modified :func:`matplotlib.mlab.psd`, :func:`matplotlib.mlab.csd`, :func:`matplotlib.mlab.cohere`, and :func:`matplotlib.mlab.specgram` Modified: trunk/matplotlib/lib/matplotlib/pyplot.py =================================================================== --- trunk/matplotlib/lib/matplotlib/pyplot.py 2009-03-07 23:47:02 UTC (rev 6965) +++ trunk/matplotlib/lib/matplotlib/pyplot.py 2009-03-08 06:37:06 UTC (rev 6966) @@ -273,6 +273,14 @@ else: return figure() +fignum_exists = _pylab_helpers.Gcf.has_fignum + +def get_fignums(): + "Return a list of existing figure numbers." + fignums = _pylab_helpers.Gcf.figs.keys() + fignums.sort() + return fignums + def get_current_fig_manager(): figManager = _pylab_helpers.Gcf.get_active() if figManager is None: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-03-10 20:45:59
|
Revision: 6971 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6971&view=rev Author: jouni Date: 2009-03-10 20:45:44 +0000 (Tue, 10 Mar 2009) Log Message: ----------- Fix join style bug in pdf. Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/examples/tests/backend_driver.py trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py Added Paths: ----------- trunk/matplotlib/examples/api/joinstyle.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2009-03-09 15:19:49 UTC (rev 6970) +++ trunk/matplotlib/CHANGELOG 2009-03-10 20:45:44 UTC (rev 6971) @@ -1,3 +1,5 @@ +2009-03-10 Fix join style bug in pdf. - JKS + 2009-03-07 Add pyplot access to figure number list - EF 2009-02-28 hashing of FontProperties accounts current rcParams - JJL Added: trunk/matplotlib/examples/api/joinstyle.py =================================================================== --- trunk/matplotlib/examples/api/joinstyle.py (rev 0) +++ trunk/matplotlib/examples/api/joinstyle.py 2009-03-10 20:45:44 UTC (rev 6971) @@ -0,0 +1,31 @@ +#!/usr/bin/env python +""" +Illustrate the three different join styles +""" + +import numpy as np +import matplotlib +import matplotlib.pyplot as plt + +def plot_angle(ax, x, y, angle, style): + phi = angle/180*np.pi + xx = [x+.5,x,x+.5*np.cos(phi)] + yy = [y,y,y+.5*np.sin(phi)] + ax.plot(xx, yy, lw=8, color='blue', solid_joinstyle=style) + ax.plot(xx[1:], yy[1:], lw=1, color='black') + ax.plot(xx[1::-1], yy[1::-1], lw=1, color='black') + ax.plot(xx[1:2], yy[1:2], 'o', color='red', markersize=3) + ax.text(x,y+.2,'%.0f degrees' % angle) + +fig = plt.figure() +ax = fig.add_subplot(111) +ax.set_title('Join style') + +for x,style in enumerate((('miter', 'round', 'bevel'))): + ax.text(x, 5, style) + for i in range(5): + plot_angle(ax, x, i, pow(2.0,3+i), style) + +ax.set_xlim(-.5,2.75) +ax.set_ylim(-.5,5.5) +plt.show() Modified: trunk/matplotlib/examples/tests/backend_driver.py =================================================================== --- trunk/matplotlib/examples/tests/backend_driver.py 2009-03-09 15:19:49 UTC (rev 6970) +++ trunk/matplotlib/examples/tests/backend_driver.py 2009-03-10 20:45:44 UTC (rev 6971) @@ -211,6 +211,7 @@ 'font_family_rc.py', 'histogram_demo.py', 'image_zcoord.py', + 'joinstyle.py', 'legend_demo.py', 'line_with_text.py', 'logo2.py', Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2009-03-09 15:19:49 UTC (rev 6970) +++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2009-03-10 20:45:44 UTC (rev 6971) @@ -427,6 +427,9 @@ self.beginStream(contentObject.id, self.reserveObject('length of content stream')) + # Initialize the pdf graphics state to match the default mpl + # graphics context: currently only the join style needs to be set + self.output(GraphicsContextPdf.joinstyles['round'], Op.setlinejoin) def close(self): self.endStream() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2009-03-11 20:40:45
|
Revision: 6973 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6973&view=rev Author: efiring Date: 2009-03-11 19:45:23 +0000 (Wed, 11 Mar 2009) Log Message: ----------- Merged revisions 6972 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_5_maint ........ r6972 | efiring | 2009-03-11 09:36:22 -1000 (Wed, 11 Mar 2009) | 2 lines Ensure wx version >= 2.8; Sandro Tosi patch plus change to backend ........ Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/examples/user_interfaces/embedding_in_wx2.py trunk/matplotlib/examples/user_interfaces/embedding_in_wx3.py trunk/matplotlib/examples/user_interfaces/embedding_in_wx4.py trunk/matplotlib/examples/user_interfaces/embedding_in_wx5.py trunk/matplotlib/lib/matplotlib/backends/backend_wx.py trunk/matplotlib/lib/matplotlib/backends/backend_wxagg.py Property Changed: ---------------- trunk/matplotlib/ trunk/matplotlib/doc/pyplots/README trunk/matplotlib/doc/sphinxext/gen_gallery.py trunk/matplotlib/doc/sphinxext/gen_rst.py trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6960 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6972 Modified: svn:mergeinfo - /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960 + /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972 Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2009-03-11 19:36:22 UTC (rev 6972) +++ trunk/matplotlib/CHANGELOG 2009-03-11 19:45:23 UTC (rev 6973) @@ -1,3 +1,6 @@ +2009-03-11 Ensure wx version >= 2.8; thanks to Sandro Tosi and + Chris Barker. - EF + 2009-03-10 Fix join style bug in pdf. - JKS 2009-03-07 Add pyplot access to figure number list - EF Property changes on: trunk/matplotlib/doc/pyplots/README ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972 Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960 + /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972 Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960 + /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972 Modified: trunk/matplotlib/examples/user_interfaces/embedding_in_wx2.py =================================================================== --- trunk/matplotlib/examples/user_interfaces/embedding_in_wx2.py 2009-03-11 19:36:22 UTC (rev 6972) +++ trunk/matplotlib/examples/user_interfaces/embedding_in_wx2.py 2009-03-11 19:45:23 UTC (rev 6973) @@ -4,6 +4,10 @@ toolbar - comment out the setA_toolbar line for no toolbar """ +# Used to guarantee to use at least Wx2.8 +import wxversion +wxversion.ensureMinimal('2.8') + from numpy import arange, sin, pi import matplotlib @@ -20,15 +24,15 @@ from matplotlib.figure import Figure -from wx import * +import wx -class CanvasFrame(Frame): +class CanvasFrame(wx.Frame): def __init__(self): - Frame.__init__(self,None,-1, + wx.Frame.__init__(self,None,-1, 'CanvasFrame',size=(550,350)) - self.SetBackgroundColour(NamedColor("WHITE")) + self.SetBackgroundColour(wx.NamedColor("WHITE")) self.figure = Figure() self.axes = self.figure.add_subplot(111) @@ -38,8 +42,8 @@ self.axes.plot(t,s) self.canvas = FigureCanvas(self, -1, self.figure) - self.sizer = BoxSizer(VERTICAL) - self.sizer.Add(self.canvas, 1, LEFT | TOP | GROW) + self.sizer = wx.BoxSizer(wx.VERTICAL) + self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW) self.SetSizer(self.sizer) self.Fit() @@ -49,7 +53,7 @@ def add_toolbar(self): self.toolbar = NavigationToolbar2Wx(self.canvas) self.toolbar.Realize() - if Platform == '__WXMAC__': + if wx.Platform == '__WXMAC__': # Mac platform (OSX 10.3, MacPython) does not seem to cope with # having a toolbar in a sizer. This work-around gets the buttons # back, but at the expense of having the toolbar at the top @@ -62,8 +66,8 @@ # By adding toolbar in sizer, we are able to put it at the bottom # of the frame - so appearance is closer to GTK version. # As noted above, doesn't work for Mac. - self.toolbar.SetSize(Size(fw, th)) - self.sizer.Add(self.toolbar, 0, LEFT | EXPAND) + self.toolbar.SetSize(wx.Size(fw, th)) + self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND) # update the axes menu on the toolbar self.toolbar.update() @@ -71,7 +75,7 @@ def OnPaint(self, event): self.canvas.draw() -class App(App): +class App(wx.App): def OnInit(self): 'Create the main window and insert the custom frame' Modified: trunk/matplotlib/examples/user_interfaces/embedding_in_wx3.py =================================================================== --- trunk/matplotlib/examples/user_interfaces/embedding_in_wx3.py 2009-03-11 19:36:22 UTC (rev 6972) +++ trunk/matplotlib/examples/user_interfaces/embedding_in_wx3.py 2009-03-11 19:45:23 UTC (rev 6973) @@ -18,6 +18,11 @@ Thanks to matplotlib and wx teams for creating such great software! """ + +# Used to guarantee to use at least Wx2.8 +import wxversion +wxversion.ensureMinimal('2.8') + import sys, time, os, gc import matplotlib matplotlib.use('WXAgg') @@ -26,18 +31,18 @@ from matplotlib.figure import Figure import numpy as npy -from wx import * -from wx.xrc import * +import wx +import wx.xrc as xrc ERR_TOL = 1e-5 # floating point slop for peak-detection matplotlib.rc('image', origin='lower') -class PlotPanel(Panel): +class PlotPanel(wx.Panel): def __init__(self, parent): - Panel.__init__(self, parent, -1) + wx.Panel.__init__(self, parent, -1) self.fig = Figure((5,4), 75) self.canvas = FigureCanvasWxAgg(self, -1, self.fig) @@ -46,11 +51,11 @@ #self.toolbar.set_active([0,1]) # Now put all into a sizer - sizer = BoxSizer(VERTICAL) + sizer = wx.BoxSizer(wx.VERTICAL) # This way of adding to sizer allows resizing - sizer.Add(self.canvas, 1, LEFT|TOP|GROW) + sizer.Add(self.canvas, 1, wx.LEFT|wx.TOP|wx.GROW) # Best to allow the toolbar to resize! - sizer.Add(self.toolbar, 0, GROW) + sizer.Add(self.toolbar, 0, wx.GROW) self.SetSizer(sizer) self.Fit() @@ -94,43 +99,43 @@ # this is supposed to prevent redraw flicker on some X servers... pass -class MyApp(App): +class MyApp(wx.App): def OnInit(self): xrcfile = os.path.join(os.path.dirname(__file__),"..","data", "embedding_in_wx3.xrc") - self.res = XmlResource(xrcfile) + self.res = xrc.XmlResource(xrcfile) # main frame and panel --------- self.frame = self.res.LoadFrame(None,"MainFrame") - self.panel = XRCCTRL(self.frame,"MainPanel") + self.panel = xrc.XRCCTRL(self.frame,"MainPanel") # matplotlib panel ------------- # container for matplotlib panel (I like to make a container # panel for our panel so I know where it'll go when in XRCed.) - plot_container = XRCCTRL(self.frame,"plot_container_panel") - sizer = BoxSizer(VERTICAL) + plot_container = xrc.XRCCTRL(self.frame,"plot_container_panel") + sizer = wx.BoxSizer(wx.VERTICAL) # matplotlib panel itself self.plotpanel = PlotPanel(plot_container) self.plotpanel.init_plot_data() # wx boilerplate - sizer.Add(self.plotpanel, 1, EXPAND) + sizer.Add(self.plotpanel, 1, wx.EXPAND) plot_container.SetSizer(sizer) # whiz button ------------------ - whiz_button = XRCCTRL(self.frame,"whiz_button") - EVT_BUTTON(whiz_button, whiz_button.GetId(), - self.plotpanel.OnWhiz) + whiz_button = xrc.XRCCTRL(self.frame,"whiz_button") + wx.EVT_BUTTON(whiz_button, whiz_button.GetId(), + self.plotpanel.OnWhiz) # bang button ------------------ - bang_button = XRCCTRL(self.frame,"bang_button") - EVT_BUTTON(bang_button, bang_button.GetId(), - self.OnBang) + bang_button = xrc.XRCCTRL(self.frame,"bang_button") + wx.EVT_BUTTON(bang_button, bang_button.GetId(), + self.OnBang) # final setup ------------------ Modified: trunk/matplotlib/examples/user_interfaces/embedding_in_wx4.py =================================================================== --- trunk/matplotlib/examples/user_interfaces/embedding_in_wx4.py 2009-03-11 19:36:22 UTC (rev 6972) +++ trunk/matplotlib/examples/user_interfaces/embedding_in_wx4.py 2009-03-11 19:45:23 UTC (rev 6973) @@ -4,6 +4,10 @@ toolbar """ +# Used to guarantee to use at least Wx2.8 +import wxversion +wxversion.ensureMinimal('2.8') + from numpy import arange, sin, pi import matplotlib @@ -16,13 +20,13 @@ from matplotlib.figure import Figure from numpy.random import rand -from wx import * +import wx class MyNavigationToolbar(NavigationToolbar2WxAgg): """ Extend the default wx toolbar with your own event handlers """ - ON_CUSTOM = NewId() + ON_CUSTOM = wx.NewId() def __init__(self, canvas, cankill): NavigationToolbar2WxAgg.__init__(self, canvas) @@ -30,7 +34,7 @@ # probably want to add your own. self.AddSimpleTool(self.ON_CUSTOM, _load_bitmap('stock_left.xpm'), 'Click me', 'Activate custom contol') - EVT_TOOL(self, self.ON_CUSTOM, self._on_custom) + wx.EVT_TOOL(self, self.ON_CUSTOM, self._on_custom) def _on_custom(self, evt): # add some text to the axes in a random location in axes (0,1) @@ -51,13 +55,13 @@ evt.Skip() -class CanvasFrame(Frame): +class CanvasFrame(wx.Frame): def __init__(self): - Frame.__init__(self,None,-1, + wx.Frame.__init__(self,None,-1, 'CanvasFrame',size=(550,350)) - self.SetBackgroundColour(NamedColor("WHITE")) + self.SetBackgroundColour(wx.NamedColor("WHITE")) self.figure = Figure(figsize=(5,4), dpi=100) self.axes = self.figure.add_subplot(111) @@ -68,14 +72,14 @@ self.canvas = FigureCanvas(self, -1, self.figure) - self.sizer = BoxSizer(VERTICAL) - self.sizer.Add(self.canvas, 1, TOP | LEFT | EXPAND) + self.sizer = wx.BoxSizer(wx.VERTICAL) + self.sizer.Add(self.canvas, 1, wx.TOP | wx.LEFT | wx.EXPAND) # Capture the paint message - EVT_PAINT(self, self.OnPaint) + wx.EVT_PAINT(self, self.OnPaint) self.toolbar = MyNavigationToolbar(self.canvas, True) self.toolbar.Realize() - if Platform == '__WXMAC__': + if wx.Platform == '__WXMAC__': # Mac platform (OSX 10.3, MacPython) does not seem to cope with # having a toolbar in a sizer. This work-around gets the buttons # back, but at the expense of having the toolbar at the top @@ -88,8 +92,8 @@ # By adding toolbar in sizer, we are able to put it at the bottom # of the frame - so appearance is closer to GTK version. # As noted above, doesn't work for Mac. - self.toolbar.SetSize(Size(fw, th)) - self.sizer.Add(self.toolbar, 0, LEFT | EXPAND) + self.toolbar.SetSize(wx.Size(fw, th)) + self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND) # update the axes menu on the toolbar self.toolbar.update() @@ -101,7 +105,7 @@ self.canvas.draw() event.Skip() -class App(App): +class App(wx.App): def OnInit(self): 'Create the main window and insert the custom frame' Modified: trunk/matplotlib/examples/user_interfaces/embedding_in_wx5.py =================================================================== --- trunk/matplotlib/examples/user_interfaces/embedding_in_wx5.py 2009-03-11 19:36:22 UTC (rev 6972) +++ trunk/matplotlib/examples/user_interfaces/embedding_in_wx5.py 2009-03-11 19:45:23 UTC (rev 6973) @@ -1,3 +1,7 @@ +# Used to guarantee to use at least Wx2.8 +import wxversion +wxversion.ensureMinimal('2.8') + import wx import wx.aui import matplotlib as mpl Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2009-03-11 19:36:22 UTC (rev 6972) +++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2009-03-11 19:45:23 UTC (rev 6973) @@ -108,12 +108,23 @@ import traceback, pdb _DEBUG_lvls = {1 : 'Low ', 2 : 'Med ', 3 : 'High', 4 : 'Error' } +missingwx = "Matplotlib backend_wx and backend_wxagg require wxPython >=2.8" try: + import wxversion +except ImportError: + raise ImportError(missingwx) + +try: + wxversion.ensureMinimal('2.8') +except wxversion.AlreadyImportedError: + pass + +try: import wx backend_version = wx.VERSION_STRING -except: - raise ImportError("Matplotlib backend_wx requires wxPython be installed") +except ImportError: + raise ImportError(missingwx) #!!! this is the call that is causing the exception swallowing !!! #wx.InitAllImageHandlers() Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wxagg.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_wxagg.py 2009-03-11 19:36:22 UTC (rev 6972) +++ trunk/matplotlib/lib/matplotlib/backends/backend_wxagg.py 2009-03-11 19:45:23 UTC (rev 6973) @@ -16,17 +16,16 @@ """ -import wx import matplotlib from matplotlib.figure import Figure from backend_agg import FigureCanvasAgg -import backend_wx +import backend_wx # already uses wxversion.ensureMinimal('2.8') from backend_wx import FigureManager, FigureManagerWx, FigureCanvasWx, \ FigureFrameWx, DEBUG_MSG, NavigationToolbar2Wx, error_msg_wx, \ draw_if_interactive, show, Toolbar, backend_version +import wx - class FigureFrameWxAgg(FigureFrameWx): def get_canvas(self, fig): return FigureCanvasWxAgg(self, -1, fig) Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960 + /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960 + /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960 + /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2009-03-13 17:14:03
|
Revision: 6974 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6974&view=rev Author: mdboom Date: 2009-03-13 17:13:49 +0000 (Fri, 13 Mar 2009) Log Message: ----------- Commit Michiel de Hoon's integration of path simplification into the Mac OS-X backend. Thanks, Michiel! Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py trunk/matplotlib/setupext.py trunk/matplotlib/src/_macosx.m trunk/matplotlib/src/path_cleanup.h Modified: trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py 2009-03-11 19:45:23 UTC (rev 6973) +++ trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py 2009-03-13 17:13:49 UTC (rev 6974) @@ -128,13 +128,13 @@ def get_text_width_height_descent(self, s, prop, ismath): if ismath=='TeX': - # TODO: handle props + # todo: handle props size = prop.get_size_in_points() texmanager = self.get_texmanager() - Z = texmanager.get_grey(s, size, self.dpi) - m,n = Z.shape - # TODO: handle descent; This is based on backend_agg.py - return n, m, 0 + fontsize = prop.get_size_in_points() + w, h, d = texmanager.get_text_width_height_descent(s, fontsize, + renderer=self) + return w, h, d if ismath: ox, oy, width, height, descent, fonts, used_characters = \ self.mathtext_parser.parse(s, self.dpi, prop) @@ -143,7 +143,8 @@ size = prop.get_size_in_points() weight = prop.get_weight() style = prop.get_style() - return self.gc.get_text_width_height_descent(unicode(s), family, size, weight, style) + width, height, descent = self.gc.get_text_width_height_descent(unicode(s), family, size, weight, style) + return width, height, 0.0*descent def flipy(self): return False @@ -230,6 +231,14 @@ key_press_event, and key_release_event are called from there. """ + filetypes = FigureCanvasBase.filetypes.copy() + filetypes['bmp'] = 'Windows bitmap' + filetypes['jpeg'] = 'JPEG' + filetypes['jpg'] = 'JPEG' + filetypes['gif'] = 'Graphics Interchange Format' + filetypes['tif'] = 'Tagged Image Format File' + filetypes['tiff'] = 'Tagged Image Format File' + def __init__(self, figure): FigureCanvasBase.__init__(self, figure) width, height = self.get_width_height() @@ -243,55 +252,41 @@ height /= dpi self.figure.set_size_inches(width, height) - def print_figure(self, filename, dpi=None, facecolor='w', edgecolor='w', - orientation='portrait', **kwargs): - if dpi is None: dpi = matplotlib.rcParams['savefig.dpi'] + def _print_bitmap(self, filename, *args, **kwargs): + # In backend_bases.py, print_figure changes the dpi of the figure. + # But since we are essentially redrawing the picture, we need the + # original dpi. Pick it up from the renderer. + dpi = kwargs['dpi'] + old_dpi = self.figure.dpi + self.figure.dpi = self.renderer.dpi + width, height = self.figure.get_size_inches() + width, height = width*dpi, height*dpi filename = unicode(filename) - root, ext = os.path.splitext(filename) - ext = ext[1:].lower() - if not ext: - ext = "png" - filename = root + "." + ext - if ext=="jpg": ext = "jpeg" + self.write_bitmap(filename, width, height) + self.figure.dpi = old_dpi - # save the figure settings - origfacecolor = self.figure.get_facecolor() - origedgecolor = self.figure.get_edgecolor() + def print_bmp(self, filename, *args, **kwargs): + self._print_bitmap(filename, *args, **kwargs) - # set the new parameters - self.figure.set_facecolor(facecolor) - self.figure.set_edgecolor(edgecolor) + def print_jpg(self, filename, *args, **kwargs): + self._print_bitmap(filename, *args, **kwargs) - if ext in ('jpeg', 'png', 'tiff', 'gif', 'bmp'): - width, height = self.figure.get_size_inches() - width, height = width*dpi, height*dpi - self.write_bitmap(filename, width, height) - elif ext == 'pdf': - self.write_pdf(filename) - elif ext in ('ps', 'eps'): - from backend_ps import FigureCanvasPS - # Postscript backend changes figure.dpi, but doesn't change it back - origDPI = self.figure.dpi - fc = self.switch_backends(FigureCanvasPS) - fc.print_figure(filename, dpi, facecolor, edgecolor, - orientation, **kwargs) - self.figure.dpi = origDPI - self.figure.set_canvas(self) - elif ext=='svg': - from backend_svg import FigureCanvasSVG - fc = self.switch_backends(FigureCanvasSVG) - fc.print_figure(filename, dpi, facecolor, edgecolor, - orientation, **kwargs) - self.figure.set_canvas(self) - else: - raise ValueError("Figure format not available (extension %s)" % ext) + def print_jpeg(self, filename, *args, **kwargs): + self._print_bitmap(filename, *args, **kwargs) - # restore original figure settings - self.figure.set_facecolor(origfacecolor) - self.figure.set_edgecolor(origedgecolor) + def print_tif(self, filename, *args, **kwargs): + self._print_bitmap(filename, *args, **kwargs) + def print_tiff(self, filename, *args, **kwargs): + self._print_bitmap(filename, *args, **kwargs) + def print_gif(self, filename, *args, **kwargs): + self._print_bitmap(filename, *args, **kwargs) + def get_default_filetype(self): + return 'png' + + class FigureManagerMac(_macosx.FigureManager, FigureManagerBase): """ Wrap everything up into a window for the pylab interface Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2009-03-11 19:45:23 UTC (rev 6973) +++ trunk/matplotlib/setupext.py 2009-03-13 17:13:49 UTC (rev 6974) @@ -1156,20 +1156,22 @@ ext_modules.append(module) BUILT_WXAGG = True - def build_macosx(ext_modules, packages): global BUILT_MACOSX if BUILT_MACOSX: return # only build it if you you haven't already + deps = ['src/_macosx.m', + 'src/agg_py_transforms.cpp', + 'src/path_cleanup.cpp', + 'src/_path.cpp'] module = Extension('matplotlib.backends._macosx', - ['src/_macosx.m'], + deps, extra_link_args = ['-framework','Cocoa'], - define_macros=[('PY_ARRAY_UNIQUE_SYMBOL', 'MPL_ARRAY_API')] ) add_numpy_flags(module) + add_agg_flags(module) ext_modules.append(module) BUILT_MACOSX = True - def build_png(ext_modules, packages): global BUILT_PNG if BUILT_PNG: return # only build it if you you haven't already Modified: trunk/matplotlib/src/_macosx.m =================================================================== --- trunk/matplotlib/src/_macosx.m 2009-03-11 19:45:23 UTC (rev 6973) +++ trunk/matplotlib/src/_macosx.m 2009-03-13 17:13:49 UTC (rev 6974) @@ -3,7 +3,9 @@ #include <sys/socket.h> #include <Python.h> #include "numpy/arrayobject.h" +#include "path_cleanup.h" + static int nwin = 0; /* The number of open windows */ static int ngc = 0; /* The number of graphics contexts in use */ @@ -17,24 +19,7 @@ #define CGFloat float #endif -/* This is the same as CGAffineTransform, except that the data members are - * doubles rather than CGFloats. - * Matrix structure: - * [ a b 0] - * [ c d 0] - * [ tx ty 1] - */ -typedef struct -{ - double a; - double b; - double c; - double d; - double tx; - double ty; -} AffineTransform; - /* Various NSApplicationDefined event subtypes */ #define STDIN_READY 0 #define SIGINT_CALLED 1 @@ -186,19 +171,6 @@ return 1; } -static AffineTransform -AffineTransformConcat(AffineTransform t1, AffineTransform t2) -{ - AffineTransform t; - t.a = t1.a * t2.a + t1.b * t2.c; - t.b = t1.a * t2.b + t1.b * t2.d; - t.c = t1.c * t2.a + t1.d * t2.c; - t.d = t1.c * t2.b + t1.d * t2.d; - t.tx = t1.tx * t2.a + t1.ty * t2.c + t2.tx; - t.ty = t1.tx * t2.b + t1.ty * t2.d + t2.ty; - return t; -} - static int _init_atsui(void) { OSStatus status; @@ -237,243 +209,91 @@ PyErr_WarnEx(PyExc_RuntimeWarning, "ATSUDisposeTextLayout failed", 1); } -static int -_draw_path(CGContextRef cr, PyObject* path, AffineTransform affine) +static int _draw_path(CGContextRef cr, void* iterator) { double x1, y1, x2, y2, x3, y3; - CGFloat fx1, fy1, fx2, fy2, fx3, fy3; + int n = 0; + unsigned code; - PyObject* vertices = PyObject_GetAttrString(path, "vertices"); - if (vertices==NULL) + while (true) { - PyErr_SetString(PyExc_AttributeError, "path has no vertices"); - return -1; - } - Py_DECREF(vertices); /* Don't keep a reference here */ - - PyObject* codes = PyObject_GetAttrString(path, "codes"); - if (codes==NULL) - { - PyErr_SetString(PyExc_AttributeError, "path has no codes"); - return -1; - } - Py_DECREF(codes); /* Don't keep a reference here */ - - PyArrayObject* coordinates; - coordinates = (PyArrayObject*)PyArray_FromObject(vertices, - NPY_DOUBLE, 2, 2); - if (!coordinates) - { - PyErr_SetString(PyExc_ValueError, "failed to convert vertices array"); - return -1; - } - - if (PyArray_NDIM(coordinates) != 2 || PyArray_DIM(coordinates, 1) != 2) - { - Py_DECREF(coordinates); - PyErr_SetString(PyExc_ValueError, "invalid vertices array"); - return -1; - } - - npy_intp n = PyArray_DIM(coordinates, 0); - - if (n==0) /* Nothing to do here */ - { - Py_DECREF(coordinates); - return 0; - } - - PyArrayObject* codelist = NULL; - if (codes != Py_None) - { - codelist = (PyArrayObject*)PyArray_FromObject(codes, - NPY_UINT8, 1, 1); - if (!codelist) + code = get_vertex(iterator, &x1, &y1); + if (code == CLOSEPOLY) { - Py_DECREF(coordinates); - PyErr_SetString(PyExc_ValueError, "invalid codes array"); - return -1; + CGContextClosePath(cr); + n++; } - } - - if (codelist==NULL) - { - npy_intp i; - npy_uint8 code = MOVETO; - for (i = 0; i < n; i++) + else if (code == STOP) { - x1 = *(double*)PyArray_GETPTR2(coordinates, i, 0); - y1 = *(double*)PyArray_GETPTR2(coordinates, i, 1); - if (isnan(x1) || isnan(y1)) - { - code = MOVETO; - } - else - { - fx1 = (CGFloat)(affine.a*x1 + affine.c*y1 + affine.tx); - fy1 = (CGFloat)(affine.b*x1 + affine.d*y1 + affine.ty); - switch (code) - { - case MOVETO: - CGContextMoveToPoint(cr, fx1, fy1); - break; - case LINETO: - CGContextAddLineToPoint(cr, fx1, fy1); - break; - } - code = LINETO; - } + break; } - } - else - { - npy_intp i = 0; - BOOL was_nan = false; - npy_uint8 code; - while (i < n) + else if (code == MOVETO) { - code = *(npy_uint8*)PyArray_GETPTR1(codelist, i); - if (code == CLOSEPOLY) - { - CGContextClosePath(cr); - i++; - } - else if (code == STOP) - { - break; - } - else if (was_nan) - { - if (code==CURVE3) i++; - else if (code==CURVE4) i+=2; - x1 = *(double*)PyArray_GETPTR2(coordinates, i, 0); - y1 = *(double*)PyArray_GETPTR2(coordinates, i, 1); - i++; - if (isnan(x1) || isnan(y1)) - { - was_nan = true; - } - else - { - fx1 = (CGFloat) (affine.a*x1 + affine.c*y1 + affine.tx); - fy1 = (CGFloat) (affine.b*x1 + affine.d*y1 + affine.ty); - CGContextMoveToPoint(cr, fx1, fy1); - was_nan = false; - } - } - else if (code==MOVETO) - { - x1 = *(double*)PyArray_GETPTR2(coordinates, i, 0); - y1 = *(double*)PyArray_GETPTR2(coordinates, i, 1); - i++; - if (isnan(x1) || isnan(y1)) - { - was_nan = true; - } - else - { - fx1 = (CGFloat) (affine.a*x1 + affine.c*y1 + affine.tx); - fy1 = (CGFloat) (affine.b*x1 + affine.d*y1 + affine.ty); - CGContextMoveToPoint(cr, fx1, fy1); - was_nan = false; - } - } - else if (code==LINETO) - { - x1 = *(double*)PyArray_GETPTR2(coordinates, i, 0); - y1 = *(double*)PyArray_GETPTR2(coordinates, i, 1); - i++; - if (isnan(x1) || isnan(y1)) - { - was_nan = true; - } - else - { - fx1 = (CGFloat) (affine.a*x1 + affine.c*y1 + affine.tx); - fy1 = (CGFloat) (affine.b*x1 + affine.d*y1 + affine.ty); - CGContextAddLineToPoint(cr, fx1, fy1); - was_nan = false; - } - } - else if (code==CURVE3) - { - x1 = *(double*)PyArray_GETPTR2(coordinates, i, 0); - y1 = *(double*)PyArray_GETPTR2(coordinates, i, 1); - i++; - x2 = *(double*)PyArray_GETPTR2(coordinates, i, 0); - y2 = *(double*)PyArray_GETPTR2(coordinates, i, 1); - i++; - if (isnan(x1) || isnan(y1) || isnan(x2) || isnan(y2)) - { - was_nan = true; - } - else - { - fx1 = (CGFloat) (affine.a*x1 + affine.c*y1 + affine.tx); - fy1 = (CGFloat) (affine.b*x1 + affine.d*y1 + affine.ty); - fx2 = (CGFloat) (affine.a*x2 + affine.c*y2 + affine.tx); - fy2 = (CGFloat) (affine.b*x2 + affine.d*y2 + affine.ty); - CGContextAddQuadCurveToPoint(cr, fx1, fy1, fx2, fy2); - was_nan = false; - } - } - else if (code==CURVE4) - { - x1 = *(double*)PyArray_GETPTR2(coordinates, i, 0); - y1 = *(double*)PyArray_GETPTR2(coordinates, i, 1); - i++; - x2 = *(double*)PyArray_GETPTR2(coordinates, i, 0); - y2 = *(double*)PyArray_GETPTR2(coordinates, i, 1); - i++; - x3 = *(double*)PyArray_GETPTR2(coordinates, i, 0); - y3 = *(double*)PyArray_GETPTR2(coordinates, i, 1); - i++; - if (isnan(x1) || isnan(y1) || isnan(x2) || isnan(y2) || isnan(x3) || isnan(y3)) - { - was_nan = true; - } - else - { - fx1 = (CGFloat) (affine.a*x1 + affine.c*y1 + affine.tx); - fy1 = (CGFloat) (affine.b*x1 + affine.d*y1 + affine.ty); - fx2 = (CGFloat) (affine.a*x2 + affine.c*y2 + affine.tx); - fy2 = (CGFloat) (affine.b*x2 + affine.d*y2 + affine.ty); - fx3 = (CGFloat) (affine.a*x3 + affine.c*y3 + affine.tx); - fy3 = (CGFloat) (affine.b*x3 + affine.d*y3 + affine.ty); - CGContextAddCurveToPoint(cr, fx1, fy1, fx2, fy2, fx3, fy3); - was_nan = false; - } - } + CGContextMoveToPoint(cr, x1, y1); + n++; } + else if (code==LINETO) + { + CGContextAddLineToPoint(cr, x1, y1); + n++; + } + else if (code==CURVE3) + { + get_vertex(iterator, &x2, &y2); + CGContextAddQuadCurveToPoint(cr, x1, y1, x2, y2); + n+=2; + } + else if (code==CURVE4) + { + get_vertex(iterator, &x2, &y2); + get_vertex(iterator, &x3, &y3); + CGContextAddCurveToPoint(cr, x1, y1, x2, y2, x3, y3); + n+=3; + } } - - Py_DECREF(coordinates); - Py_XDECREF(codelist); return n; } -static void _draw_hatch (void *info, CGContextRef cr) +static void _draw_hatch(void *info, CGContextRef cr) { PyObject* hatchpath = (PyObject*)info; - AffineTransform affine = {HATCH_SIZE, 0, 0, HATCH_SIZE, 0, 0}; - int n = _draw_path(cr, hatchpath, affine); - if (n < 0) + PyObject* transform; + int nd = 2; + npy_intp dims[2] = {3, 3}; + int typenum = NPY_DOUBLE; + double data[9] = {HATCH_SIZE, 0, 0, 0, HATCH_SIZE, 0, 0, 0, 1}; + double rect[4] = { 0.0, 0.0, HATCH_SIZE, HATCH_SIZE}; + int n; + transform = PyArray_SimpleNewFromData(nd, dims, typenum, data); + if (!transform) { PyGILState_STATE gstate = PyGILState_Ensure(); PyErr_Print(); PyGILState_Release(gstate); return; } - else if (n==0) + void* iterator = get_path_iterator(hatchpath, + transform, + 0, + 0, + rect, + QUANTIZE_FALSE, + 0); + Py_DECREF(transform); + if (!iterator) { + PyGILState_STATE gstate = PyGILState_Ensure(); + PyErr_SetString(PyExc_RuntimeError, "failed to obtain path iterator for hatching"); + PyErr_Print(); + PyGILState_Release(gstate); return; } - else - { - CGContextSetLineWidth(cr, 1.0); - CGContextSetLineCap(cr, kCGLineCapSquare); - CGContextDrawPath(cr, kCGPathFillStroke); - } + n = _draw_path(cr, iterator); + free_path_iterator(iterator); + if (n==0) return; + CGContextSetLineWidth(cr, 1.0); + CGContextSetLineCap(cr, kCGLineCapSquare); + CGContextDrawPath(cr, kCGPathFillStroke); } static void _release_hatch(void* info) @@ -553,8 +373,64 @@ typedef struct { PyObject_HEAD CGContextRef cr; + NSSize size; } GraphicsContext; +static CGMutablePathRef _create_path(void* iterator) +{ + unsigned code; + CGMutablePathRef p; + double x1, y1, x2, y2, x3, y3; + + p = CGPathCreateMutable(); + if (!p) return NULL; + + while (true) + { + code = get_vertex(iterator, &x1, &y1); + if (code == CLOSEPOLY) + { + CGPathCloseSubpath(p); + } + else if (code == STOP) + { + break; + } + else if (code == MOVETO) + { + CGPathMoveToPoint(p, NULL, x1, y1); + } + else if (code==LINETO) + { + CGPathAddLineToPoint(p, NULL, x1, y1); + } + else if (code==CURVE3) + { + get_vertex(iterator, &x2, &y2); + CGPathAddQuadCurveToPoint(p, NULL, x1, y1, x2, y2); + } + else if (code==CURVE4) + { + get_vertex(iterator, &x2, &y2); + get_vertex(iterator, &x3, &y3); + CGPathAddCurveToPoint(p, NULL, x1, y1, x2, y2, x3, y3); + } + } + + return p; +} + +static int _get_snap(GraphicsContext* self, enum e_quantize_mode* mode) +{ + PyObject* snap = PyObject_CallMethod((PyObject*)self, "get_snap", ""); + if(!snap) return 0; + if(snap==Py_None) *mode = QUANTIZE_AUTO; + else if (PyBool_Check(snap)) *mode = QUANTIZE_TRUE; + else *mode = QUANTIZE_FALSE; + Py_DECREF(snap); + return 1; +} + static PyObject* GraphicsContext_new(PyTypeObject* type, PyObject *args, PyObject *kwds) { @@ -587,7 +463,7 @@ static PyObject* GraphicsContext_repr(GraphicsContext* self) { - return PyString_FromFormat("GraphicsContext object %p wrapping the Quartz 2D graphics context %p", self, self->cr); + return PyString_FromFormat("GraphicsContext object %p wrapping the Quartz 2D graphics context %p", (void*)self, (void*)(self->cr)); } static PyObject* @@ -622,18 +498,30 @@ return Py_None; } +static BOOL +_set_antialiased(CGContextRef cr, PyObject* antialiased) +{ + const int shouldAntialias = PyObject_IsTrue(antialiased); + if (shouldAntialias < 0) + { + PyErr_SetString(PyExc_ValueError, + "Failed to read antialiaseds variable"); + return false; + } + CGContextSetShouldAntialias(cr, shouldAntialias); + return true; +} + static PyObject* GraphicsContext_set_antialiased (GraphicsContext* self, PyObject* args) { - int shouldAntialias; - if (!PyArg_ParseTuple(args, "i", &shouldAntialias)) return NULL; CGContextRef cr = self->cr; if (!cr) { PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); return NULL; } - CGContextSetShouldAntialias(cr, shouldAntialias); + if (!_set_antialiased(cr, args)) return NULL; Py_INCREF(Py_None); return Py_None; } @@ -694,218 +582,64 @@ static PyObject* GraphicsContext_set_clip_path (GraphicsContext* self, PyObject* args) { + int n; CGContextRef cr = self->cr; + + PyObject* path; + int nd = 2; + npy_intp dims[2] = {3, 3}; + int typenum = NPY_DOUBLE; + double data[] = {1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0}; + if (!cr) { PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL"); return NULL; } - PyObject* path; - if(!PyArg_ParseTuple(args, "O", &path)) return NULL; - PyObject* vertices = PyObject_GetAttrString(path, "vertices"); - if (vertices==NULL) - { - PyErr_SetString(PyExc_AttributeError, "path has no vertices"); - return NULL; - } - Py_DECREF(vertices); /* Don't keep a reference here */ + PyObject* transform = PyArray_SimpleNewFromData(nd, dims, typenum, data); + if (!transform) return NULL; - PyObject* codes = PyObject_GetAttrString(path, "codes"); - if (codes==NULL) + double rect[4] = {0.0, 0.0, self->size.width, self->size.height}; + void* iterator = get_path_iterator(path, + transform, + 0, + 0, + rect, + QUANTIZE_AUTO, + 0); + Py_DECREF(transform); + if (!iterator) { - PyErr_SetString(PyExc_AttributeError, "path has no codes"); + PyErr_SetString(PyExc_RuntimeError, + "set_clip_path: failed to obtain path iterator for clipping"); return NULL; } - Py_DECREF(codes); /* Don't keep a reference here */ + n = _draw_path(cr, iterator); + free_path_iterator(iterator); - PyArrayObject* coordinates; - coordinates = (PyArrayObject*)PyArray_FromObject(vertices, - NPY_DOUBLE, 2, 2); - if (!coordinates) - { - PyErr_SetString(PyExc_ValueError, "failed to convert vertices array"); - return NULL; - } + if (n > 0) CGContextClip(cr); - if (PyArray_NDIM(coordinates) != 2 || PyArray_DIM(coordinates, 1) != 2) - { - Py_DECREF(coordinates); - PyErr_SetString(PyExc_ValueError, "invalid vertices array"); - return NULL; - } - - npy_intp n = PyArray_DIM(coordinates, 0); - - if (n==0) /* Nothing to do here */ - { - Py_DECREF(coordinates); - return NULL; - } - - PyArrayObject* codelist = NULL; - if (codes != Py_None) - { - codelist = (PyArrayObject*)PyArray_FromObject(codes, - NPY_UINT8, 1, 1); - if (!codelist) - { - Py_DECREF(coordinates); - PyErr_SetString(PyExc_ValueError, "invalid codes array"); - return NULL; - } - } - - CGFloat x, y; - - if (codelist==NULL) - { - npy_intp i; - npy_uint8 code = MOVETO; - for (i = 0; i < n; i++) - { - x = (CGFloat)(*(double*)PyArray_GETPTR2(coordinates, i, 0)); - y = (CGFloat)(*(double*)PyArray_GETPTR2(coordinates, i, 1)); - if (isnan(x) || isnan(y)) - { - code = MOVETO; - } - else - { - switch (code) - { - case MOVETO: - CGContextMoveToPoint(cr, x, y); - break; - case LINETO: - CGContextAddLineToPoint(cr, x, y); - break; - } - code = LINETO; - } - } - } - else - { - npy_intp i = 0; - BOOL was_nan = false; - npy_uint8 code; - CGFloat x1, y1, x2, y2, x3, y3; - while (i < n) - { - code = *(npy_uint8*)PyArray_GETPTR1(codelist, i); - if (code == CLOSEPOLY) - { - CGContextClosePath(cr); - i++; - } - else if (code == STOP) - { - break; - } - else if (was_nan) - { - if (code==CURVE3) i++; - else if (code==CURVE4) i+=2; - x1 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 0)); - y1 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 1)); - i++; - if (isnan(x1) || isnan(y1)) - { - was_nan = true; - } - else - { - CGContextMoveToPoint(cr, x1, y1); - was_nan = false; - } - } - else if (code==MOVETO) - { - x1 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 0)); - y1 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 1)); - i++; - if (isnan(x1) || isnan(y1)) - { - was_nan = true; - } - else - { - CGContextMoveToPoint(cr, x1, y1); - was_nan = false; - } - } - else if (code==LINETO) - { - x1 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 0)); - y1 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 1)); - i++; - if (isnan(x1) || isnan(y1)) - { - was_nan = true; - } - else - { - CGContextAddLineToPoint(cr, x1, y1); - was_nan = false; - } - } - else if (code==CURVE3) - { - x1 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 0)); - y1 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 1)); - i++; - x2 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 0)); - y2 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 1)); - i++; - if (isnan(x1) || isnan(y1) || isnan(x2) || isnan(y2)) - { - was_nan = true; - } - else - { - CGContextAddQuadCurveToPoint(cr, x1, y1, x2, y2); - was_nan = false; - } - } - else if (code==CURVE4) - { - x1 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 0)); - y1 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 1)); - i++; - x2 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 0)); - y2 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 1)); - i++; - x3 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 0)); - y3 = (CGFloat) (*(double*)PyArray_GETPTR2(coordinates, i, 1)); - i++; - if (isnan(x1) || isnan(y1) || isnan(x2) || isnan(y2) || isnan(x3) || isnan(y3)) - { - was_nan = true; - } - else - { - CGContextAddCurveToPoint(cr, x1, y1, x2, y2, x3, y3); - was_nan = false; - } - } - } - Py_DECREF(codelist); - } - - Py_DECREF(coordinates); - - CGContextClip(cr); Py_INCREF(Py_None); return Py_None; } static BOOL -_set_dashes(CGContextRef cr, PyObject* offset, PyObject* dashes) +_set_dashes(CGContextRef cr, PyObject* linestyle) { float phase = 0.0; + PyObject* offset; + PyObject* dashes; + + if (!PyArg_ParseTuple(linestyle, "OO", &offset, &dashes)) + { + PyErr_SetString(PyExc_TypeError, + "failed to obtain the offset and dashes from the linestyle"); + return false; + } + if (offset!=Py_None) { if (PyFloat_Check(offset)) phase = PyFloat_AsDouble(offset); @@ -965,11 +699,6 @@ static PyObject* GraphicsContext_set_dashes (GraphicsContext* self, PyObject* args) { - PyObject* offset; - PyObject* dashes; - - if (!PyArg_ParseTuple(args, "OO", &offset, &dashes)) return NULL; - CGContextRef cr = self->cr; if (!cr) { @@ -977,14 +706,11 @@ return NULL; } - BOOL ok = _set_dashes(cr, offset, dashes); - if (ok) - { - Py_INCREF(Py_None); - return Py_None; - } - else + if (!_set_dashes(cr, args)) return NULL; + + Py_INCREF(Py_None); + return Py_None; } static PyObject* @@ -1072,54 +798,6 @@ return Py_None; } -static int -_convert_affine_transform(PyObject* object, AffineTransform* transform) -/* Reads a Numpy affine transformation matrix and returns an - * AffineTransform structure - */ -{ - PyArrayObject* matrix = NULL; - if (object==Py_None) - { - PyErr_SetString(PyExc_ValueError, - "Found affine transformation matrix equal to None"); - return 0; - } - matrix = (PyArrayObject*) PyArray_FromObject(object, NPY_DOUBLE, 2, 2); - if (!matrix) - { - PyErr_SetString(PyExc_ValueError, - "Invalid affine transformation matrix"); - return 0; - } - if (PyArray_NDIM(matrix) != 2 || PyArray_DIM(matrix, 0) != 3 || PyArray_DIM(matrix, 1) != 3) - { - Py_DECREF(matrix); - PyErr_SetString(PyExc_ValueError, - "Affine transformation matrix has invalid dimensions"); - return 0; - } - - size_t stride0 = (size_t)PyArray_STRIDE(matrix, 0); - size_t stride1 = (size_t)PyArray_STRIDE(matrix, 1); - char* row0 = PyArray_BYTES(matrix); - char* row1 = row0 + stride0; - - transform->a = *(double*)(row0); - row0 += stride1; - transform->c = *(double*)(row0); - row0 += stride1; - transform->tx = *(double*)(row0); - transform->b = *(double*)(row1); - row1 += stride1; - transform->d = *(double*)(row1); - row1 += stride1; - transform->ty = *(double*)(row1); - - Py_DECREF(matrix); - return 1; -} - static PyObject* GraphicsContext_draw_path (GraphicsContext* self, PyObject* args) { @@ -1127,9 +805,12 @@ PyObject* transform; PyObject* rgbFace; - int ok; + int n; + void* iterator; + CGContextRef cr = self->cr; + double rect[4] = { 0.0, 0.0, self->size.width, self->size.height}; if (!cr) { @@ -1144,24 +825,30 @@ if(rgbFace==Py_None) rgbFace = NULL; - AffineTransform affine; - ok = _convert_affine_transform(transform, &affine); - if (!ok) return NULL; + iterator = get_path_iterator(path, + transform, + 1, + 0, + rect, + QUANTIZE_AUTO, + 1); + if (!iterator) + { + PyErr_SetString(PyExc_RuntimeError, + "draw_path: failed to obtain path iterator"); + return NULL; + } + n = _draw_path(cr, iterator); + free_path_iterator(iterator); - int n = _draw_path(cr, path, affine); - if (n==-1) return NULL; - if (n > 0) { PyObject* hatchpath; if(rgbFace) { float r, g, b; - ok = PyArg_ParseTuple(rgbFace, "fff", &r, &g, &b); - if (!ok) - { + if (!PyArg_ParseTuple(rgbFace, "fff", &r, &g, &b)) return NULL; - } CGContextSaveGState(cr); CGContextSetRGBFillColor(cr, r, g, b, 1.0); CGContextDrawPath(cr, kCGPathFillStroke); @@ -1180,8 +867,11 @@ } else { + int ok; float color[4] = {0, 0, 0, 1}; CGPatternRef pattern; + CGColorSpaceRef baseSpace; + CGColorSpaceRef patternSpace; static const CGPatternCallbacks callbacks = {0, &_draw_hatch, &_release_hatch}; @@ -1199,9 +889,23 @@ return NULL; } - CGColorSpaceRef baseSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); - CGColorSpaceRef patternSpace = CGColorSpaceCreatePattern(baseSpace); + baseSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); + if (!baseSpace) + { + Py_DECREF(hatchpath); + PyErr_SetString(PyExc_RuntimeError, + "draw_path: CGColorSpaceCreateWithName failed"); + return NULL; + } + patternSpace = CGColorSpaceCreatePattern(baseSpace); CGColorSpaceRelease(baseSpace); + if (!patternSpace) + { + Py_DECREF(hatchpath); + PyErr_SetString(PyExc_RuntimeError, + "draw_path: CGColorSpaceCreatePattern failed"); + return NULL; + } CGContextSetFillColorSpace(cr, patternSpace); CGColorSpaceRelease(patternSpace); @@ -1214,7 +918,22 @@ &callbacks); CGContextSetFillPattern(cr, pattern, color); CGPatternRelease(pattern); - _draw_path(cr, path, affine); + iterator = get_path_iterator(path, + transform, + 1, + 0, + rect, + QUANTIZE_AUTO, + 1); + if (!iterator) + { + Py_DECREF(hatchpath); + PyErr_SetString(PyExc_RuntimeError, + "draw_path: failed to obtain path iterator for hatching"); + return NULL; + } + n = _draw_path(cr, iterator); + free_path_iterator(iterator); CGContextFillPath(cr); } } @@ -1234,8 +953,14 @@ int ok; float r, g, b; - double x, y; + CGMutablePathRef marker; + void* iterator; + double rect[4] = {0.0, 0.0, self->size.width, self->size.height}; + enum e_quantize_mode mode; + double xc, yc; + unsigned code; + CGContextRef cr = self->cr; if (!cr) @@ -1263,60 +988,68 @@ CGContextSetRGBFillColor(cr, r, g, b, 1.0); } - AffineTransform affine; - ok = _convert_affine_transform(transform, &affine); - if (!ok) return NULL; - - AffineTransform marker_affine; - ok = _convert_affine_transform(marker_transform, &marker_affine); - if (!ok) return NULL; - - PyObject* vertices = PyObject_GetAttrString(path, "vertices"); - if (vertices==NULL) + ok = _get_snap(self, &mode); + if (!ok) { - PyErr_SetString(PyExc_AttributeError, "path has no vertices"); return NULL; } - Py_DECREF(vertices); /* Don't keep a reference here */ - PyArrayObject* coordinates; - coordinates = (PyArrayObject*)PyArray_FromObject(vertices, - NPY_DOUBLE, 2, 2); - if (!coordinates) + iterator = get_path_iterator(marker_path, + marker_transform, + 0, + 0, + rect, + mode, + 0); + if (!iterator) { - PyErr_SetString(PyExc_ValueError, "failed to convert vertices array"); + PyErr_SetString(PyExc_RuntimeError, + "draw_markers: failed to obtain path iterator for marker"); return NULL; } - - if (PyArray_NDIM(coordinates) != 2 || PyArray_DIM(coordinates, 1) != 2) + marker = _create_path(iterator); + free_path_iterator(iterator); + if (!marker) { - Py_DECREF(coordinates); - PyErr_SetString(PyExc_ValueError, "invalid vertices array"); + PyErr_SetString(PyExc_RuntimeError, + "draw_markers: failed to draw marker path"); return NULL; } - - npy_intp i; - npy_intp n = PyArray_DIM(coordinates, 0); - AffineTransform t; - int m = 0; - for (i = 0; i < n; i++) + iterator = get_path_iterator(path, + transform, + 1, + 1, + rect, + QUANTIZE_TRUE, + 0); + if (!iterator) { - x = *(double*)PyArray_GETPTR2(coordinates, i, 0); - y = *(double*)PyArray_GETPTR2(coordinates, i, 1); - t = marker_affine; - t.tx += affine.a*x + affine.c*y + affine.tx; - t.ty += affine.b*x + affine.d*y + affine.ty; - m = _draw_path(cr, marker_path, t); + CGPathRelease(marker); + PyErr_SetString(PyExc_RuntimeError, + "draw_markers: failed to obtain path iterator"); + return NULL; + } - if (m > 0) + while (true) + { + code = get_vertex(iterator, &xc, &yc); + if (code == STOP) { - if(rgbFace) CGContextDrawPath(cr, kCGPathFillStroke); - else CGContextStrokePath(cr); + break; } + else if (code == MOVETO || code == LINETO || code == CURVE3 || code ==CURVE4) + { + CGContextSaveGState(cr); + CGContextTranslateCTM(cr, xc, yc); + CGContextAddPath(cr, marker); + CGContextRestoreGState(cr); + } + if(rgbFace) CGContextDrawPath(cr, kCGPathFillStroke); + else CGContextStrokePath(cr); } + free_path_iterator(iterator); + CGPathRelease(marker); - Py_DECREF(coordinates); - Py_INCREF(Py_None); return Py_None; } @@ -1358,20 +1091,53 @@ return true; } +static BOOL +_set_offset(CGContextRef cr, PyObject* offsets, int index, PyObject* transform) +{ + CGFloat tx; + CGFloat ty; + double x = *(double*)PyArray_GETPTR2(offsets, index, 0); + double y = *(double*)PyArray_GETPTR2(offsets, index, 1); + PyObject* translation = PyObject_CallMethod(transform, "transform_point", + "((ff))", x, y); + if (!translation) + { + return false; + } + if (!PyArray_Check(translation)) + { + Py_DECREF(translation); + PyErr_SetString(PyExc_ValueError, + "transform_point did not return a NumPy array"); + return false; + } + if (PyArray_NDIM(translation)!=1 || PyArray_DIM(translation, 0)!=2) + { + Py_DECREF(translation); + PyErr_SetString(PyExc_ValueError, + "transform_point did not return an approriate array"); + return false; + } + tx = (CGFloat)(*(double*)PyArray_GETPTR1(translation, 0)); + ty = (CGFloat)(*(double*)PyArray_GETPTR1(translation, 1)); + Py_DECREF(translation); + CGContextTranslateCTM(cr, tx, ty); + return true; +} static PyObject* GraphicsContext_draw_path_collection (GraphicsContext* self, PyObject* args) { - PyObject* master_transform_obj; + PyObject* master_transform; PyObject* cliprect; PyObject* clippath; PyObject* clippath_transform; PyObject* paths; - PyObject* transforms_obj; - PyObject* offsets_obj; - PyObject* offset_transform_obj; - PyObject* facecolors_obj; - PyObject* edgecolors_obj; + PyObject* transforms; + PyObject* offsets; + PyObject* offset_transform; + PyObject* facecolors; + PyObject* edgecolors; PyObject* linewidths; PyObject* linestyles; PyObject* antialiaseds; @@ -1384,172 +1150,298 @@ return NULL; } - if(!PyArg_ParseTuple(args, "OOOOOOOOOOOOO", &master_transform_obj, + if(!PyArg_ParseTuple(args, "OOOOOOOOOOOOO", &master_transform, &cliprect, &clippath, &clippath_transform, &paths, - &transforms_obj, - &offsets_obj, - &offset_transform_obj, - &facecolors_obj, - &edgecolors_obj, + &transforms, + &offsets, + &offset_transform, + &facecolors, + &edgecolors, &linewidths, &linestyles, &antialiaseds)) return NULL; - CGContextSaveGState(cr); + int ok = 1; + Py_ssize_t i; + Py_ssize_t Np = 0; + Py_ssize_t N = 0; - AffineTransform transform; - AffineTransform master_transform; - AffineTransform offset_transform; - AffineTransform* transforms = NULL; + CGMutablePathRef* p = NULL; - if (!_convert_affine_transform(master_transform_obj, &master_transform)) return NULL; - if (!_convert_affine_transform(offset_transform_obj, &offset_transform)) return NULL; + /* --------- Prepare some variables for the path iterator ------------- */ + void* iterator; + double rect[4] = {0.0, 0.0, self->size.width, self->size.height}; + enum e_quantize_mode mode; + ok = _get_snap(self, &mode); + if (!ok) + { + return NULL; + } - if (!_clip(cr, cliprect)) return NULL; - if (clippath!=Py_None) + /* ------------------- Check paths ------------------------------------ */ + + if (!PySequence_Check(paths)) { - if (!_convert_affine_transform(clippath_transform, &transform)) return NULL; - int n = _draw_path(cr, clippath, transform); - if (n==-1) return NULL; - else if (n > 0) CGContextClip(cr); + PyErr_SetString(PyExc_ValueError, "paths must be a sequence object"); + return NULL; } + const Py_ssize_t Npaths = PySequence_Size(paths); - PyArrayObject* offsets = NULL; - PyArrayObject* facecolors = NULL; - PyArrayObject* edgecolors = NULL; + /* ------------------- Check transforms ------------------------------- */ + if (!PySequence_Check(transforms)) + { + PyErr_SetString(PyExc_ValueError, "transforms must be a sequence object"); + return NULL; + } + Py_ssize_t Ntransforms = PySequence_Size(transforms); + + CGContextSaveGState(cr); + /* ------------------- Set master transform --------------------------- */ + + if (Ntransforms) + { + PyObject* values = PyObject_CallMethod(master_transform, "to_values", ""); + if (!values) + { + ok = 0; + goto exit; + } + if (!PyTuple_Check(values)) + { + Py_DECREF(values); + ok = 0; + goto exit; + } + CGAffineTransform master; + ok = PyArg_ParseTuple(values, "ffffff", + &master.a, + &master.b, + &master.c, + &master.d, + &master.tx, + &master.ty); + Py_DECREF(values); + if (!ok) goto exit; + CGContextConcatCTM(cr, master); + } + /* ------------------- Check offsets array ---------------------------- */ - offsets = (PyArrayObject*)PyArray_FromObject(offsets_obj, NPY_DOUBLE, 0, 2); + offsets = PyArray_FromObject(offsets, NPY_DOUBLE, 0, 2); if (!offsets || (PyArray_NDIM(offsets)==2 && PyArray_DIM(offsets, 1)!=2) || (PyArray_NDIM(offsets)==1 && PyArray_DIM(offsets, 0)!=0)) { PyErr_SetString(PyExc_ValueError, "Offsets array must be Nx2"); - goto error; + ok = 0; + goto exit; } + const Py_ssize_t Noffsets = PyArray_DIM(offsets, 0); + /* -------------------------------------------------------------------- */ + + Np = Npaths > Ntransforms ? Npaths : Ntransforms; + N = Np > Noffsets ? Np : Noffsets; + if (N < Ntransforms) Ntransforms = N; + + p = malloc(Np*sizeof(CGMutablePathRef)); + if (!p) + { + ok = 0; + goto exit; + } + for (i = 0; i < Np; i++) + { + PyObject* path; + PyObject* transform; + p[i] = NULL; + path = PySequence_ITEM(paths, i % Npaths); + if (!path) + { + ok = 0; + goto exit; + } + if (Ntransforms) + { + transform = PySequence_ITEM(transforms, i % Ntransforms); + if (!transform) + { + PyErr_SetString(PyExc_RuntimeError, + "failed to obtain transform"); + ok = 0; + goto exit; + } + iterator = get_path_iterator(path, + transform, + 1, + 0, + rect, + mode, + 0); + Py_DECREF(transform); + } + else + { + iterator = get_path_iterator(path, + master_transform, + 1, + 0, + rect, + mode, + 0); + } + Py_DECREF(path); + if (!iterator) + { + PyErr_SetString(PyExc_RuntimeError, + "failed to obtain path iterator"); + ok = 0; + goto exit; + } + p[i] = _create_path(iterator); + free_path_iterator(iterator); + if (!p[i]) + { + PyErr_SetString(PyExc_RuntimeError, "failed to create path"); + ok = 0; + goto exit; + } + } + + /* ------------------- Set clipping path ------------------------------ */ + + if (!_clip(cr, cliprect)) + { + ok = 0; + goto exit; + } + if (clippath!=Py_None) + { + int n; + iterator = get_path_iterator(clippath, + clippath_transform, + 0, + 0, + rect, + QUANTIZE_AUTO, + 0); + if (!iterator) + { + PyErr_SetString(PyExc_RuntimeError, + "draw_path_collection: failed to obtain path iterator for clipping"); + ok = 0; + goto exit; + } + n = _draw_path(cr, iterator); + free_path_iterator(iterator); + if (n > 0) CGContextClip(cr); + } + /* ------------------- Check facecolors array ------------------------- */ - facecolors = (PyArrayObject*)PyArray_FromObject(facecolors_obj, - NPY_DOUBLE, 1, 2); + facecolors = PyArray_FromObject(facecolors, NPY_DOUBLE, 1, 2); if (!facecolors || (PyArray_NDIM(facecolors)==1 && PyArray_DIM(facecolors, 0)!=0) || (PyArray_NDIM(facecolors)==2 && PyArray_DIM(facecolors, 1)!=4)) { PyErr_SetString(PyExc_ValueError, "Facecolors must by a Nx4 numpy array or empty"); - goto error; + ok = 0; + goto exit; } /* ------------------- Check edgecolors array ------------------------- */ - edgecolors = (PyArrayObject*)PyArray_FromObject(edgecolors_obj, - NPY_DOUBLE, 1, 2); + edgecolors = PyArray_FromObject(edgecolors, NPY_DOUBLE, 1, 2); if (!edgecolors || (PyArray_NDIM(edgecolors)==1 && PyArray_DIM(edgecolors, 0)!=0) || (PyArray_NDIM(edgecolors)==2 && PyArray_DIM(edgecolors, 1)!=4)) { PyErr_SetString(PyExc_ValueError, "Edgecolors must by a Nx4 numpy array or empty"); - goto error; + ok = 0; + goto exit; } /* ------------------- Check the other arguments ---------------------- */ - if (!PySequence_Check(paths)) - { - PyErr_SetString(PyExc_ValueError, "paths must be a sequence object"); - goto error; - } - if (!PySequence_Check(transforms_obj)) - { - PyErr_SetString(PyExc_ValueError, "transforms must be a sequence object"); - goto error; - } if (!PySequence_Check(linewidths)) { PyErr_SetString(PyExc_ValueError, "linewidths must be a sequence object"); - goto error; + ok = 0; + goto exit; } if (!PySequence_Check(linestyles)) { PyErr_SetString(PyExc_ValueError, "linestyles must be a sequence object"); - goto error; + ok = 0; + goto exit; } if (!PySequence_Check(antialiaseds)) { PyErr_SetString(PyExc_ValueError, "antialiaseds must be a sequence object"); - goto error; + ok = 0; + goto exit; } - size_t Npaths = (size_t) PySequence_Size(paths); - size_t Noffsets = (size_t) PyArray_DIM(offsets, 0); - size_t N = Npaths > Noffsets ? Npaths : Noffsets; - size_t Ntransforms = (size_t) PySequence_Size(transforms_obj); - size_t Nfacecolors = (size_t) PyArray_DIM(facecolors, 0); - size_t Nedgecolors = (size_t) PyArray_DIM(edgecolors, 0); - size_t Nlinewidths = (size_t) PySequence_Size(linewidths); - size_t Nlinestyles = (size_t) PySequence_Size(linestyles); - size_t Naa = (size_t) PySequence_Size(antialiaseds); - if (N < Ntransforms) Ntransforms = N; + Py_ssize_t Nfacecolors = PyArray_DIM(facecolors, 0); + Py_ssize_t Nedgecolors = PyArray_DIM(edgecolors, 0); + Py_ssize_t Nlinewidths = PySequence_Size(linewidths); + Py_ssize_t Nlinestyles = PySequence_Size(linestyles); + Py_ssize_t Naa = PySequence_Size(antialiaseds); if (N < Nlinestyles) Nlinestyles = N; - if ((Nfacecolors == 0 && Nedgecolors == 0) || Npaths == 0) - { - goto success; - } + if ((Nfacecolors == 0 && Nedgecolors == 0) || Np == 0) goto exit; - size_t i = 0; - - /* Convert all of the transforms up front */ - if (Ntransforms > 0) - { - transforms = malloc(Ntransforms*sizeof(AffineTransform)); - if (!transforms) goto error; - for (i = 0; i < Ntransforms; i++) - { - PyObject* transform_obj = PySequence_ITEM(transforms_obj, i); - if(!_convert_affine_transform(transform_obj, &transforms[i])) goto error; - transforms[i] = AffineTransformConcat(transforms[i], master_transform); - } - } - - PyObject* path; - double x, y; - /* Preset graphics context properties if possible */ if (Naa==1) { - switch(PyObject_IsTrue(PySequence_ITEM(antialiaseds, 0))) + PyObject* antialiased = PySequence_ITEM(antialiaseds, 0); + if (antialiased) { - case 1: CGContextSetShouldAntialias(cr, true); break; - case 0: CGContextSetShouldAntialias(cr, false); break; - case -1: - { - PyErr_SetString(PyExc_ValueError, - "Failed to read antialiaseds array"); - goto error; - } + ok = _set_antialiased(cr, antialiased); + Py_DECREF(antialiased); } + else + { + PyErr_SetString(PyExc_SystemError, + "Failed to read element from antialiaseds array"); + ok = 0; + } + if (!ok) goto exit; } if (Nlinewidths==1) { - double linewidth = PyFloat_AsDouble(PySequence_ITEM(linewidths, 0)); - CGContextSetLineWidth(cr, (CGFloat)linewidth); + PyObject* linewidth = PySequence_ITEM(linewidths, 0); + if (!linewidth) + { + PyErr_SetString(PyExc_SystemError, + "Failed to read element from linewidths array"); + ok = 0; + goto exit; + } + CGContextSetLineWidth(cr, (CGFloat)PyFloat_AsDouble(linewidth)); + Py_DECREF(linewidth); } else if (Nlinewidths==0) CGContextSetLineWidth(cr, 0.0); if (Nlinestyles==1) { - PyObject* offset; - PyObject* dashes; PyObject* linestyle = PySequence_ITEM(linestyles, 0); - if (!PyArg_ParseTuple(linestyle, "OO", &offset, &dashes)) goto error; - if (!_set_dashes(cr, offset, dashes)) goto error; + if (!linestyle) + { + PyErr_SetString(PyExc_SystemError, + "Failed to read element from linestyles array"); + ok = 0; + goto exit; + } + ok = _set_dashes(cr, linestyle); + Py_DECREF(linestyle); + if (!ok) goto exit; } if (Nedgecolors==1) @@ -1572,57 +1464,63 @@ for (i = 0; i < N; i++) { + if (CGPathIsEmpty(p[i % Np])) continue; - if (Ntransforms) - { - transform = transforms[i % Ntransforms]; - } - else - { - transform = master_transform; - } - + CGContextSaveGState(cr); if (Noffsets) { - x = *(double*)PyArray_GETPTR2(offsets, i % Noffsets, 0); - y = *(double*)PyArray_GETPTR2(offsets, i % Noffsets, 1); - transform.tx += offset_transform.a*x + offset_transform.c*y + offset_transform.tx; - transform.ty += offset_transform.b*x + offset_transform.d*y + offset_transform.ty; + ok = _set_offset(cr, offsets, i % Noffsets, offset_transform); + if (!ok) + { + CGContextRestoreGState(cr); + goto exit; + } } if (Naa > 1) { - switch(PyObject_IsTrue(PySequence_ITEM(antialiaseds, i % Naa))) + PyObject* antialiased = PySequence_ITEM(antialiaseds, i % Naa); + if (antialiased) { - case 1: CGContextSetShouldAntialias(cr, true); break; - case 0: CGContextSetShouldAntialias(cr, false); break; - case -1: - { - PyErr_SetString(PyExc_ValueError, - "Failed to read antialiaseds array"); - goto error; - } + ok = _set_antialiased(cr, antialiased); + Py_DECREF(antialiased); } + else + { + PyErr_SetString(PyExc_SystemError, + "Failed to read element from antialiaseds array"); + ok = 0; + } + if (!ok) goto exit; } - path = PySequence_ITEM(paths, i % Npaths); - int n = _draw_path(cr, path, transform); - if (n==-1) goto error; - else if (n==0) continue; - if (Nlinewidths > 1) { - double linewidth = PyFloat_AsDouble(PySequence_ITEM(linewidths, i % Nlinewidths)); - CGContextSetLineWidth(cr, (CGFloat)linewidth); + PyObject* linewidth = PySequence_ITEM(linewidths, i % Nlinewidths); + if (!linewidth) + { + PyErr_SetString(PyExc_SystemError, + "Failed to read element from linewidths array"); + ok = 0; + goto exit; + } + CGContextSetLineWidth(cr, (CGFloat)PyFloat_AsDouble(linewidth)); + Py_DECREF(linewidth); } if (Nlinestyles > 1) { - PyObject* offset; - PyObject* dashes; PyObject* linestyle = PySequence_ITEM(linestyles, i % Nlinestyles); - if (!PyArg_ParseTuple(linestyle, "OO", &offset, &dashes)) goto error; - if (!_set_dashes(cr, offset, dashes)) goto error; + if (!linestyle) + { + PyErr_SetString(PyExc_SystemError, + "Failed to read element from linestyles array"); + ok = 0; + goto exit; + } + ok = _set_dashes(cr, linestyle); + Py_DECREF(linestyle); + if (!ok) goto exit; } if (Nedgecolors > 1) @@ -1635,6 +1533,8 @@ CGContextSetRGBStrokeColor(cr, r, g, b, a); } + CGContextAddPath(cr, p[i % Np]); + if (Nfacecolors > 1) { npy_intp fi = i % Nfacecolors; @@ -1649,41 +1549,42 @@ CGContextDrawPath(cr, kCGPathFillStroke); else CGContextStrokePath(cr); + CGContextRestoreGState(cr); } -success: +exit: CGContextRestoreGState(cr); - if (transforms) free(transforms); - Py_DECREF(offsets); - Py_DECREF(facecolors); - Py_DECREF(edgecolors); - - Py_INCREF(Py_None); - return Py_None; - -error: - CGContextRestoreGState(cr); - if (transforms) free(transforms); Py_XDECREF(offsets); Py_XDECREF(facecolors); Py_XDECREF(edgecolors); + if (p) + { + for (i = 0; i < Np; i++) + { + if (!p[i]) break; + CGPathRelease(p[i]); + } + free(p); + } + if (!ok) return NULL; - return NULL; + Py_INCREF(Py_None); + return Py_None; } static PyObject* GraphicsContext_draw_quad_mesh (GraphicsContext* self, PyObject* args) { - PyObject* mas... [truncated message content] |
From: <js...@us...> - 2009-03-14 13:22:41
|
Revision: 6975 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6975&view=rev Author: jswhit Date: 2009-03-14 13:22:32 +0000 (Sat, 14 Mar 2009) Log Message: ----------- added 'lightsource' class to colors module, shading_example.py to illustrate it's usage to create shaded relief maps with imshow. Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/colors.py Added Paths: ----------- trunk/matplotlib/examples/pylab_examples/shading_example.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2009-03-13 17:13:49 UTC (rev 6974) +++ trunk/matplotlib/CHANGELOG 2009-03-14 13:22:32 UTC (rev 6975) @@ -1,3 +1,7 @@ +2009-03-14 Added 'lightsource' class to colors module for + creating shaded relief maps. shading_example.py + added to illustrate usage. - JSW + 2009-03-11 Ensure wx version >= 2.8; thanks to Sandro Tosi and Chris Barker. - EF Added: trunk/matplotlib/examples/pylab_examples/shading_example.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/shading_example.py (rev 0) +++ trunk/matplotlib/examples/pylab_examples/shading_example.py 2009-03-14 13:22:32 UTC (rev 6975) @@ -0,0 +1,28 @@ +import numpy as np +import matplotlib.pyplot as plt +from matplotlib.colors import lightsource + +# example showing how to make shaded relief plots +# like mathematica +# (http://reference.wolfram.com/mathematica/ref/ReliefPlot.html ) +# or Generic Mapping Tools +# (http://gmt.soest.hawaii.edu/gmt/doc/gmt/html/GMT_Docs/node145.html) + +# test data +X,Y=np.mgrid[-5:5:0.1,-5:5:0.1] +Z=X+np.sin(X**2+Y**2) +# creat light source object. +ls = lightsource(azdeg=270,altdeg=20) +# shade data, creating an rgb array. +rgb = ls.shade(Z,plt.cm.copper) +# plot un-shaded and shaded images. +plt.figure(figsize=(12,5)) +plt.subplot(121) +plt.imshow(Z,cmap=plt.cm.copper) +plt.title('imshow') +plt.xticks([]); plt.yticks([]) +plt.subplot(122) +plt.imshow(rgb) +plt.title('imshow with shading') +plt.xticks([]); plt.yticks([]) +plt.show() Modified: trunk/matplotlib/lib/matplotlib/colors.py =================================================================== --- trunk/matplotlib/lib/matplotlib/colors.py 2009-03-13 17:13:49 UTC (rev 6974) +++ trunk/matplotlib/lib/matplotlib/colors.py 2009-03-14 13:22:32 UTC (rev 6975) @@ -900,3 +900,130 @@ # compatibility with earlier class names that violated convention: normalize = Normalize no_norm = NoNorm + +def rgb_to_hsv(arr): + """ + convert rgb values in a numpy array to hsv values + input and output arrays should have shape (M,N,3) + """ + out = np.empty_like(arr) + arr_max = arr.max(-1) + delta = arr.ptp(-1) + s = delta / arr_max + s[delta==0] = 0 + # red is max + idx = (arr[:,:,0] == arr_max) + out[idx, 0] = (arr[idx, 1] - arr[idx, 2]) / delta[idx] + # green is max + idx = (arr[:,:,1] == arr_max) + out[idx, 0] = 2. + (arr[idx, 2] - arr[idx, 0] ) / delta[idx] + # blue is max + idx = (arr[:,:,2] == arr_max) + out[idx, 0] = 4. + (arr[idx, 0] - arr[idx, 1] ) / delta[idx] + out[:,:,0] = (out[:,:,0]/6.0) % 1.0 + out[:,:,1] = s + out[:,:,2] = arr_max + return out + +def hsv_to_rgb(hsv): + """ + convert hsv values in a numpy array to rgb values + both input and output arrays have shape (M,N,3) + """ + h = hsv[:,:,0]; s = hsv[:,:,1]; v = hsv[:,:,2] + r = np.empty_like(h); g = np.empty_like(h); b = np.empty_like(h) + i = (h*6.0).astype(np.int) + f = (h*6.0) - i + p = v*(1.0 - s) + q = v*(1.0 - s*f) + t = v*(1.0 - s*(1.0-f)) + idx = i%6 == 0 + r[idx] = v[idx]; g[idx] = t[idx]; b[idx] = p[idx] + idx = i == 1 + r[idx] = q[idx]; g[idx] = v[idx]; b[idx] = p[idx] + idx = i == 2 + r[idx] = p[idx]; g[idx] = v[idx]; b[idx] = t[idx] + idx = i == 3 + r[idx] = p[idx]; g[idx] = q[idx]; b[idx] = v[idx] + idx = i == 4 + r[idx] = t[idx]; g[idx] = p[idx]; b[idx] = v[idx] + idx = i == 5 + r[idx] = v[idx]; g[idx] = p[idx]; b[idx] = q[idx] + idx = s == 0 + r[idx] = v[idx]; g[idx] = v[idx]; b[idx] = v[idx] + return np.array((r,g,b)).T + +class lightsource(object): + """ + Create a light source coming from the specified azimuth and elevation. + Angles are in degrees, with the azimuth measured + clockwise from south and elevation up from the zero plane of the surface. + The :meth:`shade` is used to produce rgb values for a shaded relief image + given a data array. + """ + def __init__(self,azdeg=315,altdeg=45,\ + hsv_min_val=0,hsv_max_val=1,hsv_min_sat=1,hsv_max_sat=0): + """ + Specify the azimuth (measured clockwise from south) and altitude + (measured up from the plane of the surface) of the light source + in degrees. + + The color of the resulting image will be darkened + by moving the (s,v) values (in hsv colorspace) toward + (hsv_min_sat, hsv_min_val) in the shaded regions, or + lightened by sliding (s,v) toward + (hsv_max_sat hsv_max_val) in regions that are illuminated. + The default extremes are chose so that completely shaded points + are nearly black (s = 1, v = 0) and completely illuminated points + are nearly white (s = 0, v = 1). + """ + self.azdeg = azdeg + self.altdeg = altdeg + self.hsv_min_val = hsv_min_val + self.hsv_max_val = hsv_max_val + self.hsv_min_sat = hsv_min_sat + self.hsv_max_sat = hsv_max_sat + + def shade(self,data,cmap): + """ + Take the input data array, convert to HSV values in the + given colormap, then adjust those color values + to given the impression of a shaded relief map with a + specified light source. + RGBA values are returned, which can then be used to + plot the shaded image with imshow. + """ + # imagine an artificial sun placed at infinity in + # some azimuth and elevation position illuminating our surface. The parts of + # the surface that slope toward the sun should brighten while those sides + # facing away should become darker. + # convert alt, az to radians + az = self.azdeg*np.pi/180.0 + alt = self.altdeg*np.pi/180.0 + # gradient in x and y directions + dx, dy = np.gradient(data) + slope = 0.5*np.pi - np.arctan(np.hypot(dx, dy)) + aspect = np.arctan2(dx, dy) + intensity = np.sin(alt)*np.sin(slope) + np.cos(alt)*np.cos(slope)*np.cos(-az -\ + aspect - 0.5*np.pi) + # rescale to interval -1,1 + # +1 means maximum sun exposure and -1 means complete shade. + intensity = (intensity - intensity.min())/(intensity.max() - intensity.min()) + intensity = 2.*intensity - 1. + # convert to rgb, then rgb to hsv + rgb = cmap((data-data.min())/(data.max()-data.min())) + hsv = rgb_to_hsv(rgb[:,:,0:3]) + # modify hsv values to simulate illumination. + hsv[:,:,1] = np.where(np.logical_and(np.abs(hsv[:,:,1])>1.e-10,intensity>0),\ + (1.-intensity)*hsv[:,:,1]+intensity*self.hsv_max_sat, hsv[:,:,1]) + hsv[:,:,2] = np.where(intensity > 0, (1.-intensity)*hsv[:,:,1] +\ + intensity*self.hsv_max_val, hsv[:,:,2]) + hsv[:,:,1] = np.where(np.logical_and(np.abs(hsv[:,:,1])>1.e-10,intensity<0),\ + (1.+intensity)*hsv[:,:,1]-intensity*self.hsv_min_sat, hsv[:,:,1]) + hsv[:,:,2] = np.where(intensity < 0, (1.+intensity)*hsv[:,:,1] -\ + intensity*self.hsv_min_val, hsv[:,:,2]) + hsv[:,:,1:] = np.where(hsv[:,:,1:]<0.,0,hsv[:,:,1:]) + hsv[:,:,1:] = np.where(hsv[:,:,1:]>1.,1,hsv[:,:,1:]) + # convert modified hsv back to rgb. + rgb[:,:,0:3] = hsv_to_rgb(hsv) + return rgb This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2009-03-16 19:32:33
|
Revision: 6982 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6982&view=rev Author: jswhit Date: 2009-03-16 19:32:22 +0000 (Mon, 16 Mar 2009) Log Message: ----------- fix small bug in relief plot shading algorithm Modified Paths: -------------- trunk/matplotlib/examples/pylab_examples/shading_example.py trunk/matplotlib/lib/matplotlib/colors.py Modified: trunk/matplotlib/examples/pylab_examples/shading_example.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/shading_example.py 2009-03-16 17:22:07 UTC (rev 6981) +++ trunk/matplotlib/examples/pylab_examples/shading_example.py 2009-03-16 19:32:22 UTC (rev 6982) @@ -9,10 +9,10 @@ # (http://gmt.soest.hawaii.edu/gmt/doc/gmt/html/GMT_Docs/node145.html) # test data -X,Y=np.mgrid[-5:5:0.1,-5:5:0.1] -Z=X+np.sin(X**2+Y**2) +X,Y=np.mgrid[-5:5:0.05,-5:5:0.05] +Z=np.sqrt(X**2+Y**2)+np.sin(X**2+Y**2) # creat light source object. -ls = lightsource(azdeg=270,altdeg=60) +ls = lightsource(azdeg=0,altdeg=65) # shade data, creating an rgb array. rgb = ls.shade(Z,plt.cm.copper) # plot un-shaded and shaded images. Modified: trunk/matplotlib/lib/matplotlib/colors.py =================================================================== --- trunk/matplotlib/lib/matplotlib/colors.py 2009-03-16 17:22:07 UTC (rev 6981) +++ trunk/matplotlib/lib/matplotlib/colors.py 2009-03-16 19:32:22 UTC (rev 6982) @@ -1018,11 +1018,11 @@ # modify hsv values to simulate illumination. hsv[:,:,1] = np.where(np.logical_and(np.abs(hsv[:,:,1])>1.e-10,intensity>0),\ (1.-intensity)*hsv[:,:,1]+intensity*self.hsv_max_sat, hsv[:,:,1]) - hsv[:,:,2] = np.where(intensity > 0, (1.-intensity)*hsv[:,:,1] +\ + hsv[:,:,2] = np.where(intensity > 0, (1.-intensity)*hsv[:,:,2] +\ intensity*self.hsv_max_val, hsv[:,:,2]) hsv[:,:,1] = np.where(np.logical_and(np.abs(hsv[:,:,1])>1.e-10,intensity<0),\ (1.+intensity)*hsv[:,:,1]-intensity*self.hsv_min_sat, hsv[:,:,1]) - hsv[:,:,2] = np.where(intensity < 0, (1.+intensity)*hsv[:,:,1] -\ + hsv[:,:,2] = np.where(intensity < 0, (1.+intensity)*hsv[:,:,2] -\ intensity*self.hsv_min_val, hsv[:,:,2]) hsv[:,:,1:] = np.where(hsv[:,:,1:]<0.,0,hsv[:,:,1:]) hsv[:,:,1:] = np.where(hsv[:,:,1:]>1.,1,hsv[:,:,1:]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2009-03-17 19:45:15
|
Revision: 6986 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6986&view=rev Author: efiring Date: 2009-03-17 19:45:05 +0000 (Tue, 17 Mar 2009) Log Message: ----------- Merged revisions 6984-6985 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_5_maint ........ r6984 | efiring | 2009-03-17 09:15:01 -1000 (Tue, 17 Mar 2009) | 4 lines Fix bug in alpha handling. The alpha kwarg was multiplying the existing alpha instead of replacing it. Thanks to Jae-Joon Lee. ........ r6985 | efiring | 2009-03-17 09:34:27 -1000 (Tue, 17 Mar 2009) | 2 lines In contourf, don't accidentally set the edgecolor. ........ Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/colors.py trunk/matplotlib/lib/matplotlib/contour.py Property Changed: ---------------- trunk/matplotlib/ trunk/matplotlib/doc/pyplots/README trunk/matplotlib/doc/sphinxext/gen_gallery.py trunk/matplotlib/doc/sphinxext/gen_rst.py trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6972 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6985 Modified: svn:mergeinfo - /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972 + /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985 Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2009-03-17 19:34:27 UTC (rev 6985) +++ trunk/matplotlib/CHANGELOG 2009-03-17 19:45:05 UTC (rev 6986) @@ -1,4 +1,7 @@ -2009-03-14 Added 'lightsource' class to colors module for +2009-03-17 Fix bugs in edge color handling by contourf, found + by Jae-Joon Lee. - EF + +2009-03-14 Added 'lightsource' class to colors module for creating shaded relief maps. shading_example.py added to illustrate usage. - JSW Property changes on: trunk/matplotlib/doc/pyplots/README ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985 Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972 + /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985 Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972 + /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985 Modified: trunk/matplotlib/lib/matplotlib/colors.py =================================================================== --- trunk/matplotlib/lib/matplotlib/colors.py 2009-03-17 19:34:27 UTC (rev 6985) +++ trunk/matplotlib/lib/matplotlib/colors.py 2009-03-17 19:45:05 UTC (rev 6986) @@ -331,7 +331,7 @@ return tuple(arg) if alpha < 0.0 or alpha > 1.0: raise ValueError("alpha must be in range 0-1") - return arg[0], arg[1], arg[2], arg[3] * alpha + return arg[0], arg[1], arg[2], alpha r,g,b = arg[:3] if [x for x in (r,g,b) if (float(x) < 0) or (x > 1)]: raise ValueError('number in rbg sequence outside 0-1 range') Modified: trunk/matplotlib/lib/matplotlib/contour.py =================================================================== --- trunk/matplotlib/lib/matplotlib/contour.py 2009-03-17 19:34:27 UTC (rev 6985) +++ trunk/matplotlib/lib/matplotlib/contour.py 2009-03-17 19:45:05 UTC (rev 6986) @@ -629,8 +629,10 @@ self.to_rgba(self.cvalues, alpha=self.alpha)] self.tcolors = tcolors for color, collection in zip(tcolors, self.collections): - collection.set_alpha(self.alpha) - collection.set_color(color) + if self.filled: + collection.set_facecolor(color) + else: + collection.set_color(color) for label, cv in zip(self.labelTexts, self.labelCValues): label.set_alpha(self.alpha) label.set_color(self.labelMappable.to_rgba(cv)) Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972 + /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972 + /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972 + /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2009-03-18 15:52:10
|
Revision: 6991 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6991&view=rev Author: mdboom Date: 2009-03-18 15:52:00 +0000 (Wed, 18 Mar 2009) Log Message: ----------- Merged revisions 6990 via svnmerge from https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_98_5_maint ........ r6990 | mdboom | 2009-03-18 11:48:30 -0400 (Wed, 18 Mar 2009) | 2 lines Fix race condition in tempfile creation in PS backend. If two mpl processes try to create PS files with the same file name and the same time, they will use the same tempfile, and madness, crashing and burning will ensue. ........ Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py Property Changed: ---------------- trunk/matplotlib/ trunk/matplotlib/doc/pyplots/README trunk/matplotlib/doc/sphinxext/gen_gallery.py trunk/matplotlib/doc/sphinxext/gen_rst.py trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6985 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6990 Modified: svn:mergeinfo - /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985 + /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990 Property changes on: trunk/matplotlib/doc/pyplots/README ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990 Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985 + /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990 Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985 + /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990 Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2009-03-18 15:48:30 UTC (rev 6990) +++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2009-03-18 15:52:00 UTC (rev 6991) @@ -11,7 +11,7 @@ except ImportError: from md5 import md5 #Deprecated in 2.5 -from tempfile import gettempdir +from tempfile import mkstemp from cStringIO import StringIO from matplotlib import verbose, __version__, rcParams from matplotlib._pylab_helpers import Gcf @@ -886,15 +886,15 @@ """ isEPSF = format == 'eps' passed_in_file_object = False + fd, tmpfile = mkstemp() if is_string_like(outfile): title = outfile - tmpfile = os.path.join(gettempdir(), md5(outfile).hexdigest()) elif is_writable_file_like(outfile): title = None - tmpfile = os.path.join(gettempdir(), md5(str(hash(outfile))).hexdigest()) passed_in_file_object = True else: raise ValueError("outfile must be a path or a file-like object") + os.close(fd) fh = file(tmpfile, 'w') # find the appropriate papertype @@ -1029,7 +1029,8 @@ title = outfile # write to a temp file, we'll move it to outfile when done - tmpfile = os.path.join(gettempdir(), md5(outfile).hexdigest()) + fd, tmpfile = mkstemp() + os.close(fd) fh = file(tmpfile, 'w') self.figure.dpi = 72 # ignore the dpi kwarg Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985 + /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985 + /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985 + /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |