SourceForge logo
SourceForge logo
Menu

matplotlib-checkins — Commit notification. DO NOT POST to this list, just subscribe to it.

You can subscribe to this list here.

2007 Jan
Feb
Mar
Apr
May
Jun
Jul
(115)
Aug
(120)
Sep
(137)
Oct
(170)
Nov
(461)
Dec
(263)
2008 Jan
(120)
Feb
(74)
Mar
(35)
Apr
(74)
May
(245)
Jun
(356)
Jul
(240)
Aug
(115)
Sep
(78)
Oct
(225)
Nov
(98)
Dec
(271)
2009 Jan
(132)
Feb
(84)
Mar
(74)
Apr
(56)
May
(90)
Jun
(79)
Jul
(83)
Aug
(296)
Sep
(214)
Oct
(76)
Nov
(82)
Dec
(66)
2010 Jan
(46)
Feb
(58)
Mar
(51)
Apr
(77)
May
(58)
Jun
(126)
Jul
(128)
Aug
(64)
Sep
(50)
Oct
(44)
Nov
(48)
Dec
(54)
2011 Jan
(68)
Feb
(52)
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
(1)
2018 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S



1
(3)
2
3
4
(1)
5
(8)
6
(5)
7
8
9
10
11
(1)
12
13
(3)
14
(1)
15
(2)
16
(2)
17
(6)
18
(1)
19
(3)
20
21
(1)
22
23
(5)
24
(4)
25
26
(1)
27
(1)
28
(1)
29
(3)
30
(4)


Showing results of 56

1 2 3 > >> (Page 1 of 3)
From: <lee...@us...> - 2009年04月30日 17:31:30
Revision: 7075
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7075&view=rev
Author: leejjoon
Date: 2009年04月30日 17:31:23 +0000 (2009年4月30日)
Log Message:
-----------
add kwarg bbox_transform for legend. bbox_to_anchor now can be a BboxBase instance
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/legend.py
Modified: trunk/matplotlib/lib/matplotlib/legend.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/legend.py	2009年04月30日 17:05:27 UTC (rev 7074)
+++ trunk/matplotlib/lib/matplotlib/legend.py	2009年04月30日 17:31:23 UTC (rev 7075)
@@ -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, TransformedBbox, BboxTransformTo
+from matplotlib.transforms import Bbox, BboxBase, TransformedBbox, BboxTransformTo
 
 from matplotlib.offsetbox import HPacker, VPacker, TextArea, DrawingArea
 
@@ -112,7 +112,8 @@
 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.
+ bbox_to_anchor = None, # bbox that the legend will be anchored.
+ bbox_transform = None, # transform for the bbox
 ):
 """
 - *parent* : the artist that contains the legend
@@ -138,11 +139,16 @@
 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.
+ bbox_to_anchor the bbox that the legend will be anchored. 
+ bbox_transform the transform for the bbox. transAxes if None.
 ================ ==================================================================
 
 The dimensions of pad and spacing are given as a fraction of the
 _fontsize. Values from rcParams will be used if None.
+
+bbox_to_anchor can be an instance of BboxBase(or its derivatives) or a
+tuple of 2 or 4 floats. See :meth:`set_bbox_to_anchor` for more
+detail.
 """
 from matplotlib.axes import Axes # local import only to avoid circularity
 from matplotlib.figure import Figure # local import only to avoid circularity
@@ -251,7 +257,7 @@
 
 self._loc = loc
 self._mode = mode
- self.set_bbox_to_anchor(bbox_to_anchor)
+ self.set_bbox_to_anchor(bbox_to_anchor, bbox_transform)
 
 # We use FancyBboxPatch to draw a legend frame. The location
 # and size of the box will be updated during the drawing time.
@@ -689,14 +695,15 @@
 """
 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.
+ *bbox* can be a BboxBase instance, a tuple of [left, bottom,
+ width, height] in the given transform (normalized axes
+ coordinate if None), or a tuple 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):
+ elif isinstance(bbox, BboxBase):
 self._bbox_to_anchor = bbox
 else:
 try:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <lee...@us...> - 2009年04月30日 17:05:28
Revision: 7074
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7074&view=rev
Author: leejjoon
Date: 2009年04月30日 17:05:27 +0000 (2009年4月30日)
Log Message:
-----------
Incorrect eps bbox for landscape mode fixed
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2009年04月30日 13:28:54 UTC (rev 7073)
+++ trunk/matplotlib/CHANGELOG	2009年04月30日 17:05:27 UTC (rev 7074)
@@ -1,5 +1,7 @@
 ======================================================================
 
+2009年04月30日 Incorrect eps bbox for landscape mode fixed - JJL
+
 2009年04月28日 Fixed incorrect bbox of eps output when usetex=True. - JJL
 
 2009年04月24日 Changed use of os.open* to instead use subprocess.Popen.
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py	2009年04月30日 13:28:54 UTC (rev 7073)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py	2009年04月30日 17:05:27 UTC (rev 7074)
@@ -1100,8 +1100,10 @@
 # set the paper size to the figure size if isEPSF. The
 # resulting ps file has the given size with correct bounding
 # box so that there is no need to call 'pstoeps'
- if isEPSF: 
+ if isEPSF:
 paperWidth, paperHeight = self.figure.get_size_inches()
+ if isLandscape:
+ paperWidth, paperHeight = paperHeight, paperWidth
 else:
 temp_papertype = _get_papertype(width, height)
 if papertype=='auto':
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2009年04月30日 13:29:03
Revision: 7073
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7073&view=rev
Author: mdboom
Date: 2009年04月30日 13:28:54 +0000 (2009年4月30日)
Log Message:
-----------
Merged revisions 7072 via svnmerge from 
https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_98_5_maint
........
 r7072 | mdboom | 2009年04月30日 09:27:04 -0400 (2009年4月30日) | 2 lines
 
 Fix solaris builds where "putchar" is a macro.
........
Modified Paths:
--------------
 trunk/matplotlib/ttconv/pprdrv.h
 trunk/matplotlib/ttconv/pprdrv_tt.cpp
 trunk/matplotlib/ttconv/pprdrv_tt2.cpp
 trunk/matplotlib/ttconv/ttutil.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/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-7054
 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7072
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,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042
 + /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,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072
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,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042
 + /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,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072
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,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042
 + /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,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072
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,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042
 + /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,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072
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,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042
 + /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,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072
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,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042
 + /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,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072
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,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042
 + /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,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072
Modified: trunk/matplotlib/ttconv/pprdrv.h
===================================================================
--- trunk/matplotlib/ttconv/pprdrv.h	2009年04月30日 13:27:04 UTC (rev 7072)
+++ trunk/matplotlib/ttconv/pprdrv.h	2009年04月30日 13:28:54 UTC (rev 7073)
@@ -40,7 +40,7 @@
 virtual void write(const char*) = 0;
 
 virtual void printf(const char* format, ...);
- virtual void putchar(int val);
+ virtual void put_char(int val);
 virtual void puts(const char* a);
 virtual void putline(const char* a);
 };
Modified: trunk/matplotlib/ttconv/pprdrv_tt.cpp
===================================================================
--- trunk/matplotlib/ttconv/pprdrv_tt.cpp	2009年04月30日 13:27:04 UTC (rev 7072)
+++ trunk/matplotlib/ttconv/pprdrv_tt.cpp	2009年04月30日 13:28:54 UTC (rev 7073)
@@ -495,20 +495,20 @@
 
 if(!in_string)
 	{
-	stream.putchar('<');
+	stream.put_char('<');
 	string_len=0;
 	line_len++;
 	in_string=TRUE;
 	}
 
- stream.putchar( hexdigits[ n / 16 ] );
- stream.putchar( hexdigits[ n % 16 ] );
+ stream.put_char( hexdigits[ n / 16 ] );
+ stream.put_char( hexdigits[ n % 16 ] );
 string_len++;
 line_len+=2;
 
 if(line_len > 70)
 	{
- 	stream.putchar('\n');
+ 	stream.put_char('\n');
 	line_len=0;
 	}
 
@@ -561,7 +561,7 @@
 	#endif
 
 	sfnts_pputBYTE(stream, 0);	/* extra byte for pre-2013 compatibility */
-	stream.putchar('>');
+	stream.put_char('>');
 	line_len++;
 	}
 in_string=FALSE;
@@ -968,7 +968,7 @@
 /* a BuildGlyph and BuildChar proceedures. */
 if( font->target_type == PS_TYPE_3 )
 	{
-	stream.putchar('\n');
+	stream.put_char('\n');
 
 	stream.putline("/BuildGlyph");
 	stream.putline(" {exch begin");		/* start font dictionary */
@@ -977,7 +977,7 @@
 	stream.putline(" true 3 1 roll get exec");
 	stream.putline(" end}_d");
 
-	stream.putchar('\n');
+	stream.put_char('\n');
 
 	/* This proceedure is for compatiblity with */
 	/* level 1 interpreters. */
@@ -986,7 +986,7 @@
 	stream.putline(" 1 index /BuildGlyph get exec");
 	stream.putline("}_d");
 
-	stream.putchar('\n');
+	stream.put_char('\n');
 	}
 
 /* If we are generating a type 42 font, we need to check to see */
@@ -998,7 +998,7 @@
 /* setup instructions and part of BuildGlyph came from. */
 else if( font->target_type == PS_TYPE_42 )
 	{
-	stream.putchar('\n');
+	stream.put_char('\n');
 
 	/* If we have no "resourcestatus" command, or FontType 42 */
 	/* is unknown, leave "true" on the stack. */
@@ -1079,7 +1079,7 @@
 	/* if the printer has no built-in TrueType */
 	/* rasterizer. */
 	stream.putline("}if");
-	stream.putchar('\n');
+	stream.put_char('\n');
 	} /* end of if Type 42 not understood. */
 
 stream.putline("FontName currentdict end definefont pop");
Modified: trunk/matplotlib/ttconv/pprdrv_tt2.cpp
===================================================================
--- trunk/matplotlib/ttconv/pprdrv_tt2.cpp	2009年04月30日 13:27:04 UTC (rev 7072)
+++ trunk/matplotlib/ttconv/pprdrv_tt2.cpp	2009年04月30日 13:28:54 UTC (rev 7073)
@@ -104,7 +104,7 @@
 	{				/* have a log of points. */
 	if(stack_depth == 0)
 	 {
- 	 stream.putchar('{');
+ 	 stream.put_char('{');
 	 stack_depth=1;
 	 }
 
Modified: trunk/matplotlib/ttconv/ttutil.cpp
===================================================================
--- trunk/matplotlib/ttconv/ttutil.cpp	2009年04月30日 13:27:04 UTC (rev 7072)
+++ trunk/matplotlib/ttconv/ttutil.cpp	2009年04月30日 13:28:54 UTC (rev 7073)
@@ -52,7 +52,7 @@
 va_end(arg_list);
 }
 
-void TTStreamWriter::putchar(int val)
+void TTStreamWriter::put_char(int val)
 {
 char c[2];
 c[0] = (char)val;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2009年04月30日 13:27:11
Revision: 7072
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7072&view=rev
Author: mdboom
Date: 2009年04月30日 13:27:04 +0000 (2009年4月30日)
Log Message:
-----------
Fix solaris builds where "putchar" is a macro.
Modified Paths:
--------------
 branches/v0_98_5_maint/ttconv/pprdrv.h
 branches/v0_98_5_maint/ttconv/pprdrv_tt.cpp
 branches/v0_98_5_maint/ttconv/pprdrv_tt2.cpp
 branches/v0_98_5_maint/ttconv/ttutil.cpp
Modified: branches/v0_98_5_maint/ttconv/pprdrv.h
===================================================================
--- branches/v0_98_5_maint/ttconv/pprdrv.h	2009年04月29日 19:38:35 UTC (rev 7071)
+++ branches/v0_98_5_maint/ttconv/pprdrv.h	2009年04月30日 13:27:04 UTC (rev 7072)
@@ -40,7 +40,7 @@
 virtual void write(const char*) = 0;
 
 virtual void printf(const char* format, ...);
- virtual void putchar(int val);
+ virtual void put_char(int val);
 virtual void puts(const char* a);
 virtual void putline(const char* a);
 };
Modified: branches/v0_98_5_maint/ttconv/pprdrv_tt.cpp
===================================================================
--- branches/v0_98_5_maint/ttconv/pprdrv_tt.cpp	2009年04月29日 19:38:35 UTC (rev 7071)
+++ branches/v0_98_5_maint/ttconv/pprdrv_tt.cpp	2009年04月30日 13:27:04 UTC (rev 7072)
@@ -482,20 +482,20 @@
 
 if(!in_string)
 	{
-	stream.putchar('<');
+	stream.put_char('<');
 	string_len=0;
 	line_len++;
 	in_string=TRUE;
 	}
 
- stream.putchar( hexdigits[ n / 16 ] );
- stream.putchar( hexdigits[ n % 16 ] );
+ stream.put_char( hexdigits[ n / 16 ] );
+ stream.put_char( hexdigits[ n % 16 ] );
 string_len++;
 line_len+=2;
 
 if(line_len > 70)
 	{
- 	stream.putchar('\n');
+ 	stream.put_char('\n');
 	line_len=0;
 	}
 
@@ -548,7 +548,7 @@
 	#endif
 
 	sfnts_pputBYTE(stream, 0);	/* extra byte for pre-2013 compatibility */
-	stream.putchar('>');
+	stream.put_char('>');
 	line_len++;
 	}
 in_string=FALSE;
@@ -955,7 +955,7 @@
 /* a BuildGlyph and BuildChar proceedures. */
 if( font->target_type == PS_TYPE_3 )
 	{
-	stream.putchar('\n');
+	stream.put_char('\n');
 
 	stream.putline("/BuildGlyph");
 	stream.putline(" {exch begin");		/* start font dictionary */
@@ -964,7 +964,7 @@
 	stream.putline(" true 3 1 roll get exec");
 	stream.putline(" end}_d");
 
-	stream.putchar('\n');
+	stream.put_char('\n');
 
 	/* This proceedure is for compatiblity with */
 	/* level 1 interpreters. */
@@ -973,7 +973,7 @@
 	stream.putline(" 1 index /BuildGlyph get exec");
 	stream.putline("}_d");
 
-	stream.putchar('\n');
+	stream.put_char('\n');
 	}
 
 /* If we are generating a type 42 font, we need to check to see */
@@ -985,7 +985,7 @@
 /* setup instructions and part of BuildGlyph came from. */
 else if( font->target_type == PS_TYPE_42 )
 	{
-	stream.putchar('\n');
+	stream.put_char('\n');
 
 	/* If we have no "resourcestatus" command, or FontType 42 */
 	/* is unknown, leave "true" on the stack. */
@@ -1066,7 +1066,7 @@
 	/* if the printer has no built-in TrueType */
 	/* rasterizer. */
 	stream.putline("}if");
-	stream.putchar('\n');
+	stream.put_char('\n');
 	} /* end of if Type 42 not understood. */
 
 stream.putline("FontName currentdict end definefont pop");
Modified: branches/v0_98_5_maint/ttconv/pprdrv_tt2.cpp
===================================================================
--- branches/v0_98_5_maint/ttconv/pprdrv_tt2.cpp	2009年04月29日 19:38:35 UTC (rev 7071)
+++ branches/v0_98_5_maint/ttconv/pprdrv_tt2.cpp	2009年04月30日 13:27:04 UTC (rev 7072)
@@ -104,7 +104,7 @@
 	{				/* have a log of points. */
 	if(stack_depth == 0)
 	 {
- 	 stream.putchar('{');
+ 	 stream.put_char('{');
 	 stack_depth=1;
 	 }
 
Modified: branches/v0_98_5_maint/ttconv/ttutil.cpp
===================================================================
--- branches/v0_98_5_maint/ttconv/ttutil.cpp	2009年04月29日 19:38:35 UTC (rev 7071)
+++ branches/v0_98_5_maint/ttconv/ttutil.cpp	2009年04月30日 13:27:04 UTC (rev 7072)
@@ -52,7 +52,7 @@
 va_end(arg_list);
 }
 
-void TTStreamWriter::putchar(int val)
+void TTStreamWriter::put_char(int val)
 {
 char c[2];
 c[0] = (char)val;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2009年04月29日 19:38:47
Revision: 7071
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7071&view=rev
Author: efiring
Date: 2009年04月29日 19:38:35 +0000 (2009年4月29日)
Log Message:
-----------
Condense argument handling in fill_between, and add masked example
Modified Paths:
--------------
 trunk/matplotlib/examples/pylab_examples/fill_between.py
 trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/examples/pylab_examples/fill_between.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/fill_between.py	2009年04月29日 16:07:27 UTC (rev 7070)
+++ trunk/matplotlib/examples/pylab_examples/fill_between.py	2009年04月29日 19:38:35 UTC (rev 7071)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 import matplotlib.mlab as mlab
-from pylab import figure, show
+from matplotlib.pyplot import figure, show
 import numpy as np
 
 x = np.arange(0.0, 2, 0.01)
@@ -27,11 +27,24 @@
 # fill_between(x[where], y1[where],y2[where]
 # because of edge effects over multiple contiguous regions.
 fig = figure()
-ax = fig.add_subplot(111)
+ax = fig.add_subplot(211)
 ax.plot(x, y1, x, y2, color='black')
-ax.fill_between(x, y1, y2, where=y2>y1, facecolor='green')
+ax.fill_between(x, y1, y2, where=y2>=y1, facecolor='green')
 ax.fill_between(x, y1, y2, where=y2<=y1, facecolor='red')
 ax.set_title('fill between where')
 
+# Test support for masked arrays.
+y2 = np.ma.masked_greater(y2, 1.0)
+ax1 = fig.add_subplot(212, sharex=ax)
+ax1.plot(x, y1, x, y2, color='black')
+ax1.fill_between(x, y1, y2, where=y2>=y1, facecolor='green')
+ax1.fill_between(x, y1, y2, where=y2<=y1, facecolor='red')
+ax1.set_title('Now regions with y2>1 are masked')
+
+# This example illustrates a problem; because of the data
+# gridding, there are undesired unfilled triangles at the crossover
+# points. A brute-force solution would be to interpolate all
+# arrays to a very fine grid before plotting.
+
 show()
 
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py	2009年04月29日 16:07:27 UTC (rev 7070)
+++ trunk/matplotlib/lib/matplotlib/axes.py	2009年04月29日 19:38:35 UTC (rev 7071)
@@ -5832,40 +5832,29 @@
 self._process_unit_info(xdata=x, ydata=y1, kwargs=kwargs)
 self._process_unit_info(ydata=y2)
 
- if where is None:
- where = np.ones(len(x), np.bool)
- else:
- where = np.asarray(where)
-
- maskedx = isinstance(x, np.ma.MaskedArray)
- maskedy1 = isinstance(y1, np.ma.MaskedArray)
- maskedy2 = isinstance(y2, np.ma.MaskedArray)
-
- if (maskedx or maskedy1 or maskedy2):
- if maskedx:
- where = where & (~x.mask)
-
- if maskedy1:
- where = where & (~y1.mask)
-
- if maskedy2:
- where = where & (~y2.mask)
-
-
 # Convert the arrays so we can work with them
- x = np.asarray(self.convert_xunits(x))
- y1 = np.asarray(self.convert_yunits(y1))
- y2 = np.asarray(self.convert_yunits(y2))
+ x = np.asanyarray(self.convert_xunits(x))
+ y1 = np.asanyarray(self.convert_yunits(y1))
+ y2 = np.asanyarray(self.convert_yunits(y2))
 
- if not cbook.iterable(y1):
+ if y1.ndim == 0:
 y1 = np.ones_like(x)*y1
-
- if not cbook.iterable(y2):
+ if y2.ndim == 0:
 y2 = np.ones_like(x)*y2
 
+ if where is None:
+ where = np.ones(len(x), np.bool)
+ else:
+ where = np.asarray(where, np.bool)
 
- assert( (len(x)==len(y1)) and (len(x)==len(y2)) and len(x)==len(where))
+ if not (x.shape == y1.shape == y2.shape == where.shape):
+ raise ValueError("Argument dimensions are incompatible")
 
+ mask = reduce(ma.mask_or,
+ [ma.getmask(x), ma.getmask(y1), ma.getmask(y2)])
+ if mask is not ma.nomask:
+ where &= ~mask
+
 polys = []
 for ind0, ind1 in mlab.contiguous_regions(where):
 theseverts = []
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jd...@us...> - 2009年04月29日 16:07:31
Revision: 7070
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7070&view=rev
Author: jdh2358
Date: 2009年04月29日 16:07:27 +0000 (2009年4月29日)
Log Message:
-----------
add masked array support to fill_between
Modified Paths:
--------------
 trunk/matplotlib/examples/user_interfaces/embedding_in_gtk.py
 trunk/matplotlib/examples/user_interfaces/embedding_in_gtk2.py
 trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/examples/user_interfaces/embedding_in_gtk.py
===================================================================
--- trunk/matplotlib/examples/user_interfaces/embedding_in_gtk.py	2009年04月29日 15:28:33 UTC (rev 7069)
+++ trunk/matplotlib/examples/user_interfaces/embedding_in_gtk.py	2009年04月29日 16:07:27 UTC (rev 7070)
@@ -10,8 +10,8 @@
 from numpy import arange, sin, pi
 
 # uncomment to select /GTK/GTKAgg/GTKCairo
-from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
-#from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas
+#from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
+from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas
 #from matplotlib.backends.backend_gtkcairo import FigureCanvasGTKCairo as FigureCanvas
 
 
Modified: trunk/matplotlib/examples/user_interfaces/embedding_in_gtk2.py
===================================================================
--- trunk/matplotlib/examples/user_interfaces/embedding_in_gtk2.py	2009年04月29日 15:28:33 UTC (rev 7069)
+++ trunk/matplotlib/examples/user_interfaces/embedding_in_gtk2.py	2009年04月29日 16:07:27 UTC (rev 7070)
@@ -9,8 +9,8 @@
 from numpy import arange, sin, pi
 
 # uncomment to select /GTK/GTKAgg/GTKCairo
-from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
-#from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas
+#from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
+from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas
 #from matplotlib.backends.backend_gtkcairo import FigureCanvasGTKCairo as FigureCanvas
 
 # or NavigationToolbar for classic
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py	2009年04月29日 15:28:33 UTC (rev 7069)
+++ trunk/matplotlib/lib/matplotlib/axes.py	2009年04月29日 16:07:27 UTC (rev 7070)
@@ -5832,6 +5832,26 @@
 self._process_unit_info(xdata=x, ydata=y1, kwargs=kwargs)
 self._process_unit_info(ydata=y2)
 
+ if where is None:
+ where = np.ones(len(x), np.bool)
+ else:
+ where = np.asarray(where)
+
+ maskedx = isinstance(x, np.ma.MaskedArray)
+ maskedy1 = isinstance(y1, np.ma.MaskedArray)
+ maskedy2 = isinstance(y2, np.ma.MaskedArray)
+
+ if (maskedx or maskedy1 or maskedy2):
+ if maskedx:
+ where = where & (~x.mask)
+
+ if maskedy1:
+ where = where & (~y1.mask)
+
+ if maskedy2:
+ where = where & (~y2.mask)
+
+
 # Convert the arrays so we can work with them
 x = np.asarray(self.convert_xunits(x))
 y1 = np.asarray(self.convert_yunits(y1))
@@ -5843,10 +5863,7 @@
 if not cbook.iterable(y2):
 y2 = np.ones_like(x)*y2
 
- if where is None:
- where = np.ones(len(x), np.bool)
 
- where = np.asarray(where)
 assert( (len(x)==len(y1)) and (len(x)==len(y2)) and len(x)==len(where))
 
 polys = []
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7069
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7069&view=rev
Author: mdboom
Date: 2009年04月29日 15:28:33 +0000 (2009年4月29日)
Log Message:
-----------
Fix bug in Cairo backend due to changes in convert_path, reported by Michiel de Hoon
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py	2009年04月28日 19:48:18 UTC (rev 7068)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py	2009年04月29日 15:28:33 UTC (rev 7069)
@@ -122,8 +122,7 @@
 tpath, affine = clippath.get_transformed_path_and_affine()
 ctx.new_path()
 affine = affine + Affine2D().scale(1.0, -1.0).translate(0.0, self.height)
- tpath = affine.transform_path(tpath)
- RendererCairo.convert_path(ctx, tpath)
+ RendererCairo.convert_path(ctx, tpath, affine)
 ctx.clip()
 
 def _fill_and_stroke (self, ctx, fill_c, alpha):
@@ -184,9 +183,8 @@
 ctx = self.ctx
 ctx.save()
 if clippath is not None:
- tpath = clippath_trans.transform_path(clippath)
 ctx.new_path()
- RendererCairo.convert_path(ctx, tpath)
+ RendererCairo.convert_path(ctx, clippath, clippath_trans)
 ctx.clip()
 y = self.height - y - rows
 ctx.set_source_surface (surface, x, y)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <lee...@us...> - 2009年04月28日 19:48:22
Revision: 7068
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7068&view=rev
Author: leejjoon
Date: 2009年04月28日 19:48:18 +0000 (2009年4月28日)
Log Message:
-----------
Fixed incorrect bbox of eps output when usetex=True
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2009年04月27日 23:30:20 UTC (rev 7067)
+++ trunk/matplotlib/CHANGELOG	2009年04月28日 19:48:18 UTC (rev 7068)
@@ -1,5 +1,7 @@
 ======================================================================
 
+2009年04月28日 Fixed incorrect bbox of eps output when usetex=True. - JJL
+
 2009年04月24日 Changed use of os.open* to instead use subprocess.Popen.
 os.popen* are deprecated in 2.6 and are removed in 3.0. - RMM
 
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py	2009年04月27日 23:30:20 UTC (rev 7067)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py	2009年04月28日 19:48:18 UTC (rev 7068)
@@ -1096,17 +1096,25 @@
 isLandscape = True
 width, height = height, width
 bbox = (lly, llx, ury, urx)
- temp_papertype = _get_papertype(width, height)
- if papertype=='auto':
- papertype = temp_papertype
- paperWidth, paperHeight = papersize[temp_papertype]
+
+ # set the paper size to the figure size if isEPSF. The
+ # resulting ps file has the given size with correct bounding
+ # box so that there is no need to call 'pstoeps'
+ if isEPSF: 
+ paperWidth, paperHeight = self.figure.get_size_inches()
 else:
- paperWidth, paperHeight = papersize[papertype]
- if (width>paperWidth or height>paperHeight) and isEPSF:
+ temp_papertype = _get_papertype(width, height)
+ if papertype=='auto':
+ papertype = temp_papertype
 paperWidth, paperHeight = papersize[temp_papertype]
- verbose.report('Your figure is too big to fit on %s paper. %s \
-paper will be used to prevent clipping.'%(papertype, temp_papertype), 'helpful')
+ else:
+ paperWidth, paperHeight = papersize[papertype]
+ if (width>paperWidth or height>paperHeight) and isEPSF:
+ paperWidth, paperHeight = papersize[temp_papertype]
+ verbose.report('Your figure is too big to fit on %s paper. %s \
+ paper will be used to prevent clipping.'%(papertype, temp_papertype), 'helpful')
 
+
 texmanager = renderer.get_texmanager()
 font_preamble = texmanager.get_font_preamble()
 custom_preamble = texmanager.get_custom_preamble()
@@ -1247,10 +1255,16 @@
 os.remove(outfile)
 os.remove(tmpfile)
 shutil.move(psfile, tmpfile)
- if eps:
- pstoeps(tmpfile, bbox)
 
 
+
+ # Since the the paper size is set to the figure size for eps
+ # output (in '_print_figure_tex'), pstoeps call is not required.
+
+ #if eps:
+ # pstoeps(tmpfile, bbox)
+
+
 def xpdf_distill(tmpfile, eps=False, ptype='letter', bbox=None):
 """
 Use ghostscript's ps2pdf and xpdf's/poppler's pdftops to distill a file.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <as...@us...> - 2009年04月27日 23:30:23
Revision: 7067
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7067&view=rev
Author: astraw
Date: 2009年04月27日 23:30:20 +0000 (2009年4月27日)
Log Message:
-----------
Don't raise error in boxplot() when a location has no observations.
Fixes "IndexError: index out of range for array".
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py	2009年04月26日 10:29:30 UTC (rev 7066)
+++ trunk/matplotlib/lib/matplotlib/axes.py	2009年04月27日 23:30:20 UTC (rev 7067)
@@ -4856,6 +4856,9 @@
 for i,pos in enumerate(positions):
 d = np.ravel(x[i])
 row = len(d)
+ if row==0:
+ # no data, skip this position
+ continue
 # get median and quartiles
 q1, med, q3 = mlab.prctile(d,[25,50,75])
 # get high extreme
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jo...@us...> - 2009年04月26日 10:29:37
Revision: 7066
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7066&view=rev
Author: jouni
Date: 2009年04月26日 10:29:30 +0000 (2009年4月26日)
Log Message:
-----------
Mention rotate kwarg in xticks and yticks docstrings
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/pyplot.py
Modified: trunk/matplotlib/lib/matplotlib/pyplot.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/pyplot.py	2009年04月24日 22:44:34 UTC (rev 7065)
+++ trunk/matplotlib/lib/matplotlib/pyplot.py	2009年04月26日 10:29:30 UTC (rev 7066)
@@ -983,7 +983,9 @@
 xticks( arange(5), ('Tom', 'Dick', 'Harry', 'Sally', 'Sue') )
 
 The keyword args, if any, are :class:`~matplotlib.text.Text`
- properties.
+ properties. For example, to rotate long labels::
+
+ xticks( arange(12), calendar.month_name[1:13], rotation=17 )
 """
 ax = gca()
 
@@ -1019,7 +1021,9 @@
 yticks( arange(5), ('Tom', 'Dick', 'Harry', 'Sally', 'Sue') )
 
 The keyword args, if any, are :class:`~matplotlib.text.Text`
- properties.
+ properties. For example, to rotate long labels::
+
+ yticks( arange(12), calendar.month_name[1:13], rotation=45 )
 """
 ax = gca()
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7065
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7065&view=rev
Author: efiring
Date: 2009年04月24日 22:44:34 +0000 (2009年4月24日)
Log Message:
-----------
Fix for python 2.6: "as" is now reserved, don't use as a variable name.
Modified Paths:
--------------
 trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_divider.py
Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_divider.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_divider.py	2009年04月24日 17:08:50 UTC (rev 7064)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_divider.py	2009年04月24日 22:44:34 UTC (rev 7065)
@@ -32,7 +32,7 @@
 axes.
 """
 
- 
+
 def __init__(self, fig, pos, horizontal, vertical, aspect=None, anchor="C"):
 """
 :param fig: matplotlib figure
@@ -48,9 +48,9 @@
 so that the relative part of the horizontal and
 vertical scales have same scale.
 :param anchor: Detrmine how the reduced rectangle is placed
- when aspect is True, 
+ when aspect is True,
 """
- 
+
 self._fig = fig
 self._pos = pos
 self._horizontal = horizontal
@@ -67,9 +67,9 @@
 rs_sum, as_sum = 0., 0.
 
 for s in l:
- rs, as = s.get_size(renderer)
- rs_sum += rs
- as_sum += as
+ _rs, _as = s.get_size(renderer)
+ rs_sum += _rs
+ as_sum += _as
 
 if rs_sum != 0.:
 k = (total_size - as_sum) / rs_sum
@@ -84,8 +84,8 @@
 offsets = [0.]
 
 for s in l:
- rs, as = s.get_size(renderer)
- offsets.append(offsets[-1] + rs*k + as)
+ _rs, _as = s.get_size(renderer)
+ offsets.append(offsets[-1] + _rs*k + _as)
 
 return offsets
 
@@ -93,7 +93,7 @@
 def set_position(self, pos):
 """
 set the position of the rectangle.
- 
+
 :param pos: position (tuple of 4 floats) of the rectangle that
 will be divided.
 """
@@ -220,7 +220,7 @@
 """
 returns a new locator
 (:class:`mpl_toolkits.axes_grid.axes_divider.AxesLocator`) for
- specified cell. 
+ specified cell.
 
 :param nx, nx1: Integers specifying the column-position of the
 cell. When nx1 is None, a single nx-th column is
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ry...@us...> - 2009年04月24日 17:09:02
Revision: 7064
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7064&view=rev
Author: ryanmay
Date: 2009年04月24日 17:08:50 +0000 (2009年4月24日)
Log Message:
-----------
Use subprocess.Popen instead of os.popen to retrieve memory usage. os.popen* are deprecated in Python 2.6.
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/lib/matplotlib/cbook.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2009年04月24日 16:53:44 UTC (rev 7063)
+++ trunk/matplotlib/CHANGELOG	2009年04月24日 17:08:50 UTC (rev 7064)
@@ -1,6 +1,9 @@
 ======================================================================
 
-2009年04月20日 Worked on axes_grid documentation. Added 
+2009年04月24日 Changed use of os.open* to instead use subprocess.Popen.
+ os.popen* are deprecated in 2.6 and are removed in 3.0. - RMM
+
+2009年04月20日 Worked on axes_grid documentation. Added
 axes_grid.inset_locator. - JJL
 
 2009年04月17日 Initial check-in of the axes_grid toolkit. - JJL
@@ -16,12 +19,11 @@
 an rasterizing backend are placed with incorrect size.
 - JJL
 
-2008年04月14日 Added Jonathan Taylor's Reinier Heeres' port of John
+2009年04月14日 Added Jonathan Taylor's Reinier Heeres' port of John
 Porters' mplot3d to svn trunk. Package in
 mpl_toolkits.mplot3d and demo is examples/mplot3d/demo.py.
 Thanks Reiner
 
-
 2009年04月06日 The pdf backend now escapes newlines and linefeeds in strings.
 Fixes sf bug #2708559; thanks to Tiago Pereira for the report.
 
Modified: trunk/matplotlib/lib/matplotlib/cbook.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/cbook.py	2009年04月24日 16:53:44 UTC (rev 7063)
+++ trunk/matplotlib/lib/matplotlib/cbook.py	2009年04月24日 17:08:50 UTC (rev 7064)
@@ -903,15 +903,19 @@
 
 def report_memory(i=0): # argument may go away
 'return the memory consumed by process'
+ from subprocess import Popen, PIPE
 pid = os.getpid()
 if sys.platform=='sunos5':
- a2 = os.popen('ps -p %d -o osz' % pid).readlines()
+ a2 = Popen('ps -p %d -o osz' % pid, shell=True,
+ stdout=PIPE).stdout.readlines()
 mem = int(a2[-1].strip())
 elif sys.platform.startswith('linux'):
- a2 = os.popen('ps -p %d -o rss,sz' % pid).readlines()
+ a2 = Popen('ps -p %d -o rss,sz' % pid, shell=True,
+ stdout=PIPE).stdout.readlines()
 mem = int(a2[1].split()[1])
 elif sys.platform.startswith('darwin'):
- a2 = os.popen('ps -p %d -o rss,vsz' % pid).readlines()
+ a2 = Popen('ps -p %d -o rss,vsz' % pid, shell=True,
+ stdout=PIPE).stdout.readlines()
 mem = int(a2[1].split()[0])
 
 return mem
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ry...@us...> - 2009年04月24日 16:53:54
Revision: 7063
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7063&view=rev
Author: ryanmay
Date: 2009年04月24日 16:53:44 +0000 (2009年4月24日)
Log Message:
-----------
Use subprocess.Popen instead of os.popen4 to retrieve dvipng version. os.popen* are deprecated in Python 2.6.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/texmanager.py
Modified: trunk/matplotlib/lib/matplotlib/texmanager.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/texmanager.py	2009年04月24日 15:23:57 UTC (rev 7062)
+++ trunk/matplotlib/lib/matplotlib/texmanager.py	2009年04月24日 16:53:44 UTC (rev 7063)
@@ -34,6 +34,7 @@
 """
 
 import copy, glob, os, shutil, sys, warnings
+from subprocess import Popen, PIPE, STDOUT
 
 try:
 from hashlib import md5
@@ -54,7 +55,9 @@
 else: cmd_split = ';'
 
 def dvipng_hack_alpha():
- stdin, stdout = os.popen4('dvipng -version')
+ p = Popen('dvipng -version', shell=True, stdin=PIPE, stdout=PIPE,
+ stderr=STDOUT, close_fds=True)
+ stdin, stdout = p.stdin, p.stdout
 for line in stdout:
 if line.startswith('dvipng '):
 version = line.split()[-1]
@@ -601,4 +604,3 @@
 dvi.close()
 # A total height (including the descent) needs to be returned.
 return page.width, page.height+page.descent, page.descent
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <lee...@us...> - 2009年04月24日 15:24:02
Revision: 7062
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7062&view=rev
Author: leejjoon
Date: 2009年04月24日 15:23:57 +0000 (2009年4月24日)
Log Message:
-----------
axes_grid minor update.
Modified Paths:
--------------
 trunk/matplotlib/lib/mpl_toolkits/axes_grid/__init__.py
 trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_rgb.py
Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/__init__.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/__init__.py	2009年04月23日 14:22:27 UTC (rev 7061)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/__init__.py	2009年04月24日 15:23:57 UTC (rev 7062)
@@ -2,7 +2,7 @@
 AxesGrid
 """
 
-
+import axes_size as Size
 from axes_divider import Divider, SubplotDivider, LocatableAxes, \
 make_axes_locatable
 from axes_grid import AxesGrid
Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_rgb.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_rgb.py	2009年04月23日 14:22:27 UTC (rev 7061)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_rgb.py	2009年04月24日 15:23:57 UTC (rev 7062)
@@ -8,12 +8,10 @@
 
 divider = make_axes_locatable(ax)
 
- pad_size = Size.Fraction(Size.AxesY(ax), pad)
+ pad_size = Size.Fraction(pad, Size.AxesY(ax))
 
- xsize = Size.Fraction((1.-2.*pad)/3.,
- Size.AxesX(ax),)
- ysize = Size.Fraction((1.-2.*pad)/3.,
- Size.AxesY(ax))
+ xsize = Size.Fraction(Size.AxesX(ax), (1.-2.*pad)/3.)
+ ysize = Size.Fraction(Size.AxesY(ax), (1.-2.*pad)/3.)
 
 divider.set_horizontal([Size.AxesX(ax), pad_size, xsize])
 divider.set_vertical([ysize, pad_size, ysize, pad_size, ysize])
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2009年04月23日 14:22:37
Revision: 7061
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7061&view=rev
Author: mdboom
Date: 2009年04月23日 14:22:27 +0000 (2009年4月23日)
Log Message:
-----------
Fix theoretical memory leak.
Modified Paths:
--------------
 trunk/matplotlib/src/cntr.c
Modified: trunk/matplotlib/src/cntr.c
===================================================================
--- trunk/matplotlib/src/cntr.c	2009年04月23日 14:22:11 UTC (rev 7060)
+++ trunk/matplotlib/src/cntr.c	2009年04月23日 14:22:27 UTC (rev 7061)
@@ -1410,7 +1410,7 @@
 PyObject *
 cntr_trace(Csite *site, double levels[], int nlevels, int points, long nchunk)
 {
- PyObject *c_list;
+ PyObject *c_list = NULL;
 double *xp0;
 double *yp0;
 long *nseg0;
@@ -1502,6 +1502,7 @@
 error:
 PyMem_Free(xp0); PyMem_Free(yp0); PyMem_Free(nseg0);
 site->xcp = NULL; site->ycp = NULL;
+ Py_XDECREF(c_list);
 return NULL;
 }
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2009年04月23日 14:22:15
Revision: 7060
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7060&view=rev
Author: mdboom
Date: 2009年04月23日 14:22:11 +0000 (2009年4月23日)
Log Message:
-----------
Fix theoretical memory leak.
Modified Paths:
--------------
 trunk/matplotlib/src/agg_py_path_iterator.h
Modified: trunk/matplotlib/src/agg_py_path_iterator.h
===================================================================
--- trunk/matplotlib/src/agg_py_path_iterator.h	2009年04月23日 14:21:52 UTC (rev 7059)
+++ trunk/matplotlib/src/agg_py_path_iterator.h	2009年04月23日 14:22:11 UTC (rev 7060)
@@ -52,6 +52,8 @@
 if (!m_vertices ||
 PyArray_DIM(m_vertices, 1) != 2)
 {
+ Py_XDECREF(m_vertices);
+ m_vertices = NULL;
 throw Py::ValueError("Invalid vertices array.");
 }
 
@@ -59,10 +61,18 @@
 {
 m_codes = (PyArrayObject*)PyArray_FromObject
 (codes_obj.ptr(), PyArray_UINT8, 1, 1);
- if (!m_codes)
+ if (!m_codes) {
+ Py_XDECREF(m_vertices);
+ m_vertices = NULL;
 throw Py::ValueError("Invalid codes array.");
- if (PyArray_DIM(m_codes, 0) != PyArray_DIM(m_vertices, 0))
+ }
+ if (PyArray_DIM(m_codes, 0) != PyArray_DIM(m_vertices, 0)) {
+ Py_XDECREF(m_vertices);
+ m_vertices = NULL;
+ Py_XDECREF(m_codes);
+ m_codes = NULL;
 throw Py::ValueError("Codes array is wrong length");
+ }
 }
 
 m_should_simplify = should_simplify_obj.isTrue();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2009年04月23日 14:21:56
Revision: 7059
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7059&view=rev
Author: mdboom
Date: 2009年04月23日 14:21:52 +0000 (2009年4月23日)
Log Message:
-----------
Fix theoretical memory leak.
Modified Paths:
--------------
 trunk/matplotlib/src/_path.cpp
Modified: trunk/matplotlib/src/_path.cpp
===================================================================
--- trunk/matplotlib/src/_path.cpp	2009年04月23日 14:21:38 UTC (rev 7058)
+++ trunk/matplotlib/src/_path.cpp	2009年04月23日 14:21:52 UTC (rev 7059)
@@ -569,6 +569,7 @@
 	(PyArray_NDIM(offsets) == 2 && PyArray_DIM(offsets, 1) != 2) ||
 	(PyArray_NDIM(offsets) == 1 && PyArray_DIM(offsets, 0) != 0))
 {
+ Py_XDECREF(offsets);
 throw Py::ValueError("Offsets array must be Nx2");
 }
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2009年04月23日 14:21:49
Revision: 7058
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7058&view=rev
Author: mdboom
Date: 2009年04月23日 14:21:38 +0000 (2009年4月23日)
Log Message:
-----------
Fix some uninitialized variable errors in valgrind.
Modified Paths:
--------------
 trunk/matplotlib/src/path_converters.h
Modified: trunk/matplotlib/src/path_converters.h
===================================================================
--- trunk/matplotlib/src/path_converters.h	2009年04月23日 14:20:27 UTC (rev 7057)
+++ trunk/matplotlib/src/path_converters.h	2009年04月23日 14:21:38 UTC (rev 7058)
@@ -270,7 +270,8 @@
 PathClipper(VertexSource& source, bool do_clipping,
 double width, double height) :
 m_source(&source), m_do_clipping(do_clipping),
- m_cliprect(0.0, 0.0, width, height), m_moveto(true)
+ m_cliprect(0.0, 0.0, width, height), m_moveto(true),
+ m_has_next(false)
 {
 // empty
 }
@@ -278,7 +279,7 @@
 PathClipper(VertexSource& source, bool do_clipping,
 const agg::rect_base<double>& rect) :
 m_source(&source), m_do_clipping(do_clipping),
- m_cliprect(rect), m_moveto(true)
+ m_cliprect(rect), m_moveto(true), m_has_next(false)
 {
 // empty
 }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7057
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7057&view=rev
Author: mdboom
Date: 2009年04月23日 14:20:27 +0000 (2009年4月23日)
Log Message:
-----------
Fix clipping of images in PS backend.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py	2009年04月21日 03:12:53 UTC (rev 7056)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py	2009年04月23日 14:20:27 UTC (rev 7057)
@@ -428,8 +428,8 @@
 ps = []
 last_points = None
 if clip:
- clip = (0.0, 0.0, self.width * self.imagedpi,
- self.height * self.imagedpi)
+ clip = (0.0, 0.0, self.width * 72.0,
+ self.height * 72.0)
 else:
 clip = None
 for points, code in path.iter_segments(transform, clip=clip):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <lee...@us...> - 2009年04月21日 03:13:09
Revision: 7056
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7056&view=rev
Author: leejjoon
Date: 2009年04月21日 03:12:53 +0000 (2009年4月21日)
Log Message:
-----------
Added axes_grid.inset_locator
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/doc/mpl_toolkits/axes_grid/index.rst
 trunk/matplotlib/doc/mpl_toolkits/axes_grid/users/axes_divider.rst
 trunk/matplotlib/doc/mpl_toolkits/axes_grid/users/index.rst
 trunk/matplotlib/doc/mpl_toolkits/axes_grid/users/overview.rst
 trunk/matplotlib/examples/axes_grid/simple_axes_divider2.py
 trunk/matplotlib/examples/axes_grid/simple_axes_divider3.py
 trunk/matplotlib/lib/mpl_toolkits/axes_grid/__init__.py
 trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_divider.py
 trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_grid.py
Added Paths:
-----------
 trunk/matplotlib/doc/mpl_toolkits/axes_grid/api/
 trunk/matplotlib/doc/mpl_toolkits/axes_grid/api/axes_divider_api.rst
 trunk/matplotlib/doc/mpl_toolkits/axes_grid/api/axes_grid_api.rst
 trunk/matplotlib/doc/mpl_toolkits/axes_grid/api/axes_size_api.rst
 trunk/matplotlib/doc/mpl_toolkits/axes_grid/api/index.rst
 trunk/matplotlib/examples/axes_grid/inset_locator_demo.py
 trunk/matplotlib/examples/axes_grid/inset_locator_demo2.py
 trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_size.py
 trunk/matplotlib/lib/mpl_toolkits/axes_grid/inset_locator.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2009年04月19日 14:29:07 UTC (rev 7055)
+++ trunk/matplotlib/CHANGELOG	2009年04月21日 03:12:53 UTC (rev 7056)
@@ -1,5 +1,8 @@
 ======================================================================
 
+2009年04月20日 Worked on axes_grid documentation. Added 
+ axes_grid.inset_locator. - JJL
+
 2009年04月17日 Initial check-in of the axes_grid toolkit. - JJL
 
 2009年04月17日 Added a support for bbox_to_anchor in
Added: trunk/matplotlib/doc/mpl_toolkits/axes_grid/api/axes_divider_api.rst
===================================================================
--- trunk/matplotlib/doc/mpl_toolkits/axes_grid/api/axes_divider_api.rst	 (rev 0)
+++ trunk/matplotlib/doc/mpl_toolkits/axes_grid/api/axes_divider_api.rst	2009年04月21日 03:12:53 UTC (rev 7056)
@@ -0,0 +1,18 @@
+
+:mod:`mpl_toolkits.axes_grid.axes_divider`
+==========================================
+
+.. autoclass:: mpl_toolkits.axes_grid.axes_divider.Divider
+ :members: 
+ :undoc-members:
+
+
+.. autoclass:: mpl_toolkits.axes_grid.axes_divider.AxesLocator
+ :members: 
+ :undoc-members:
+
+.. autoclass:: mpl_toolkits.axes_grid.axes_divider.SubplotDivider
+ :members: 
+
+.. autoclass:: mpl_toolkits.axes_grid.axes_divider.AxesDivider
+ :members: 
Added: trunk/matplotlib/doc/mpl_toolkits/axes_grid/api/axes_grid_api.rst
===================================================================
--- trunk/matplotlib/doc/mpl_toolkits/axes_grid/api/axes_grid_api.rst	 (rev 0)
+++ trunk/matplotlib/doc/mpl_toolkits/axes_grid/api/axes_grid_api.rst	2009年04月21日 03:12:53 UTC (rev 7056)
@@ -0,0 +1,7 @@
+
+:mod:`mpl_toolkits.axes_grid.axes_grid`
+=======================================
+
+.. autoclass:: mpl_toolkits.axes_grid.axes_grid.AxesGrid
+ :members:
+ :undoc-members:
Added: trunk/matplotlib/doc/mpl_toolkits/axes_grid/api/axes_size_api.rst
===================================================================
--- trunk/matplotlib/doc/mpl_toolkits/axes_grid/api/axes_size_api.rst	 (rev 0)
+++ trunk/matplotlib/doc/mpl_toolkits/axes_grid/api/axes_size_api.rst	2009年04月21日 03:12:53 UTC (rev 7056)
@@ -0,0 +1,6 @@
+:mod:`mpl_toolkits.axes_grid.axes_size`
+=======================================
+
+.. automodule:: mpl_toolkits.axes_grid.axes_size
+ :members: Fixed, Scaled, AxesX, AxesY, MaxWidth, MaxHeight, Fraction, Padded, from_any
+
Added: trunk/matplotlib/doc/mpl_toolkits/axes_grid/api/index.rst
===================================================================
--- trunk/matplotlib/doc/mpl_toolkits/axes_grid/api/index.rst	 (rev 0)
+++ trunk/matplotlib/doc/mpl_toolkits/axes_grid/api/index.rst	2009年04月21日 03:12:53 UTC (rev 7056)
@@ -0,0 +1,14 @@
+.. _axes_grid-api-index:
+
+#######################################
+ The Matplotlib AxesGrid Toolkit API
+#######################################
+
+:Release: |version|
+:Date: |today|
+
+.. toctree::
+
+ axes_size_api.rst
+ axes_divider_api.rst
+ axes_grid_api.rst
Modified: trunk/matplotlib/doc/mpl_toolkits/axes_grid/index.rst
===================================================================
--- trunk/matplotlib/doc/mpl_toolkits/axes_grid/index.rst	2009年04月19日 14:29:07 UTC (rev 7055)
+++ trunk/matplotlib/doc/mpl_toolkits/axes_grid/index.rst	2009年04月21日 03:12:53 UTC (rev 7056)
@@ -10,7 +10,6 @@
 AxesGrid toolkit provides a framework to adjust the position of
 multiple axes according to their aspects. 
 
-.. plot:: mpl_toolkits/axes_grid/figures/demo_axes_grid.py
 
 
 Documentation
@@ -20,4 +19,4 @@
 :maxdepth: 2
 
 users/index.rst
-
+ api/index.rst
Modified: trunk/matplotlib/doc/mpl_toolkits/axes_grid/users/axes_divider.rst
===================================================================
--- trunk/matplotlib/doc/mpl_toolkits/axes_grid/users/axes_divider.rst	2009年04月19日 14:29:07 UTC (rev 7055)
+++ trunk/matplotlib/doc/mpl_toolkits/axes_grid/users/axes_divider.rst	2009年04月21日 03:12:53 UTC (rev 7056)
@@ -4,15 +4,17 @@
 The axes_divider module provide helper classes to adjust the axes
 positions of set of images in the drawing time.
 
-* *Size* This provides a classese of units that the size of each axes
- will be determined. For example, you can specify a fixed size
+* :mod:`~mpl_toolkits.axes_grid.axes_size` provides a classese of
+ units that the size of each axes will be determined. For example,
+ you can specify a fixed size
 
-* *Divider* this is the class that is used calculates the axes
- position. It divides the given renctangular area into several
- areas. You intialize the divider by setting the horizontal and
- vertical list of sizes that the division will be based on. You then
- use the new_locator method, whose return value is a callable object
- that can be used to set the axes_locator of the axes.
+* :class:`~mpl_toolkits.axes_grid.axes_size.Divider` this is the class
+ that is used calculates the axes position. It divides the given
+ renctangular area into several areas. You intialize the divider by
+ setting the horizontal and vertical list of sizes that the division
+ will be based on. You then use the new_locator method, whose return
+ value is a callable object that can be used to set the axes_locator
+ of the axes.
 
 
 You first initialize the divider by specifying its grids, i.e., horiz and vert.
@@ -25,10 +27,11 @@
 divider = Divider(fig, rect, horiz, vert)
 
 where, rect is a bounds of the box that will be divided and h0,..h3,
-v0,..v2 need to be an callable object that returns a tuple of two
-floats. The first float is the relative size, and the second float is
-the absolute size. Use of the subclasses contained in the Size class
-is recommanded. Lets' consider a following grid.
+v0,..v2 need to be an instance of classes in the
+:mod:`~mpl_toolkits.axes_grid.axes_size`. They have *get_size* method
+that returns a tuple of two floats. The first float is the relative
+size, and the second float is the absolute size. Consider a following
+grid.
 
 +-----+-----+-----+-----+
 | v0 | | | |
@@ -39,34 +42,34 @@
 +-----+-----+-----+-----+
 
 
-* h0 => 2, 0
-* h1 => 0, 2
-* h2 => 0, 3
+* v0 => 0, 2
+* v1 => 2, 0
+* v2 => 3, 0
 
 The height of the bottom row is always 2 (axes_divider internally
 assumes that the unit is inch). The first and the second rows with
-height ration of 2:3. For example, if the total height of the grid 6,
-the the first and second row will each occupy 2/(2+3) and 3/(2+3) of
+height ratio of 2:3. For example, if the total height of the grid 6,
+then the first and second row will each occupy 2/(2+3) and 3/(2+3) of
 (6-1) inches. The widths of columns (horiz) will be similarly
 determined. When aspect ratio is set, the total height (or width) will
 be adjusted accordingly.
 
 
-The Size class is a container class that contains several sub-class
+The :mod:`mpl_toolkits.axes_grid.axes_size` contains several classes
 that can be used to set the horiz and vert. For example, for the
 vertical configuration above will be::
 
- from Size import Fixed, Scaled
+ from mpl_toolkits.axes_grid.axes_size import Fixed, Scaled
 vert = [Fixed(2), Scaled(2), Scaled(3)]
 
-After you set up the divider object, you
-Then you create a locator instance which will be given to the axes.::
+After you set up the divider object, then you create a locator
+instance which will be given to the axes.::
 
 locator = divider.new_locator(nx=0, ny=1)
 ax.set_axes_locator(locator)
 
 The return value of the new_locator method is a instance of the
-AxesLocator class. It is a callable object that will return the
+AxesLocator class. It is a callable object that returns the
 location and size of the cell at the first column and the second row.
 You may create a locator that spans over multiple cells.::
 
Modified: trunk/matplotlib/doc/mpl_toolkits/axes_grid/users/index.rst
===================================================================
--- trunk/matplotlib/doc/mpl_toolkits/axes_grid/users/index.rst	2009年04月19日 14:29:07 UTC (rev 7055)
+++ trunk/matplotlib/doc/mpl_toolkits/axes_grid/users/index.rst	2009年04月21日 03:12:53 UTC (rev 7056)
@@ -10,3 +10,4 @@
 .. toctree::
 
 overview.rst
+ axes_divider.rst
Modified: trunk/matplotlib/doc/mpl_toolkits/axes_grid/users/overview.rst
===================================================================
--- trunk/matplotlib/doc/mpl_toolkits/axes_grid/users/overview.rst	2009年04月19日 14:29:07 UTC (rev 7055)
+++ trunk/matplotlib/doc/mpl_toolkits/axes_grid/users/overview.rst	2009年04月21日 03:12:53 UTC (rev 7056)
@@ -1,6 +1,6 @@
-=================
-AxesGrid Overview
-=================
+========
+Overview
+========
 
 The matplotlib AxesGrid toolkit is a collection of helper classes,
 mainly to ease displaying (multiple) images in matplotlib.
@@ -347,3 +347,44 @@
 :include-source:
 
 
+InsetLocator
+============
+
+:mod:`mpl_toolkits.axes_grid.inset_locator` provides helper classes
+and functions to place your (inset) axes at the anchored position of
+the parent axes, similarly to AnchoredArtis.
+
+Using :func:`mpl_toolkits.axes_grid.inset_locator.inset_axes`, you
+can have inset axes whose size is either fixed, or a fixed proportion
+of the parent axes. For example,::
+
+ inset_axes = inset_axes(parent_axes,
+ width="30%", # width = 30% of parent_bbox
+ height=1., # height : 1 inch
+ loc=3)
+
+creates an inset axes whose width is 30% of the parent axes and whose
+height is fixed at 1 inch.
+
+You may creates your inset whose size is determined so that the data
+scale of the inset axes to be that of the parent axes multiplied by
+some factor. For example, ::
+
+ inset_axes = zoomed_inset_axes(ax,
+ 0.5, # zoom = 0.5
+ loc=1)
+
+creates an inset axes whose data scale is half of the parent axes.
+Here is complete examples.
+
+.. plot:: mpl_toolkits/axes_grid/figures/inset_locator_demo.py
+
+For example, :func:`zoomed_inset_axes` can be used when you want the
+inset represents the zoom-up of the small portion in the parent axes.
+And :mod:`~mpl_toolkits/axes_grid/inset_locator` provides a helper
+function :func:`mark_inset` to mark the location of the area
+represented by the inset axes.
+
+.. plot:: mpl_toolkits/axes_grid/figures/inset_locator_demo2.py
+ :include-source:
+
Added: trunk/matplotlib/examples/axes_grid/inset_locator_demo.py
===================================================================
--- trunk/matplotlib/examples/axes_grid/inset_locator_demo.py	 (rev 0)
+++ trunk/matplotlib/examples/axes_grid/inset_locator_demo.py	2009年04月21日 03:12:53 UTC (rev 7056)
@@ -0,0 +1,45 @@
+import matplotlib.pyplot as plt
+
+from mpl_toolkits.axes_grid.inset_locator import inset_axes, zoomed_inset_axes
+from mpl_toolkits.axes_grid.anchored_artists import AnchoredSizeBar
+
+
+def add_sizebar(ax, size):
+ as = AnchoredSizeBar(ax.transData,
+ size,
+ str(size),
+ loc=8,
+ pad=0.1, borderpad=0.5, sep=5,
+ frameon=False)
+ ax.add_artist(as)
+
+
+fig = plt.figure(1, [5.5, 3])
+
+# first subplot
+ax = fig.add_subplot(1,2,1)
+ax.set_aspect(1.)
+
+axins = inset_axes(ax,
+ width="30%", # width = 30% of parent_bbox
+ height=1., # height : 1 inch
+ loc=3)
+
+plt.xticks(visible=False)
+plt.yticks(visible=False)
+
+
+# second subplot
+ax = fig.add_subplot(1,2,2)
+ax.set_aspect(1.)
+
+axins = zoomed_inset_axes(ax, 0.5, loc=1) # zoom = 0.5
+
+plt.xticks(visible=False)
+plt.yticks(visible=False)
+
+add_sizebar(ax, 0.5)
+add_sizebar(axins, 0.5)
+
+plt.draw()
+plt.show()
Added: trunk/matplotlib/examples/axes_grid/inset_locator_demo2.py
===================================================================
--- trunk/matplotlib/examples/axes_grid/inset_locator_demo2.py	 (rev 0)
+++ trunk/matplotlib/examples/axes_grid/inset_locator_demo2.py	2009年04月21日 03:12:53 UTC (rev 7056)
@@ -0,0 +1,42 @@
+import matplotlib.pyplot as plt
+
+from mpl_toolkits.axes_grid.inset_locator import zoomed_inset_axes
+from mpl_toolkits.axes_grid.inset_locator import mark_inset
+
+import numpy as np
+
+from demo_image import get_demo_image
+
+
+fig = plt.figure(1, [5,4])
+ax = fig.add_subplot(111)
+
+# prepare the demo image
+Z, extent = get_demo_image()
+Z2 = np.zeros([150, 150], dtype="d")
+ny, nx = Z.shape
+Z2[30:30+ny, 30:30+nx] = Z
+
+# extent = [-3, 4, -4, 3]
+ax.imshow(Z2, extent=extent, interpolation="nearest",
+ origin="lower")
+
+axins = zoomed_inset_axes(ax, 6, loc=1) # zoom = 6
+axins.imshow(Z2, extent=extent, interpolation="nearest",
+ origin="lower")
+
+# sub region of the original image
+x1, x2, y1, y2 = -1.5, -0.9, -2.5, -1.9
+axins.set_xlim(x1, x2)
+axins.set_ylim(y1, y2)
+
+plt.xticks(visible=False)
+plt.yticks(visible=False)
+
+# draw a bbox of the region of the inset axes in the parent axes and
+# connecting lines between the bbox and the inset axes area
+mark_inset(ax, axins, loc1=2, loc2=4, fc="none", ec="0.5")
+
+plt.draw()
+plt.show()
+
Modified: trunk/matplotlib/examples/axes_grid/simple_axes_divider2.py
===================================================================
--- trunk/matplotlib/examples/axes_grid/simple_axes_divider2.py	2009年04月19日 14:29:07 UTC (rev 7055)
+++ trunk/matplotlib/examples/axes_grid/simple_axes_divider2.py	2009年04月21日 03:12:53 UTC (rev 7056)
@@ -1,4 +1,5 @@
-from mpl_toolkits.axes_grid import Size, Divider
+import mpl_toolkits.axes_grid.axes_size as Size
+from mpl_toolkits.axes_grid import Divider
 import matplotlib.pyplot as plt
 
 fig1 = plt.figure(1, (5.5, 4.))
Modified: trunk/matplotlib/examples/axes_grid/simple_axes_divider3.py
===================================================================
--- trunk/matplotlib/examples/axes_grid/simple_axes_divider3.py	2009年04月19日 14:29:07 UTC (rev 7055)
+++ trunk/matplotlib/examples/axes_grid/simple_axes_divider3.py	2009年04月21日 03:12:53 UTC (rev 7056)
@@ -1,4 +1,5 @@
-from mpl_toolkits.axes_grid import Size, Divider
+import mpl_toolkits.axes_grid.axes_size as Size
+from mpl_toolkits.axes_grid import Divider
 import matplotlib.pyplot as plt
 
 
Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/__init__.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/__init__.py	2009年04月19日 14:29:07 UTC (rev 7055)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/__init__.py	2009年04月21日 03:12:53 UTC (rev 7056)
@@ -3,7 +3,8 @@
 """
 
 
-from axes_divider import Divider, SubplotDivider, LocatableAxes, Size, \
+from axes_divider import Divider, SubplotDivider, LocatableAxes, \
 make_axes_locatable
 from axes_grid import AxesGrid
+#from axes_divider import make_axes_locatable
 
Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_divider.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_divider.py	2009年04月19日 14:29:07 UTC (rev 7055)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_divider.py	2009年04月21日 03:12:53 UTC (rev 7056)
@@ -1,189 +1,56 @@
 """
-The axes_divider module provide helper classes to adjust the axes
-positions of set of images in the drawing time.
+The axes_divider module provide helper classes to adjust the positions of
+multiple axes at the drawing time.
 
- Size: This provides a classese of units that the size of each axes
- will be determined. For example, you can specify a fixed size
-
- Divider: this is the class that uis used calculates the axes
- position. It divides the given renctangular area into several
- areas. You intialize the divider by setting the horizontal and
- vertical list of sizes that the division will be based on. You
+ Divider: this is the class that is used calculates the axes
+ position. It divides the given renctangular area into several sub
+ rectangles. You intialize the divider by setting the horizontal
+ and vertical list of sizes that the division will be based on. You
 then use the new_locator method, whose return value is a callable
 object that can be used to set the axes_locator of the axes.
 
 """
 
-import matplotlib.axes as maxes
 import matplotlib.transforms as mtransforms
 
-import matplotlib.cbook as cbook
 from matplotlib.axes import SubplotBase
 
 import new
 
+import axes_size as Size
 
-class Size(object):
- """
- provides a classese of units that will be used with AxesDivider
- class (or others) to determine the size of each axes. The unit
- classes define __call__ that returns a tuple of two floats,
- meaning relative and absolute sizes, respectively.
 
- Note that this class is nothing more than a simple tuple of two
- floats. Take a look at the Divider class to see how these two
- values are used.
-
+class Divider(object):
 """
+ This is the class that is used calculates the axes position. It
+ divides the given renctangular area into several
+ sub-rectangles. You intialize the divider by setting the
+ horizontal and vertical lists of sizes
+ (:mod:`mpl_toolkits.axes_grid.axes_size`) that the division will
+ be based on. You then use the new_locator method to create a
+ callable object that can be used to as the axes_locator of the
+ axes.
+ """
 
- class _Base(object):
- "Base class"
- pass
-
- class Fixed(_Base):
- "Simple fixed size with relative part = 0"
- def __init__(self, fixed_size):
- self._fixed_size = fixed_size
-
- def get_size(self, renderer):
- rel_size = 0.
- abs_size = self._fixed_size
- return rel_size, abs_size
-
- class Scaled(_Base):
- "Simple scaled(?) size with absolute part = 0"
- def __init__(self, scalable_size):
- self._scalable_size = scalable_size
-
- def get_size(self, renderer):
- rel_size = self._scalable_size
- abs_size = 0.
- return rel_size, abs_size
-
- Scalable=Scaled
-
- class AxesX(_Base):
+ 
+ def __init__(self, fig, pos, horizontal, vertical, aspect=None, anchor="C"):
 """
- Scaled size whose relative part corresponds to the data width
- of the given axes
+ :param fig: matplotlib figure
+ :param pos: position (tuple of 4 floats) of the rectangle that
+ will be divided.
+ :param horizontal: list of sizes
+ (:mod:`~mpl_toolkits.axes_grid.axes_size`)
+ for horizontal division
+ :param vertical: list of sizes
+ (:mod:`~mpl_toolkits.axes_grid.axes_size`)
+ for vertical division
+ :param aspect: if True, the overall rectalngular area is reduced
+ so that the relative part of the horizontal and
+ vertical scales have same scale.
+ :param anchor: Detrmine how the reduced rectangle is placed
+ when aspect is True, 
 """
- def __init__(self, axes, aspect=1.):
- self._axes = axes
- self._aspect = aspect
-
- def get_size(self, renderer):
- l1, l2 = self._axes.get_xlim()
- rel_size = abs(l2-l1)*self._aspect
- abs_size = 0.
- return rel_size, abs_size
-
- class AxesY(_Base):
- """
- Scaled size whose relative part corresponds to the data height
- of the given axes
- """
- def __init__(self, axes, aspect=1.):
- self._axes = axes
- self._aspect = aspect
-
- def get_size(self, renderer):
- l1, l2 = self._axes.get_ylim()
- rel_size = abs(l2-l1)*self._aspect
- abs_size = 0.
- return rel_size, abs_size
-
-
- class MaxExtent(_Base):
- """
- Size whose absolute part is the largest width (or height) of
- the given list of artists.
- """
- def __init__(self, artist_list, w_or_h):
- self._artist_list = artist_list
-
- if w_or_h not in ["width", "height"]:
- raise ValueError()
-
- self._w_or_h = w_or_h
-
- def add_artist(self, a):
- self._artist_list.append(a)
-
- def get_size(self, renderer):
- rel_size = 0.
- w_list, h_list = [], []
- for a in self._artist_list:
- bb = a.get_window_extent(renderer)
- w_list.append(bb.width)
- h_list.append(bb.height)
- dpi = a.get_figure().get_dpi()
- if self._w_or_h == "width":
- abs_size = max(w_list)/dpi
- elif self._w_or_h == "height":
- abs_size = max(h_list)/dpi
-
- return rel_size, abs_size
-
- class Fraction(_Base):
- """
- An instance whose size is a fraction of the reference size.
- ex) s = Fraction(0.3, AxesX(ax))
- """
- def __init__(self, fraction, fraction_ref):
- self._fraction_ref = fraction_ref
- self._fraction = fraction
-
- def get_size(self, renderer):
- if self._fraction_ref is None:
- return self._fraction, 0.
- else:
- r, a = self._fraction_ref.get_size(renderer)
- rel_size = r*self._fraction
- abs_size = a*self._fraction
- return rel_size, abs_size
-
- @classmethod
- def from_any(self, size, fraction_ref=None):
- """
- Creates Fixed unit when the first argument is a float, or a
- Fraction unit if that is a string that ends with %. The second
- argument is only meaningful when Fraction unit is created.
-
- >>> a = Size.from_any(1.2) # => Size.Fixed(1.2)
- >>> Size.from_any("50%", a) # => Size.Fraction(0.5, a)
-
- """
- if cbook.is_numlike(size):
- return Size.Fixed(size)
- elif cbook.is_string_like(size):
- if size[-1] == "%":
- return Size.Fraction(float(size[:-1])/100., fraction_ref)
-
- raise ValueError("Unknown format")
-
-
-
- class Padded(_Base):
- """
- Return a instance where the absolute part of *size* is
- increase by the amount of *pad*.
- """
- def __init__(self, size, pad):
- self._size = size
- self._pad = pad
-
- def get_size(self, renderer):
- r, a = self._size.get_size(renderer)
- rel_size = r
- abs_size = a + self._pad
- return rel_size, abs_size
-
-
-
-
-class Divider(object):
-
- def __init__(self, fig, pos, horizontal, vertical, aspect=None, anchor="C"):
+ 
 self._fig = fig
 self._pos = pos
 self._horizontal = horizontal
@@ -224,14 +91,21 @@
 
 
 def set_position(self, pos):
+ """
+ set the position of the rectangle.
+ 
+ :param pos: position (tuple of 4 floats) of the rectangle that
+ will be divided.
+ """
 self._pos = pos
 
 def get_position(self):
+ "return the position of the rectangle."
 return self._pos
 
 def set_anchor(self, anchor):
 """
- *anchor*
+ :param anchor: anchor position
 
 ===== ============
 value description
@@ -254,43 +128,56 @@
 raise ValueError('argument must be among %s' %
 ', '.join(mtransforms.BBox.coefs.keys()))
 
+ def get_anchor(self):
+ "return the anchor"
+ return self._anchor
 
 def set_horizontal(self, h):
+ """
+ :param horizontal: list of sizes
+ (:mod:`~mpl_toolkits.axes_grid.axes_size`)
+ for horizontal division
+ """
 self._horizontal = h
 
+
 def get_horizontal(self):
+ "return horizontal sizes"
 return self._horizontal
 
 def set_vertical(self, v):
+ """
+ :param horizontal: list of sizes
+ (:mod:`~mpl_toolkits.axes_grid.axes_size`)
+ for horizontal division
+ """
 self._vertical = v
 
 def get_vertical(self):
+ "return vertical sizes"
 return self._vertical
 
 
- def get_anchor(self):
- return self._anchor
-
-
 def set_aspect(self, aspect=False):
 """
- *aspect* : True or False
+ :param anchor: True or False
 """
 self._aspect = aspect
 
 def get_aspect(self):
+ "return aspect"
 return self._aspect
 
 
 def locate(self, nx, ny, nx1=None, ny1=None, renderer=None):
 """
 
- nx, nx1 : Integers specifying the column-position of the
- cell. When nx1 is None, a single nx-th column is
- specified. Otherwise location of columns spanning between nx
- to nx1 (but excluding nx1-th column) is is specified.
+ :param nx, nx1: Integers specifying the column-position of the
+ cell. When nx1 is None, a single nx-th column is
+ specified. Otherwise location of columns spanning between nx
+ to nx1 (but excluding nx1-th column) is specified.
 
- ny, ny1 : same as nx and nx1, but for row positions.
+ :param ny, ny1: same as nx and nx1, but for row positions.
 """
 
 
@@ -330,6 +217,18 @@
 
 
 def new_locator(self, nx, ny, nx1=None, ny1=None):
+ """
+ returns a new locator
+ (:class:`mpl_toolkits.axes_grid.axes_divider.AxesLocator`) for
+ specified cell. 
+
+ :param nx, nx1: Integers specifying the column-position of the
+ cell. When nx1 is None, a single nx-th column is
+ specified. Otherwise location of columns spanning between nx
+ to nx1 (but excluding nx1-th column) is specified.
+
+ :param ny, ny1: same as nx and nx1, but for row positions.
+ """
 return AxesLocator(self, nx, ny, nx1, ny1)
 
 
@@ -341,14 +240,14 @@
 """
 def __init__(self, axes_divider, nx, ny, nx1=None, ny1=None):
 """
- 'axes_divider' : An instance of AxesDivider class.
+ :param axes_divider: An instance of AxesDivider class.
 
- nx, nx1 : Integers specifying the column-position of the
- cell. When nx1 is None, a single nx-th column is
- specified. Otherwise location of columns spanning between nx
- to nx1 (but excluding nx1-th column) is is specified.
+ :param nx, nx1: Integers specifying the column-position of the
+ cell. When nx1 is None, a single nx-th column is
+ specified. Otherwise location of columns spanning between nx
+ to nx1 (but excluding nx1-th column) is is specified.
 
- ny, ny1 : same as nx and nx1, but for row positions.
+ :param ny, ny1: same as nx and nx1, but for row positions.
 """
 self._axes_divider = axes_divider
 
@@ -371,14 +270,20 @@
 _xrefindex = self._axes_divider._xrefindex
 _yrefindex = self._axes_divider._yrefindex
 
- return self._axes_divider.locate(self._nx + _xrefindex, self._ny + _yrefindex,
- self._nx1 + _xrefindex, self._ny1 + _yrefindex,
+ return self._axes_divider.locate(self._nx + _xrefindex,
+ self._ny + _yrefindex,
+ self._nx1 + _xrefindex,
+ self._ny1 + _yrefindex,
 renderer)
 
 
 
 class SubplotDivider(Divider):
+ """
+ The Divider class whose rectangle area is specified as a subplot grometry.
+ """
 
+
 def __init__(self, fig, *args, **kwargs):
 """
 *fig* is a :class:`matplotlib.figure.Figure` instance.
@@ -431,6 +336,7 @@
 
 
 def get_position(self):
+ "return the bounds of the subplot box"
 self.update_params()
 return self.figbox.bounds
 
@@ -468,9 +374,14 @@
 
 
 class AxesDivider(Divider):
+ """
+ Divider based on the pre-existing axes.
+ """
 
-
 def __init__(self, axes):
+ """
+ :param axes: axes
+ """
 self._axes = axes
 self._xref = Size.AxesX(axes)
 self._yref = Size.AxesY(axes)
@@ -494,8 +405,27 @@
 
 return ax
 
+
 def new_horizontal(self, size, pad=None, pack_start=False, **kwargs):
+ """
+ Add a new axes on the right (or left) side of the main axes.
 
+ :param size: A width of the axes. A :mod:`~mpl_toolkits.axes_grid.axes_size`
+ instance or if float or string is given, *from_any*
+ fucntion is used to create one, with *ref_size* set to AxesX instance
+ of the current axes.
+ :param pad: pad between the axes. It takes same argument as *size*.
+ :param pack_start: If False, the new axes is appended at the end
+ of the list, i.e., it became the right-most axes. If True, it is
+ inseted at the start of the list, and becomes the left-most axes.
+
+ All extra keywords argument is passed to when creating a axes.
+ if *axes_class* is given, the new axes will be created as an
+ instance of the given class. Otherwise, the same class of the
+ main axes will be used. if Not provided
+
+ """
+
 if pad:
 if not isinstance(pad, Size._Base):
 pad = Size.from_any(pad,
@@ -518,18 +448,32 @@
 self._horizontal.append(size)
 locator = self.new_locator(nx=len(self._horizontal)-1, ny=0)
 
- #axes_class = type(self._axes)
 ax = self._get_new_axes(**kwargs)
- #ax = axes_class(self._axes.get_figure(),
- # self._axes.get_position(original=True),
- # **kwargs)
 locator = self.new_locator(nx=len(self._horizontal)-1, ny=0)
 ax.set_axes_locator(locator)
 
 return ax
 
 def new_vertical(self, size, pad=None, pack_start=False, **kwargs):
+ """
+ Add a new axes on the top (or bottom) side of the main axes.
 
+ :param size: A height of the axes. A :mod:`~mpl_toolkits.axes_grid.axes_size`
+ instance or if float or string is given, *from_any*
+ fucntion is used to create one, with *ref_size* set to AxesX instance
+ of the current axes.
+ :param pad: pad between the axes. It takes same argument as *size*.
+ :param pack_start: If False, the new axes is appended at the end
+ of the list, i.e., it became the top-most axes. If True, it is
+ inseted at the start of the list, and becomes the bottom-most axes.
+
+ All extra keywords argument is passed to when creating a axes.
+ if *axes_class* is given, the new axes will be created as an
+ instance of the given class. Otherwise, the same class of the
+ main axes will be used. if Not provided
+
+ """
+
 if pad:
 if not isinstance(pad, Size._Base):
 pad = Size.from_any(pad,
@@ -553,10 +497,6 @@
 locator = self.new_locator(nx=0, ny=len(self._vertical)-1)
 
 ax = self._get_new_axes(**kwargs)
- #axes_class = type(self._axes)
- #ax = axes_class(self._axes.get_figure(),
- # self._axes.get_position(original=True),
- # **kwargs)
 ax.set_axes_locator(locator)
 
 return ax
@@ -650,3 +590,138 @@
 return divider
 
 
+def get_demo_image():
+ # prepare image
+ delta = 0.5
+
+ extent = (-3,4,-4,3)
+ import numpy as np
+ x = np.arange(-3.0, 4.001, delta)
+ y = np.arange(-4.0, 3.001, delta)
+ X, Y = np.meshgrid(x, y)
+ import matplotlib.mlab as mlab
+ Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
+ Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
+ Z = (Z1 - Z2) * 10
+
+ return Z, extent
+
+def demo_locatable_axes():
+ import matplotlib.pyplot as plt
+
+ fig1 = plt.figure(1, (6, 6))
+ fig1.clf()
+
+ ## PLOT 1
+ # simple image & colorbar
+ ax = fig1.add_subplot(2, 2, 1)
+
+ Z, extent = get_demo_image()
+
+ im = ax.imshow(Z, extent=extent, interpolation="nearest")
+ cb = plt.colorbar(im)
+ plt.setp(cb.ax.get_yticklabels(), visible=False)
+
+
+ ## PLOT 2
+ # image and colorbar whose location is adjusted in the drawing time.
+ # a hard way
+
+ divider = SubplotDivider(fig1, 2, 2, 2, aspect=True)
+
+ # axes for image
+ ax = LocatableAxes(fig1, divider.get_position())
+
+ # axes for coloarbar
+ ax_cb = LocatableAxes(fig1, divider.get_position())
+
+ h = [Size.AxesX(ax), # main axes
+ Size.Fixed(0.05), # padding, 0.1 inch
+ Size.Fixed(0.2), # colorbar, 0.3 inch
+ ]
+
+ v = [Size.AxesY(ax)]
+
+ divider.set_horizontal(h)
+ divider.set_vertical(v)
+
+ ax.set_axes_locator(divider.new_locator(nx=0, ny=0))
+ ax_cb.set_axes_locator(divider.new_locator(nx=2, ny=0))
+
+ fig1.add_axes(ax)
+ fig1.add_axes(ax_cb)
+
+ ax_cb.yaxis.set_ticks_position("right")
+
+ Z, extent = get_demo_image()
+
+ im = ax.imshow(Z, extent=extent, interpolation="nearest")
+ plt.colorbar(im, cax=ax_cb)
+ plt.setp(ax_cb.get_yticklabels(), visible=False)
+
+ plt.draw()
+ #plt.colorbar(im, cax=ax_cb)
+
+
+ ## PLOT 3
+ # image and colorbar whose location is adjusted in the drawing time.
+ # a easy way
+
+ ax = fig1.add_subplot(2, 2, 3)
+ divider = make_axes_locatable(ax)
+
+ ax_cb = divider.new_horizontal(size="5%", pad=0.05)
+ fig1.add_axes(ax_cb)
+
+ im = ax.imshow(Z, extent=extent, interpolation="nearest")
+ plt.colorbar(im, cax=ax_cb)
+ plt.setp(ax_cb.get_yticklabels(), visible=False)
+
+
+ ## PLOT 4
+ # two images side by sied with fixed padding.
+
+ ax = fig1.add_subplot(2, 2, 4)
+ divider = make_axes_locatable(ax)
+
+ ax2 = divider.new_horizontal(size="100%", pad=0.05)
+ fig1.add_axes(ax2)
+
+ ax.imshow(Z, extent=extent, interpolation="nearest")
+ ax2.imshow(Z, extent=extent, interpolation="nearest")
+ plt.setp(ax2.get_yticklabels(), visible=False)
+ plt.draw()
+ plt.show()
+
+
+def demo_fixed_size_axes():
+ import matplotlib.pyplot as plt
+
+ fig2 = plt.figure(2, (6, 6))
+
+ # The first items are for padding and the second items are for the axes.
+ # sizes are in inch.
+ h = [Size.Fixed(1.0), Size.Fixed(4.5)]
+ v = [Size.Fixed(0.7), Size.Fixed(5.)]
+
+ divider = Divider(fig2, (0.0, 0.0, 1., 1.), h, v, aspect=False)
+ # the width and height of the rectangle is ignored.
+
+ ax = LocatableAxes(fig2, divider.get_position())
+ ax.set_axes_locator(divider.new_locator(nx=1, ny=1))
+
+ fig2.add_axes(ax)
+
+ ax.plot([1,2,3])
+
+ plt.draw()
+ plt.show()
+ #plt.colorbar(im, cax=ax_cb)
+
+
+
+
+
+if __name__ == "__main__":
+ demo_locatable_axes()
+ demo_fixed_size_axes()
Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_grid.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_grid.py	2009年04月19日 14:29:07 UTC (rev 7055)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_grid.py	2009年04月21日 03:12:53 UTC (rev 7056)
@@ -53,16 +53,11 @@
 ticks, ticklabels, offset_string = self._ticker()
 
 if self.orientation == 'vertical':
- #ax.set_xticks([])
- #ax.yaxis.set_label_position('right')
- #ax.yaxis.set_ticks_position('right')
 ax.set_yticks(ticks)
 ax.set_yticklabels(ticklabels)
 ax.yaxis.get_major_formatter().set_offset_string(offset_string)
 
 else:
- #ax.set_yticks([])
- #ax.xaxis.set_label_position('bottom')
 ax.set_xticks(ticks)
 ax.set_xticklabels(ticklabels)
 ax.xaxis.get_major_formatter().set_offset_string(offset_string)
@@ -150,17 +145,12 @@
 
 class AxesGrid(object):
 """
- The :class:`Axes` contains most of the figure elements:
- :class:`~matplotlib.axis.Axis`, :class:`~matplotlib.axis.Tick`,
- :class:`~matplotlib.lines.Line2D`, :class:`~matplotlib.text.Text`,
- :class:`~matplotlib.patches.Polygon`, etc., and sets the
- coordinate system.
-
- The :class:`Axes` instance supports callbacks through a callbacks
- attribute which is a :class:`~matplotlib.cbook.CallbackRegistry`
- instance. The events you can connect to are 'xlim_changed' and
- 'ylim_changed' and the callback will be called with func(*ax*)
- where *ax* is the :class:`Axes` instance.
+ A class that creates a grid of Axes. In matplotlib, the axes
+ location (and size) is specified in the normalized figure
+ coordinates. This may not be ideal for images that needs to be
+ displayed with a given aspect ratio. For example, displaying
+ images of a same size with some fixed padding between them cannot
+ be easily done in matplotlib. AxesGrid is used in such case.
 """
 
 def __init__(self, fig,
@@ -275,7 +265,7 @@
 
 for i in range(self.ngrids):
 
- col, row = self.get_col_row(i)
+ col, row = self._get_col_row(i)
 
 if share_all:
 sharex = self._refax
@@ -359,7 +349,7 @@
 
 
 for i in range(self.ngrids):
- col, row = self.get_col_row(i)
+ col, row = self._get_col_row(i)
 #locator = self._divider.new_locator(nx=4*col, ny=2*(self._nrows - row - 1))
 locator = self._divider.new_locator(nx=h_ax_pos[col],
 ny=v_ax_pos[self._nrows -1 - row])
@@ -406,7 +396,7 @@
 
 
 
- def get_col_row(self, n):
+ def _get_col_row(self, n):
 if self._direction == "column":
 col, row = divmod(n, self._nrows)
 else:
@@ -420,80 +410,57 @@
 
 
 def get_geometry(self):
+ """
+ get geometry of the grid. Returns a tuple of two integer,
+ representing number of rows and number of columns.
+ """
 return self._nrows, self._ncols
 
 def set_axes_pad(self, axes_pad):
+ "set axes_pad"
 self._axes_pad = axes_pad
 
 def get_axes_pad(self):
+ "get axes_pad"
 return self._axes_pad
 
 def set_aspect(self, aspect):
+ "set aspect"
 self._divider.set_aspect(aspect)
 
 def get_aspect(self):
+ "get aspect"
 return self._divider.get_aspect()
 
 def set_label_mode(self, mode):
+ "set label_mode"
 if mode == "all":
 for ax in self.axes_all:
 _tick_only(ax, False, False)
- #[l.set_visible(True) for l in ax.get_xticklabels()]
- #[l.set_visible(True) for l in ax.get_yticklabels()]
 elif mode == "L":
 # left-most axes
 for ax in self.axes_column[0][:-1]:
 _tick_only(ax, bottom_on=True, left_on=False)
- #[l.set_visible(False) for l in ax.get_xticklabels()]
- #[l.set_visible(True) for l in ax.get_yticklabels()]
- #if hasattr(ax, "_axislines"):
- # ax._axislines["left"].major_ticklabels.set_visible(True)
- # ax._axislines["bottom"].major_ticklabels.set_visible(False)
 # lower-left axes
 ax = self.axes_column[0][-1]
 _tick_only(ax, bottom_on=False, left_on=False)
- #[l.set_visible(True) for l in ax.get_xticklabels()]
- #[l.set_visible(True) for l in ax.get_yticklabels()]
- #if hasattr(ax, "_axislines"):
- # ax._axislines["left"].major_ticklabels.set_visible(True)
- # ax._axislines["bottom"].major_ticklabels.set_visible(True)
 
 for col in self.axes_column[1:]:
 # axes with no labels
 for ax in col[:-1]:
 _tick_only(ax, bottom_on=True, left_on=True)
- #[l.set_visible(False) for l in ax.get_xticklabels()]
- #[l.set_visible(False) for l in ax.get_yticklabels()]
- #if hasattr(ax, "_axislines"):
- # ax._axislines["left"].major_ticklabels.set_visible(False)
- # ax._axislines["bottom"].major_ticklabels.set_visible(False)
 
 # bottom
 ax = col[-1]
 _tick_only(ax, bottom_on=False, left_on=True)
 
- #[l.set_visible(True) for l in ax.get_xticklabels()]
- #[l.set_visible(False) for l in ax.get_yticklabels()]
- #if hasattr(ax, "_axislines"):
- # ax._axislines["left"].major_ticklabels.set_visible(False)
- # ax._axislines["bottom"].major_ticklabels.set_visible(True)
 elif mode == "1":
 for ax in self.axes_all:
 _tick_only(ax, bottom_on=True, left_on=True)
- #[l.set_visible(False) for l in ax.get_xticklabels()]
- #[l.set_visible(False) for l in ax.get_yticklabels()]
- #if hasattr(ax, "_axislines"):
- # for axisline in ax._axislines.values():
- # axisline.major_ticklabels.set_visible(False)
 
 ax = self.axes_llc
 _tick_only(ax, bottom_on=False, left_on=False)
 
- #[l.set_visible(True) for l in ax.get_xticklabels()]
- #[l.set_visible(True) for l in ax.get_yticklabels()]
- #if hasattr(ax, "_axislines"):
- # ax._axislines["left"].major_ticklabels.set_visible(True)
- # ax._axislines["bottom"].major_ticklabels.set_visible(True)
 
 
 
Added: trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_size.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_size.py	 (rev 0)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_size.py	2009年04月21日 03:12:53 UTC (rev 7056)
@@ -0,0 +1,207 @@
+
+"""
+provides a classese of simlpe units that will be used with AxesDivider
+class (or others) to determine the size of each axes. The unit
+classes define `get_size` method that returns a tuple of two floats,
+meaning relative and absolute sizes, respectively.
+
+Note that this class is nothing more than a simple tuple of two
+floats. Take a look at the Divider class to see how these two
+values are used.
+
+"""
+
+import matplotlib.cbook as cbook
+
+
+class _Base(object):
+ "Base class"
+ pass
+
+class Fixed(_Base):
+ "Simple fixed size with absolute part = *fixed_size* and relative part = 0"
+ def __init__(self, fixed_size):
+ self._fixed_size = fixed_size
+
+ def get_size(self, renderer):
+ rel_size = 0.
+ abs_size = self._fixed_size
+ return rel_size, abs_size
+
+class Scaled(_Base):
+ "Simple scaled(?) size with absolute part = 0 and relative part = *scalable_size*"
+ def __init__(self, scalable_size):
+ self._scalable_size = scalable_size
+
+ def get_size(self, renderer):
+ rel_size = self._scalable_size
+ abs_size = 0.
+ return rel_size, abs_size
+
+Scalable=Scaled
+
+
+class AxesX(_Base):
+ """
+ Scaled size whose relative part corresponds to the data width
+ of the *axes* multiplied by the *aspect*.
+ """
+ def __init__(self, axes, aspect=1.):
+ self._axes = axes
+ self._aspect = aspect
+
+ def get_size(self, renderer):
+ l1, l2 = self._axes.get_xlim()
+ rel_size = abs(l2-l1)*self._aspect
+ abs_size = 0.
+ return rel_size, abs_size
+
+class AxesY(_Base):
+ """
+ Scaled size whose relative part corresponds to the data height
+ of the *axes* multiplied by the *aspect*.
+ """
+ def __init__(self, axes, aspect=1.):
+ self._axes = axes
+ self._aspect = aspect
+
+ def get_size(self, renderer):
+ l1, l2 = self._axes.get_ylim()
+ rel_size = abs(l2-l1)*self._aspect
+ abs_size = 0.
+ return rel_size, abs_size
+
+
+class MaxExtent(_Base):
+ """
+ Size whose absolute part is the largest width (or height) of
+ the given *artist_list*.
+ """
+ def __init__(self, artist_list, w_or_h):
+ self._artist_list = artist_list
+
+ if w_or_h not in ["width", "height"]:
+ raise ValueError()
+
+ self._w_or_h = w_or_h
+
+ def add_artist(self, a):
+ self._artist_list.append(a)
+
+ def get_size(self, renderer):
+ rel_size = 0.
+ w_list, h_list = [], []
+ for a in self._artist_list:
+ bb = a.get_window_extent(renderer)
+ w_list.append(bb.width)
+ h_list.append(bb.height)
+ dpi = a.get_figure().get_dpi()
+ if self._w_or_h == "width":
+ abs_size = max(w_list)/dpi
+ elif self._w_or_h == "height":
+ abs_size = max(h_list)/dpi
+
+ return rel_size, abs_size
+
+
+class MaxWidth(_Base):
+ """
+ Size whose absolute part is the largest width of
+ the given *artist_list*.
+ """
+ def __init__(self, artist_list):
+ self._artist_list = artist_list
+
+ def add_artist(self, a):
+ self._artist_list.append(a)
+
+ def get_size(self, renderer):
+ rel_size = 0.
+ w_list = []
+ for a in self._artist_list:
+ bb = a.get_window_extent(renderer)
+ w_list.append(bb.width)
+ dpi = a.get_figure().get_dpi()
+ abs_size = max(w_list)/dpi
+
+ return rel_size, abs_size
+
+
+
+class MaxHeight(_Base):
+ """
+ Size whose absolute part is the largest height of
+ the given *artist_list*.
+ """
+ def __init__(self, artist_list):
+ self._artist_list = artist_list
+
+ def add_artist(self, a):
+ self._artist_list.append(a)
+
+ def get_size(self, renderer):
+ rel_size = 0.
+ h_list = []
+ for a in self._artist_list:
+ bb = a.get_window_extent(renderer)
+ h_list.append(bb.height)
+ dpi = a.get_figure().get_dpi()
+ abs_size = max(h_list)/dpi
+
+ return rel_size, abs_size
+
+
+class Fraction(_Base):
+ """
+ An instance whose size is a *fraction* of the *ref_size*.
+
+ >>> s = Fraction(0.3, AxesX(ax))
+
+ """
+ def __init__(self, fraction, ref_size):
+ self._fraction_ref = ref_size
+ self._fraction = fraction
+
+ def get_size(self, renderer):
+ if self._fraction_ref is None:
+ return self._fraction, 0.
+ else:
+ r, a = self._fraction_ref.get_size(renderer)
+ rel_size = r*self._fraction
+ abs_size = a*self._fraction
+ return rel_size, abs_size
+
+class Padded(_Base):
+ """
+ Return a instance where the absolute part of *size* is
+ increase by the amount of *pad*.
+ """
+ def __init__(self, size, pad):
+ self._size = size
+ self._pad = pad
+
+ def get_size(self, renderer):
+ r, a = self._size.get_size(renderer)
+ rel_size = r
+ abs_size = a + self._pad
+ return rel_size, abs_size
+
+def from_any(size, fraction_ref=None):
+ """
+ Creates Fixed unit when the first argument is a float, or a
+ Fraction unit if that is a string that ends with %. The second
+ argument is only meaningful when Fraction unit is created.
+
+ >>> a = Size.from_any(1.2) # => Size.Fixed(1.2)
+ >>> Size.from_any("50%", a) # => Size.Fraction(0.5, a)
+
+ """
+ if cbook.is_numlike(size):
+ return Fixed(size)
+ elif cbook.is_string_like(size):
+ if size[-1] == "%":
+ return Fraction(float(size[:-1])/100., fraction_ref)
+
+ raise ValueError("Unknown format")
+
+
Added: trunk/matplotlib/lib/mpl_toolkits/axes_grid/inset_locator.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/inset_locator.py	 (rev 0)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/inset_locator.py	2009年04月21日 03:12:53 UTC (rev 7056)
@@ -0,0 +1,308 @@
+from matplotlib.offsetbox import AnchoredOffsetbox
+#from matplotlib.transforms import IdentityTransform
+
+import matplotlib.transforms as mtrans
+from matplotlib.axes import Axes
+
+from matplotlib.transforms import Bbox, TransformedBbox, IdentityTransform
+
+from matplotlib.patches import Patch
+from matplotlib.path import Path
+
+from matplotlib.patches import Rectangle
+
+
+class InsetPosition(object):
+ def __init__(self, parent, lbwh):
+ self.parent = parent
+ self.lbwh = lbwh # position of the inset axes in the normalized coordinate of the parent axes
+
+ def __call__(self, ax, renderer):
+ bbox_parent = self.parent.get_position(original=False)
+ trans = mtrans.BboxTransformTo(bbox_parent)
+ bbox_inset = mtrans.Bbox.from_bounds(*self.lbwh)
+ bb = mtrans.TransformedBbox(bbox_inset, trans)
+ return bb
+
+
+class AnchoredLocatorBase(AnchoredOffsetbox):
+ def __init__(self, bbox_to_anchor, offsetbox, loc,
+ borderpad=0.5, bbox_transform=None):
+
+ super(AnchoredLocatorBase, self).__init__(loc,
+ pad=0., child=None,
+ borderpad=borderpad,
+ bbox_to_anchor=bbox_to_anchor,
+ bbox_transform=bbox_transform)
+
+
+ def draw(self, renderer):
+ raise RuntimeError("No draw method should be called")
+
+
+ def __call__(self, ax, renderer):
+
+ fontsize = renderer.points_to_pixels(self.prop.get_size_in_points())
+ self._update_offset_func(renderer, fontsize)
+
+ width, height, xdescent, ydescent = self.get_extent(renderer)
+
+ px, py = self.get_offset(width, height, 0, 0)
+ bbox_canvas = mtrans.Bbox.from_bounds(px, py, width, height)
+ tr = ax.figure.transFigure.inverted()
+ bb = mtrans.TransformedBbox(bbox_canvas, tr)
+
+ return bb
+
+
+
+
+from mpl_toolkits.axes_grid.axes_divider import Size
+
+class AnchoredSizeLocator(AnchoredLocatorBase):
+ def __init__(self, bbox_to_anchor, x_size, y_size, loc,
+ borderpad=0.5, bbox_transform=None):
+
+ self.axes = None
+ self.x_size = Size.from_any(x_size)
+ self.y_size = Size.from_any(y_size)
+
+ super(AnchoredSizeLocator, self).__init__(bbox_to_anchor, None, loc,
+ borderpad=borderpad,
+ bbox_transform=bbox_transform)
+
+ def get_extent(self, renderer):
+
+ x, y, w, h = self.get_bbox_to_anchor().bounds
+
+ dpi = renderer.points_to_pixels(72.)
+
+ r, a = self.x_size.get_size(renderer)
+ width = w*r + a*dpi
+
+ r, a = self.y_size.get_size(renderer)
+ height = h*r + a*dpi
+ xd, yd = 0, 0
+
+ fontsize = renderer.points_to_pixels(self.prop.get_size_in_points())
+ pad = self.pad * fontsize
+
+ return width+2*pad, height+2*pad, xd+pad, yd+pad
+
+
+ def __call__(self, ax, renderer):
+
+ self.axes = ax
+ return super(AnchoredSizeLocator, self).__call__(ax, renderer)
+
+
+class AnchoredZoomLocator(AnchoredLocatorBase):
+ def __init__(self, parent_axes, zoom, loc,
+ borderpad=0.5,
+ bbox_to_anchor=None,
+ bbox_transform=None):
+
+ self.parent_axes = parent_axes
+ self.zoom = zoom
+
+ if bbox_to_anchor is None:
+ bbox_to_anchor = parent_axes.bbox
+
+ super(AnchoredZoomLocator, self).__init__(bbox_to_anchor, None, loc,
+ borderpad=borderpad,
+ bbox_transform=bbox_transform)
+
+ self.axes = None
+
+
+ def get_extent(self, renderer):
+
+ bb = mtrans.TransformedBbox(self.axes.viewLim, self.parent_axes.transData)
+
+ x, y, w, h = bb.bounds
+
+ xd, yd = 0, 0
+
+ fontsize = renderer.points_to_pixels(self.prop.get_size_in_points())
+ pad = self.pad * fontsize
+
+ return w*self.zoom+2*pad, h*self.zoom+2*pad, xd+pad, yd+pad
+
+
+ def __call__(self, ax, renderer):
+
+ self.axes = ax
+ return super(AnchoredZoomLocator, self).__call__(ax, renderer)
+
+
+
+
+
+
+class BboxPatch(Patch):
+ def __init__(self, bbox, **kwargs):
+ if "transform" in kwargs:
+ raise ValueError("trnasform should nt be set")
+
+ kwargs["transform"] = IdentityTransform()
+ Patch.__init__(self, **kwargs)
+ self.bbox = bbox
+
+ def get_path(self):
+ x0, y0, x1, y1 = self.bbox.extents
+
+ verts = [(x0, y0),
+ (x1, y0),
+ (x1, y1),
+ (x0, y1),
+ (x0, y0),
+ (0,0)]
+
+ codes = [Path.MOVETO,
+ Path.LINETO,
+ Path.LINETO,
+ Path.LINETO,
+ Path.LINETO,
+ Path.CLOSEPOLY]
+
+ return Path(verts, codes)
+
+
+
+
+class BboxConnector(Patch):
+
+ @staticmethod
+ def get_bbox_edge_pos(bbox, loc):
+ x0, y0, x1, y1 = bbox.extents
+ if loc==1:
+ return x1, y1
+ elif loc==2:
+ return x0, y1
+ elif loc==3:
+ return x0, y0
+ elif loc==4:
+ return x1, y0
+
+ @staticmethod
+ def connect_bbox(bbox1, bbox2, loc1, loc2=None):
+ if isinstance(bbox1, Rectangle):
+ transform = bbox1.get_transfrom()
+ bbox1 = Bbox.from_bounds(0, 0, 1, 1)
+ bbox1 = TransformedBbox(bbox1, transform)
+
+ if isinstance(bbox2, Rectangle):
+ transform = bbox2.get_transform()
+ bbox2 = Bbox.from_bounds(0, 0, 1, 1)
+ bbox2 = TransformedBbox(bbox2, transform)
+
+ if loc2 is None:
+ loc2 = loc1
+
+ x1, y1 = BboxConnector.get_bbox_edge_pos(bbox1, loc1)
+ x2, y2 = BboxConnector.get_bbox_edge_pos(bbox2, loc2)
+
+ verts = [[x1, y1], [x2,y2]]
+ #Path()
+
+ codes = [Path.MOVETO, Path.LINETO]
+
+ return Path(verts, codes)
+
+
+ def __init__(self, bbox1, bbox2, loc1, loc2=None, **kwargs):
+ """
+ *path* is a :class:`matplotlib.path.Path` object.
+
+ Valid kwargs are:
+ %(Patch)s
+
+ .. seealso::
+
+ :class:`Patch`
+ For additional kwargs
+
+ """
+ if "transform" in kwargs:
+ raise ValueError("trnasform should nt be set")
+
+ kwargs["transform"] = IdentityTransform()
+ Patch.__init__(self, **kwargs)
+ self.bbox1 = bbox1
+ self.bbox2 = bbox2
+ self.loc1 = loc1
+ self.loc2 = loc2
+
+
+ def get_path(self):
+ return self.connect_bbox(self.bbox1, self.bbox2,
+ self.loc1, self.loc2)
+
+
+def _add_inset_axes(parent_axes, inset_axes):
+ parent_axes.figure.add_axes(inset_axes)
+ inset_axes.set_navigate(False)
+
+
+def inset_axes(parent_axes, width, height, loc=1,
+ bbox_to_anchor=None, bbox_transform=None,
+ axes_kwargs=None,
+ **kwargs):
+
+ if axes_kwargs is None:
+ inset_axes = Axes(parent_axes.figure, parent_axes.get_position())
+ else:
+ inset_axes = Axes(parent_axes.figure, parent_axes.get_position(),
+ **axes_kwargs)
+
+ axes_locator = AnchoredSizeLocator(parent_axes.bbox,
+ width, height,
+ loc=loc)
+
+ inset_axes.set_axes_locator(axes_locator)
+
+ _add_inset_axes(parent_axes, inset_axes)
+
+ return inset_axes
+
+
+def zoomed_inset_axes(parent_axes, zoom, loc=1,
+ bbox_to_anchor=None, bbox_transform=None,
+ axes_kwargs=None,
+ connects=None,
+ **kwargs):
+
+ if axes_kwargs is None:
+ inset_axes = Axes(parent_axes.figure, parent_axes.get_position())
+ else:
+ inset_axes = Axes(parent_axes.figure, parent_axes.get_position(),
+ **axes_kwargs)
+
+ axes_locator = AnchoredZoomLocator(parent_axes, zoom=zoom, loc=loc)
+ inset_axes.set_axes_locator(axes_locator)
+
+ _add_inset_axes(parent_axes, inset_axes)
+
+ if connects is not None:
+ pass
+
+ return inset_axes
+
+
+def mark_inset(parent_axes, inset_axes, loc1, loc2, **kwargs):
+ rect = TransformedBbox(inset_axes.viewLim, parent_axes.transData)
+
+ pp = BboxPatch(rect, **kwargs)
+ parent_axes.add_patch(pp)
+
+ p1 = BboxConnector(inset_axes.bbox, rect, loc1=loc1, **kwargs)
+ inset_axes.add_patch(p1)
+ p1.set_clip_on(False)
+ p2 = BboxConnector(inset_axes.bbox, rect, loc1=loc2, **kwargs)
+ inset_axes.add_patch(p2)
+ p2.set_clip_on(False)
+
+ return pp, p1, p2
+
+
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jd...@us...> - 2009年04月19日 14:29:17
Revision: 7055
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7055&view=rev
Author: jdh2358
Date: 2009年04月19日 14:29:07 +0000 (2009年4月19日)
Log Message:
-----------
Merged revisions 7054 via svnmerge from 
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_5_maint
........
 r7054 | jdh2358 | 2009年04月19日 09:26:12 -0500 (2009年4月19日) | 1 line
 
 force a copy of the colormap input data
........
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/colors.py
Property Changed:
----------------
 trunk/matplotlib/
Property changes on: trunk/matplotlib
___________________________________________________________________
Modified: svnmerge-integrated
 - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7042
 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7054
Modified: trunk/matplotlib/lib/matplotlib/colors.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/colors.py	2009年04月19日 14:26:12 UTC (rev 7054)
+++ trunk/matplotlib/lib/matplotlib/colors.py	2009年04月19日 14:29:07 UTC (rev 7055)
@@ -483,7 +483,9 @@
 xa = np.array([X])
 else:
 vtype = 'array'
- xma = ma.asarray(X)
+ # force a copy here -- the ma.array and filled functions
+ # do force a cop of the data by default - JDH
+ xma = ma.array(X, copy=True)
 xa = xma.filled(0)
 mask_bad = ma.getmask(xma)
 if xa.dtype.char in np.typecodes['Float']:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7054
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7054&view=rev
Author: jdh2358
Date: 2009年04月19日 14:26:12 +0000 (2009年4月19日)
Log Message:
-----------
force a copy of the colormap input data
Modified Paths:
--------------
 branches/v0_98_5_maint/lib/matplotlib/colors.py
Modified: branches/v0_98_5_maint/lib/matplotlib/colors.py
===================================================================
--- branches/v0_98_5_maint/lib/matplotlib/colors.py	2009年04月19日 14:25:41 UTC (rev 7053)
+++ branches/v0_98_5_maint/lib/matplotlib/colors.py	2009年04月19日 14:26:12 UTC (rev 7054)
@@ -483,7 +483,9 @@
 xa = np.array([X])
 else:
 vtype = 'array'
- xma = ma.asarray(X)
+ # force a copy here -- the ma.array and filled functions
+ # do force a cop of the data by default - JDH
+ xma = ma.array(X, copy=True)
 xa = xma.filled(0)
 mask_bad = ma.getmask(xma)
 if xa.dtype.char in np.typecodes['Float']:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jd...@us...> - 2009年04月19日 14:25:46
Revision: 7053
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7053&view=rev
Author: jdh2358
Date: 2009年04月19日 14:25:41 +0000 (2009年4月19日)
Log Message:
-----------
updated osx release notes
Modified Paths:
--------------
 trunk/matplotlib/release/osx/README.txt
Modified: trunk/matplotlib/release/osx/README.txt
===================================================================
--- trunk/matplotlib/release/osx/README.txt	2009年04月18日 16:02:56 UTC (rev 7052)
+++ trunk/matplotlib/release/osx/README.txt	2009年04月19日 14:25:41 UTC (rev 7053)
@@ -55,3 +55,30 @@
 make installers
 
 The mpkg and egg binaries will reside in :file:`matplotlib-VERSION/dist`
+
+Crib sheet
+-------------
+
+Build the dependencies::
+
+ cd release/osx/
+ unset PKG_CONFIG_PATH
+ make fetch_deps
+ cd bdist_mpkg-0.4.3
+ sudo python setup.py install
+ cd ..
+ make dependencies
+
+Build the mpl sdist::
+
+ cd ../..
+ python setup.py sdist
+ mv dist/matplotlib-0.98.6svn.tar.gz release/osx/
+
+Set the version number in the Makefile to 0.98.6svn and build the
+installers ::
+
+ cd release/osx
+ make installers
+
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <lee...@us...> - 2009年04月18日 16:02:57
Revision: 7052
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7052&view=rev
Author: leejjoon
Date: 2009年04月18日 16:02:56 +0000 (2009年4月18日)
Log Message:
-----------
offsetbox minor update
Modified Paths:
--------------
 trunk/matplotlib/examples/axes_grid/simple_anchored_artists.py
 trunk/matplotlib/lib/matplotlib/offsetbox.py
 trunk/matplotlib/lib/mpl_toolkits/axes_grid/anchored_artists.py
Removed Paths:
-------------
 trunk/matplotlib/examples/pylab_examples/axes_divider.py
 trunk/matplotlib/examples/pylab_examples/axes_grid.py
Modified: trunk/matplotlib/examples/axes_grid/simple_anchored_artists.py
===================================================================
--- trunk/matplotlib/examples/axes_grid/simple_anchored_artists.py	2009年04月17日 20:40:58 UTC (rev 7051)
+++ trunk/matplotlib/examples/axes_grid/simple_anchored_artists.py	2009年04月18日 16:02:56 UTC (rev 7052)
@@ -11,7 +11,8 @@
 
 at2 = AnchoredText("Figure 1(b)",
 loc=3, prop=dict(size=8), frameon=True,
- bbox_to_anchor=(0., 1.)
+ bbox_to_anchor=(0., 1.),
+ bbox_transform=ax.transAxes
 )
 at2.patch.set_boxstyle("round,pad=0.,rounding_size=0.2")
 ax.add_artist(at2)
Deleted: trunk/matplotlib/examples/pylab_examples/axes_divider.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/axes_divider.py	2009年04月17日 20:40:58 UTC (rev 7051)
+++ trunk/matplotlib/examples/pylab_examples/axes_divider.py	2009年04月18日 16:02:56 UTC (rev 7052)
@@ -1,674 +0,0 @@
-
-import matplotlib.axes as maxes
-import matplotlib.transforms as mtransforms
-
-import matplotlib.cbook as cbook
-
-import new
-
-
-class Size(object):
-
- @classmethod
- def from_any(self, size, fraction_ref=None):
- if cbook.is_numlike(size):
- return Size.Fixed(size)
- elif cbook.is_string_like(size):
- if size[-1] == "%":
- return Size.Fraction(fraction_ref, float(size[:-1])/100.)
-
- raise ValueError("")
-
-
-
- class _Base(object):
- pass
-
- class Fixed(_Base):
- def __init__(self, fixed_size):
- self._fixed_size = fixed_size
-
- def get_size(self, renderer):
- rel_size = 0.
- abs_size = self._fixed_size
- return rel_size, abs_size
-
- class Scalable(_Base):
- def __init__(self, scalable_size):
- self._scalable_size = scalable_size
-
- def get_size(self, renderer):
- rel_size = self._scalable_size
- abs_size = 0.
- return rel_size, abs_size
-
-
- class AxesX(_Base):
- def __init__(self, axes, aspect=1.):
- self._axes = axes
- self._aspect = aspect
-
- def get_size(self, renderer):
- l1, l2 = self._axes.get_xlim()
- rel_size = abs(l2-l1)*self._aspect
- abs_size = 0.
- return rel_size, abs_size
-
- class AxesY(_Base):
- def __init__(self, axes, aspect=1.):
- self._axes = axes
- self._aspect = aspect
-
- def get_size(self, renderer):
- l1, l2 = self._axes.get_ylim()
- rel_size = abs(l2-l1)*self._aspect
- abs_size = 0.
- return rel_size, abs_size
-
-
- class MaxExtent(_Base):
- def __init__(self, artist_list, w_or_h):
- self._artist_list = artist_list
-
- if w_or_h not in ["width", "height"]:
- raise ValueError()
-
- self._w_or_h = w_or_h
-
- def add_artist(self, a):
- self._artist_list.append(a)
-
- def get_size(self, renderer):
- rel_size = 0.
- w_list, h_list = [], []
- for a in self._artist_list:
- bb = a.get_window_extent(renderer)
- w_list.append(bb.width)
- h_list.append(bb.height)
- dpi = a.get_figure().get_dpi()
- if self._w_or_h == "width":
- abs_size = max(w_list)/dpi
- elif self._w_or_h == "height":
- abs_size = max(h_list)/dpi
-
- return rel_size, abs_size
-
- class Fraction(_Base):
- def __init__(self, size, fraction):
- self._size = size
- self._fraction = fraction
-
- def get_size(self, renderer):
- r, a = self._size.get_size(renderer)
- rel_size = r*self._fraction
- abs_size = a*self._fraction
- return rel_size, abs_size
-
- class Padded(_Base):
- def __init__(self, size, pad):
- self._size = size
- self._pad = pad
-
- def get_size(self, renderer):
- r, a = self._size.get_size(renderer)
- rel_size = r
- abs_size = a + self._pad
- return rel_size, abs_size
-
-
-
-class AxesLocator(object):
- def __init__(self, axes_divider, nx, ny, nx1=None, ny1=None):
-
- self._axes_divider = axes_divider
-
- _xrefindex = axes_divider._xrefindex
- _yrefindex = axes_divider._yrefindex
-
- self._nx, self._ny = nx - _xrefindex, ny - _yrefindex
-
- if nx1 is None:
- nx1 = nx+1
- if ny1 is None:
- ny1 = ny+1
-
- self._nx1 = nx1 - _xrefindex
- self._ny1 = ny1 - _yrefindex
-
-
- def __call__(self, axes, renderer):
-
- _xrefindex = self._axes_divider._xrefindex
- _yrefindex = self._axes_divider._yrefindex
-
- return self._axes_divider.locate(self._nx + _xrefindex, self._ny + _yrefindex,
- self._nx1 + _xrefindex, self._ny1 + _yrefindex,
- renderer)
-
-
-class Divider(object):
-
- def __init__(self, fig, pos, horizontal, vertical, aspect=None, anchor="C"):
- self._fig = fig
- self._pos = pos
- self._horizontal = horizontal
- self._vertical = vertical
- self._anchor = anchor
- self._aspect = aspect
- self._xrefindex = 0
- self._yrefindex = 0
-
-
- @staticmethod
- def _calc_k(l, total_size, renderer):
-
- rs_sum, as_sum = 0., 0.
-
- for s in l:
- rs, as = s.get_size(renderer)
- rs_sum += rs
- as_sum += as
-
- if rs_sum != 0.:
- k = (total_size - as_sum) / rs_sum
- return k
- else:
- return 0.
-
-
- @staticmethod
- def _calc_offsets(l, k, renderer):
-
- offsets = [0.]
-
- for s in l:
- rs, as = s.get_size(renderer)
- offsets.append(offsets[-1] + rs*k + as)
-
- return offsets
-
-
- def set_position(self, pos):
- self._pos = pos
-
- def get_position(self):
- return self._pos
-
- def set_anchor(self, anchor):
- """
- *anchor*
-
- ===== ============
- value description
- ===== ============
- 'C' Center
- 'SW' bottom left
- 'S' bottom
- 'SE' bottom right
- 'E' right
- 'NE' top right
- 'N' top
- 'NW' top left
- 'W' left
- ===== ============
-
- """
- if anchor in mtransforms.Bbox.coefs.keys() or len(anchor) == 2:
- self._anchor = anchor
- else:
- raise ValueError('argument must be among %s' %
- ', '.join(mtransforms.BBox.coefs.keys()))
-
-
- def set_horizontal(self, h):
- self._horizontal = h
-
- def get_horizontal(self):
- return self._horizontal
-
- def set_vertical(self, v):
- self._vertical = v
-
- def get_vertical(self):
- return self._vertical
-
-
- def get_anchor(self):
- return self._anchor
-
-
- def set_aspect(self, aspect=False):
- """
- *aspect* : True or False
- """
- self._aspect = aspect
-
- def get_aspect(self):
- return self._aspect
-
-
- def locate(self, nx, ny, nx1=None, ny1=None, renderer=None):
-
-
- figW,figH = self._fig.get_size_inches()
- x, y, w, h = self.get_position()
-
- k_h = self._calc_k(self._horizontal, figW*w, renderer)
- k_v = self._calc_k(self._vertical, figH*h, renderer)
-
- if self.get_aspect():
- k = min(k_h, k_v)
- ox = self._calc_offsets(self._horizontal, k, renderer)
- oy = self._calc_offsets(self._vertical, k, renderer)
-
- ww = (ox[-1] - ox[0])/figW
- hh = (oy[-1] - oy[0])/figH
- pb = mtransforms.Bbox.from_bounds(x, y, w, h)
- pb1 = mtransforms.Bbox.from_bounds(x, y, ww, hh)
- pb1_anchored = pb1.anchored(self.get_anchor(), pb)
- x0, y0 = pb1_anchored.x0, pb1_anchored.y0
-
- else:
- ox = self._calc_offsets(self._horizontal, k_h, renderer)
- oy = self._calc_offsets(self._vertical, k_v, renderer)
- x0, y0 = x, y
-
-
- if nx1 is None:
- nx1=nx+1
- if ny1 is None:
- ny1=ny+1
-
- x1, w1 = x0 + ox[nx]/figW, (ox[nx1] - ox[nx])/figW
- y1, h1 = y0 + oy[ny]/figH, (oy[ny1] - oy[ny])/figH
-
- return mtransforms.Bbox.from_bounds(x1, y1, w1, h1)
-
-
- def new_locator(self, nx, ny, nx1=None, ny1=None):
- return AxesLocator(self, nx, ny, nx1, ny1)
-
-
-class SubplotDivider(Divider):
-
- def __init__(self, fig, *args, **kwargs):
- """
- *fig* is a :class:`matplotlib.figure.Figure` instance.
-
- *args* is the tuple (*numRows*, *numCols*, *plotNum*), where
- the array of subplots in the figure has dimensions *numRows*,
- *numCols*, and where *plotNum* is the number of the subplot
- being created. *plotNum* starts at 1 in the upper left
- corner and increases to the right.
-
- If *numRows* <= *numCols* <= *plotNum* < 10, *args* can be the
- decimal integer *numRows* * 100 + *numCols* * 10 + *plotNum*.
- """
-
- self.figure = fig
-
- if len(args)==1:
- s = str(args[0])
- if len(s) != 3:
- raise ValueError('Argument to subplot must be a 3 digits long')
- rows, cols, num = map(int, s)
- elif len(args)==3:
- rows, cols, num = args
- else:
- raise ValueError( 'Illegal argument to subplot')
-
-
- total = rows*cols
- num -= 1 # convert from matlab to python indexing
- # ie num in range(0,total)
- if num >= total:
- raise ValueError( 'Subplot number exceeds total subplots')
- self._rows = rows
- self._cols = cols
- self._num = num
-
- self.update_params()
-
- pos = self.figbox.bounds
- horizontal = kwargs.pop("horizontal", [])
- vertical = kwargs.pop("vertical", [])
- aspect = kwargs.pop("aspect", None)
- anchor = kwargs.pop("anchor", "C")
-
- if kwargs:
- raise Exception("")
-
- Divider.__init__(self, fig, pos, horizontal, vertical,
- aspect=aspect, anchor=anchor)
-
-
- def get_position(self):
- self.update_params()
- return self.figbox.bounds
-
-
- def update_params(self):
- 'update the subplot position from fig.subplotpars'
-
- rows = self._rows
- cols = self._cols
- num = self._num
-
- pars = self.figure.subplotpars
- left = pars.left
- right = pars.right
- bottom = pars.bottom
- top = pars.top
- wspace = pars.wspace
- hspace = pars.hspace
- totWidth = right-left
- totHeight = top-bottom
-
- figH = totHeight/(rows + hspace*(rows-1))
- sepH = hspace*figH
-
- figW = totWidth/(cols + wspace*(cols-1))
- sepW = wspace*figW
-
- rowNum, colNum = divmod(num, cols)
-
- figBottom = top - (rowNum+1)*figH - rowNum*sepH
- figLeft = left + colNum*(figW + sepW)
-
- self.figbox = mtransforms.Bbox.from_bounds(figLeft, figBottom,
- figW, figH)
-
-class AxesDivider(Divider):
-
-
- def __init__(self, axes):
- self._axes = axes
- self._xref = Size.AxesX(axes)
- self._yref = Size.AxesY(axes)
- Divider.__init__(self, fig=axes.get_figure(), pos=None,
- horizontal=[self._xref], vertical=[self._yref],
- aspect=None, anchor="C")
-
- def new_horizontal(self, size, pad=None, pack_start=False):
-
- if pad:
- if not isinstance(pad, Size._Base):
- pad = Size.from_any(pad,
- fraction_ref=self._xref)
- if pack_start:
- self._horizontal.insert(0, pad)
- self._xrefindex += 1
- else:
- self._horizontal.append(pad)
-
- if not isinstance(size, Size._Base):
- size = Size.from_any(size,
- fraction_ref=self._xref)
-
- if pack_start:
- self._horizontal.insert(0, pad)
- self._xrefindex += 1
- locator = self.new_locator(nx=0, ny=0)
- else:
- self._horizontal.append(size)
- locator = self.new_locator(nx=len(self._horizontal)-1, ny=0)
-
- ax = LocatableAxes(self._axes.get_figure(),
- self._axes.get_position(original=True))
- locator = self.new_locator(nx=len(self._horizontal)-1, ny=0)
- ax.set_axes_locator(locator)
-
- return ax
-
- def new_vertical(self, size, pad=None, pack_start=False):
-
- if pad:
- if not isinstance(pad, Size._Base):
- pad = Size.from_any(pad,
- fraction_ref=self._yref)
- if pack_start:
- self._vertical.insert(0, pad)
- self._yrefindex += 1
- else:
- self._vertical.append(pad)
-
- if not isinstance(size, Size._Base):
- size = Size.from_any(size,
- fraction_ref=self._yref)
-
- if pack_start:
- self._vertical.insert(0, pad)
- self._yrefindex += 1
- locator = self.new_locator(nx=0, ny=0)
- else:
- self._vertical.append(size)
- locator = self.new_locator(nx=0, ny=len(self._vertical)-1)
-
- ax = LocatableAxes(self._axes.get_figure(),
- self._axes.get_position(original=True))
- ax.set_axes_locator(locator)
-
- return ax
-
-
- def get_aspect(self):
- if self._aspect is None:
- aspect = self._axes.get_aspect()
- if aspect == "auto":
- return False
- else:
- return True
- else:
- return self._aspect
-
- def get_position(self):
- if self._pos is None:
- bbox = self._axes.get_position(original=True)
- return bbox.bounds
- else:
- return self._pos
-
- def get_anchor(self):
- if self._anchor is None:
- return self._axes.get_anchor()
- else:
- return self._anchor
-
-
-
-class LocatableAxesBase:
- def __init__(self, *kl, **kw):
-
- self._axes_class.__init__(self, *kl, **kw)
-
- self._locator = None
- self._locator_renderer = None
-
- def set_axes_locator(self, locator):
- self._locator = locator
-
- def get_axes_locator(self):
- return self._locator
-
- def apply_aspect(self, position=None):
-
- if self.get_axes_locator() is None:
- self._axes_class.apply_apsect(self, position)
- else:
- pos = self.get_axes_locator()(self, self._locator_renderer)
- self._axes_class.apply_aspect(self, position=pos)
-
-
- def draw(self, renderer=None, inframe=False):
-
- self._locator_renderer = renderer
-
- self._axes_class.draw(self, renderer, inframe)
-
-
-
-_locatableaxes_classes = {}
-def locatable_axes_factory(axes_class):
-
- new_class = _locatableaxes_classes.get(axes_class)
- if new_class is None:
- new_class = new.classobj("Locatable%s" % (axes_class.__name__),
- (LocatableAxesBase, axes_class),
- {'_axes_class': axes_class})
- _locatableaxes_classes[axes_class] = new_class
-
- return new_class
-
-if hasattr(maxes.Axes, "get_axes_locator"):
- LocatableAxes = maxes.Axes
-else:
- LocatableAxes = locatable_axes_factory(maxes.Axes)
-
-
-def make_axes_locatable(axes):
- if not hasattr(axes, "set_axes_locator"):
- new_class = locatable_axes_factory(type(axes))
- axes.__class__ = new_class
-
- divider = AxesDivider(axes)
- locator = divider.new_locator(nx=0, ny=0)
- axes.set_axes_locator(locator)
-
- return divider
-
-
-def get_demo_image():
- # prepare image
- delta = 0.5
-
- extent = (-3,4,-4,3)
- import numpy as np
- x = np.arange(-3.0, 4.001, delta)
- y = np.arange(-4.0, 3.001, delta)
- X, Y = np.meshgrid(x, y)
- import matplotlib.mlab as mlab
- Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
- Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
- Z = (Z1 - Z2) * 10
-
- return Z, extent
-
-def demo_locatable_axes():
- import matplotlib.pyplot as plt
-
- fig1 = plt.figure(1, (6, 6))
- fig1.clf()
-
- ## PLOT 1
- # simple image & colorbar
- ax = fig1.add_subplot(2, 2, 1)
-
- Z, extent = get_demo_image()
-
- im = ax.imshow(Z, extent=extent, interpolation="nearest")
- cb = plt.colorbar(im)
- plt.setp(cb.ax.get_yticklabels(), visible=False)
-
-
- ## PLOT 2
- # image and colorbar whose location is adjusted in the drawing time.
- # a hard way
-
- divider = SubplotDivider(fig1, 2, 2, 2, aspect=True)
-
- # axes for image
- ax = LocatableAxes(fig1, divider.get_position())
-
- # axes for coloarbar
- ax_cb = LocatableAxes(fig1, divider.get_position())
-
- h = [Size.AxesX(ax), # main axes
- Size.Fixed(0.05), # padding, 0.1 inch
- Size.Fixed(0.2), # colorbar, 0.3 inch
- ]
-
- v = [Size.AxesY(ax)]
-
- divider.set_horizontal(h)
- divider.set_vertical(v)
-
- ax.set_axes_locator(divider.new_locator(nx=0, ny=0))
- ax_cb.set_axes_locator(divider.new_locator(nx=2, ny=0))
-
- fig1.add_axes(ax)
- fig1.add_axes(ax_cb)
-
- ax_cb.yaxis.set_ticks_position("right")
-
- Z, extent = get_demo_image()
-
- im = ax.imshow(Z, extent=extent, interpolation="nearest")
- plt.colorbar(im, cax=ax_cb)
- plt.setp(ax_cb.get_yticklabels(), visible=False)
-
- plt.draw()
- #plt.colorbar(im, cax=ax_cb)
-
-
- ## PLOT 3
- # image and colorbar whose location is adjusted in the drawing time.
- # a easy way
-
- ax = fig1.add_subplot(2, 2, 3)
- divider = make_axes_locatable(ax)
-
- ax_cb = divider.new_horizontal(size="5%", pad=0.05)
- fig1.add_axes(ax_cb)
-
- im = ax.imshow(Z, extent=extent, interpolation="nearest")
- plt.colorbar(im, cax=ax_cb)
- plt.setp(ax_cb.get_yticklabels(), visible=False)
-
-
- ## PLOT 4
- # two images side by sied with fixed padding.
-
- ax = fig1.add_subplot(2, 2, 4)
- divider = make_axes_locatable(ax)
-
- ax2 = divider.new_horizontal(size="100%", pad=0.05)
- fig1.add_axes(ax2)
-
- ax.imshow(Z, extent=extent, interpolation="nearest")
- ax2.imshow(Z, extent=extent, interpolation="nearest")
- plt.setp(ax2.get_yticklabels(), visible=False)
- plt.draw()
- plt.show()
-
-
-def demo_fixed_size_axes():
- import matplotlib.pyplot as plt
-
- fig2 = plt.figure(2, (6, 6))
-
- # The first items are for padding and the second items are for the axes.
- # sizes are in inch.
- h = [Size.Fixed(1.0), Size.Fixed(4.5)]
- v = [Size.Fixed(0.7), Size.Fixed(5.)]
-
- divider = Divider(fig2, (0.0, 0.0, 1., 1.), h, v, aspect=False)
- # the width and height of the rectangle is ignored.
-
- ax = LocatableAxes(fig2, divider.get_position())
- ax.set_axes_locator(divider.new_locator(nx=1, ny=1))
-
- fig2.add_axes(ax)
-
- ax.plot([1,2,3])
-
- plt.draw()
- plt.show()
- #plt.colorbar(im, cax=ax_cb)
-
-
-
-
-
-if __name__ == "__main__":
- demo_locatable_axes()
- demo_fixed_size_axes()
Deleted: trunk/matplotlib/examples/pylab_examples/axes_grid.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/axes_grid.py	2009年04月17日 20:40:58 UTC (rev 7051)
+++ trunk/matplotlib/examples/pylab_examples/axes_grid.py	2009年04月18日 16:02:56 UTC (rev 7052)
@@ -1,343 +0,0 @@
-import matplotlib.cbook as cbook
-
-import matplotlib.pyplot as plt
-
-from axes_divider import Size, SubplotDivider, LocatableAxes, Divider, get_demo_image
-
-class AxesGrid(object):
-
- def __init__(self, fig, rect,
- nrows_ncols,
- ngrids = None,
- direction="row",
- axes_pad = 0.02,
- axes_class=None,
- add_all=True,
- share_all=False,
- aspect=True,
- label_mode="L",
- colorbar_mode=None,
- colorbar_location="right",
- colorbar_pad=None,
- colorbar_size="5%",
- ):
-
- self._nrows, self._ncols = nrows_ncols
-
- if ngrids is None:
- ngrids = self._nrows * self._ncols
- else:
- if (ngrids > self._nrows * self._ncols) or (ngrids <= 0):
- raise Exception("")
-
- self.ngrids = ngrids
-
- self._axes_pad = axes_pad
-
- self._colorbar_mode = colorbar_mode
- self._colorbar_location = colorbar_location
- if colorbar_pad is None:
- self._colorbar_pad = axes_pad
- else:
- self._colorbar_pad = colorbar_pad
-
- self._colorbar_size = colorbar_size
-
- if direction not in ["column", "row"]:
- raise Exception("")
-
- self._direction = direction
-
-
- if axes_class is None:
- axes_class = LocatableAxes
-
-
- self.axes_all = []
- self.axes_column = [[] for i in range(self._ncols)]
- self.axes_row = [[] for i in range(self._nrows)]
-
- self.cbar_axes = []
-
- h = []
- v = []
- if cbook.is_string_like(rect) or cbook.is_numlike(rect):
- self._divider = SubplotDivider(fig, rect, horizontal=h, vertical=v,
- aspect=aspect)
- elif len(rect) == 3:
- kw = dict(horizontal=h, vertical=v, aspect=aspect)
- self._divider = SubplotDivider(fig, *rect, **kw)
- elif len(rect) == 4:
- self._divider = Divider(fig, rect, horizontal=h, vertical=v,
- aspect=aspect)
- else:
- raise Exception("")
-
-
- rect = self._divider.get_position()
-
- # reference axes
- self._column_refax = [None for i in range(self._ncols)]
- self._row_refax = [None for i in range(self._nrows)]
- self._refax = None
-
- for i in range(self.ngrids):
-
- col, row = self.get_col_row(i)
-
- if share_all:
- sharex = self._refax
- sharey = self._refax
- else:
- sharex = self._column_refax[col]
- sharey = self._row_refax[row]
-
- ax = axes_class(fig, rect, sharex=sharex, sharey=sharey)
-
- if share_all:
- if self._refax is None:
- self._refax = ax
- else:
- if sharex is None:
- self._column_refax[col] = ax
- if sharey is None:
- self._row_refax[row] = ax
-
- self.axes_all.append(ax)
- self.axes_column[col].append(ax)
- self.axes_row[row].append(ax)
-
- cax = axes_class(fig, rect)
- self.cbar_axes.append(cax)
-
- self.axes_llc = self.axes_column[0][-1]
-
- self._update_locators()
-
- if add_all:
- for ax in self.axes_all+self.cbar_axes:
- fig.add_axes(ax)
-
- self.set_label_mode(label_mode)
-
-
- def _update_locators(self):
-
- h = []
-
- h_ax_pos = []
- h_cb_pos = []
- for ax in self._column_refax:
- if h: h.append(Size.Fixed(self._axes_pad))
-
- h_ax_pos.append(len(h))
-
- if ax:
- sz = Size.AxesX(ax)
- else:
- sz = Size.AxesX(self.axes_llc)
- h.append(sz)
-
- if self._colorbar_mode == "each" and self._colorbar_location == "right":
- h.append(Size.from_any(self._colorbar_pad, sz))
- h_cb_pos.append(len(h))
- h.append(Size.from_any(self._colorbar_size, sz))
-
-
- v = []
-
- v_ax_pos = []
- v_cb_pos = []
- for ax in self._row_refax[::-1]:
- if v: v.append(Size.Fixed(self._axes_pad))
- v_ax_pos.append(len(v))
- if ax:
- sz = Size.AxesY(ax)
- else:
- sz = Size.AxesY(self.axes_llc)
- v.append(sz)
-
-
- if self._colorbar_mode == "each" and self._colorbar_location == "top":
- v.append(Size.from_any(self._colorbar_pad, sz))
- v_cb_pos.append(len(v))
- v.append(Size.from_any(self._colorbar_size, sz))
-
-
- for i in range(self.ngrids):
- col, row = self.get_col_row(i)
- #locator = self._divider.new_locator(nx=4*col, ny=2*(self._nrows - row - 1))
- locator = self._divider.new_locator(nx=h_ax_pos[col],
- ny=v_ax_pos[self._nrows -1 - row])
- self.axes_all[i].set_axes_locator(locator)
-
- if self._colorbar_mode == "each":
- if self._colorbar_location == "right":
- locator = self._divider.new_locator(nx=h_cb_pos[col],
- ny=v_ax_pos[self._nrows -1 - row])
- elif self._colorbar_location == "top":
- locator = self._divider.new_locator(nx=h_ax_pos[col],
- ny=v_cb_pos[self._nrows -1 - row])
- self.cbar_axes[i].set_axes_locator(locator)
-
-
- if self._colorbar_mode == "single":
- if self._colorbar_location == "right":
- sz = Size.Fraction(Size.AxesX(self.axes_llc), self._nrows)
- h.append(Size.from_any(self._colorbar_pad, sz))
- h.append(Size.from_any(self._colorbar_size, sz))
- locator = self._divider.new_locator(nx=-2, ny=0, ny1=-1)
- elif self._colorbar_location == "top":
- sz = Size.Fraction(Size.AxesY(self.axes_llc), self._ncols)
- v.append(Size.from_any(self._colorbar_pad, sz))
- v.append(Size.from_any(self._colorbar_size, sz))
- locator = self._divider.new_locator(nx=0, nx1=-1, ny=-2)
- for i in range(self.ngrids):
- self.cbar_axes[i].set_visible(False)
- self.cbar_axes[0].set_axes_locator(locator)
- self.cbar_axes[0].set_visible(True)
- elif self._colorbar_mode == "each":
- for i in range(self.ngrids):
- self.cbar_axes[i].set_visible(True)
- else:
- for i in range(self.ngrids):
- self.cbar_axes[i].set_visible(False)
-
- self._divider.set_horizontal(h)
- self._divider.set_vertical(v)
-
-
-
- def get_col_row(self, n):
- if self._direction == "column":
- col, row = divmod(n, self._nrows)
- else:
- row, col = divmod(n, self._ncols)
-
- return col, row
-
-
- def __getitem__(self, i):
- return self.axes_all[i]
-
-
- def get_geometry(self):
- return self._nrows, self._ncols
-
- def set_axes_pad(self, axes_pad):
- self._axes_pad = axes_pad
-
- def get_axes_pad(self):
- return self._axes_pad
-
- def set_aspect(self, aspect):
- self._divider.set_aspect(aspect)
-
- def get_aspect(self):
- return self._divider.get_aspect()
-
- def set_label_mode(self, mode):
- if mode == "all":
- for ax in self.axes_all:
- [l.set_visible(True) for l in ax.get_xticklabels()]
- [l.set_visible(True) for l in ax.get_yticklabels()]
- elif mode == "L":
- for ax in self.axes_column[0][:-1]:
- [l.set_visible(False) for l in ax.get_xticklabels()]
- [l.set_visible(True) for l in ax.get_yticklabels()]
- ax = self.axes_column[0][-1]
- [l.set_visible(True) for l in ax.get_xticklabels()]
- [l.set_visible(True) for l in ax.get_yticklabels()]
- for col in self.axes_column[1:]:
- for ax in col[:-1]:
- [l.set_visible(False) for l in ax.get_xticklabels()]
- [l.set_visible(False) for l in ax.get_yticklabels()]
- ax = col[-1]
- [l.set_visible(True) for l in ax.get_xticklabels()]
- [l.set_visible(False) for l in ax.get_yticklabels()]
- elif mode == "1":
- for ax in self.axes_all:
- [l.set_visible(False) for l in ax.get_xticklabels()]
- [l.set_visible(False) for l in ax.get_yticklabels()]
- ax = self.axes_llc
- [l.set_visible(True) for l in ax.get_xticklabels()]
- [l.set_visible(True) for l in ax.get_yticklabels()]
-
-
-
-if __name__ == "__main__":
- F = plt.figure(1, (9, 3.5))
- F.clf()
-
- F.subplots_adjust(left=0.05, right=0.98)
-
- grid = AxesGrid(F, 131, # similar to subplot(111)
- nrows_ncols = (2, 2),
- direction="row",
- axes_pad = 0.05,
- add_all=True,
- label_mode = "1",
- )
-
- Z, extent = get_demo_image()
- plt.ioff()
- for i in range(4):
- im = grid[i].imshow(Z, extent=extent, interpolation="nearest")
-
- # This only affects axes in first column and second row as share_all = False.
- grid.axes_llc.set_xticks([-2, 0, 2])
- grid.axes_llc.set_yticks([-2, 0, 2])
- plt.ion()
-
-
- grid = AxesGrid(F, 132, # similar to subplot(111)
- nrows_ncols = (2, 2),
- direction="row",
- axes_pad = 0.0,
- add_all=True,
- share_all=True,
- label_mode = "1",
- colorbar_mode="single",
- )
-
- Z, extent = get_demo_image()
- plt.ioff()
- for i in range(4):
- im = grid[i].imshow(Z, extent=extent, interpolation="nearest")
- plt.colorbar(im, cax = grid.cbar_axes[0])
- plt.setp(grid.cbar_axes[0].get_yticklabels(), visible=False)
-
- # This affects all axes as share_all = True.
- grid.axes_llc.set_xticks([-2, 0, 2])
- grid.axes_llc.set_yticks([-2, 0, 2])
-
- plt.ion()
-
-
-
- grid = AxesGrid(F, 133, # similar to subplot(122)
- nrows_ncols = (2, 2),
- direction="row",
- axes_pad = 0.1,
- add_all=True,
- label_mode = "1",
- share_all = True,
- colorbar_location="top",
- colorbar_mode="each",
- colorbar_size="7%",
- colorbar_pad="2%",
- )
- plt.ioff()
- for i in range(4):
- im = grid[i].imshow(Z, extent=extent, interpolation="nearest")
- plt.colorbar(im, cax = grid.cbar_axes[i],
- orientation="horizontal")
- grid.cbar_axes[i].xaxis.set_ticks_position("top")
- plt.setp(grid.cbar_axes[i].get_xticklabels(), visible=False)
-
- # This affects all axes as share_all = True.
- grid.axes_llc.set_xticks([-2, 0, 2])
- grid.axes_llc.set_yticks([-2, 0, 2])
-
- plt.ion()
- plt.draw()
Modified: trunk/matplotlib/lib/matplotlib/offsetbox.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/offsetbox.py	2009年04月17日 20:40:58 UTC (rev 7051)
+++ trunk/matplotlib/lib/matplotlib/offsetbox.py	2009年04月18日 16:02:56 UTC (rev 7052)
@@ -782,7 +782,8 @@
 explicitly specify the bbox_to_anchor.
 """
 
- def __init__(self, loc, pad=0.4, borderpad=0.5,
+ def __init__(self, loc,
+ pad=0.4, borderpad=0.5,
 child=None, prop=None, frameon=True,
 bbox_to_anchor=None,
 bbox_transform=None):
@@ -801,7 +802,6 @@
 'upper center' : 9,
 'center' : 10,
 
-
 pad : pad around the child for drawing a frame. given in
 fraction of fontsize.
 
@@ -813,12 +813,15 @@
 
 frameon : draw a frame box if True.
 
- bbox_to_anchor : bbox to anchor. If None, use axes.bbox.
+ bbox_to_anchor : bbox to anchor. Use self.axes.bbox if None.
 
+ bbox_transform : with which the bbox_to_anchor will be transformed.
+
 """
 
 super(AnchoredOffsetbox, self).__init__()
 
+ self.set_bbox_to_anchor(bbox_to_anchor, bbox_transform)
 self.set_child(child)
 
 self.loc = loc
@@ -838,8 +841,6 @@
 )
 self.patch.set_boxstyle("square",pad=0)
 self._drawFrame = frameon
- #self._parent_bbox = bbox_to_anchor
- self.set_bbox_to_anchor(bbox_to_anchor, bbox_transform)
 
 
 
@@ -878,13 +879,14 @@
 else:
 transform = self._bbox_to_anchor_transform
 if transform is None:
- transform = BboxTransformTo(self.axes.bbox)
+ return self._bbox_to_anchor
+ else:
+ return TransformedBbox(self._bbox_to_anchor,
+ transform)
+ 
 
- return TransformedBbox(self._bbox_to_anchor,
- transform)
 
 
-
 def set_bbox_to_anchor(self, bbox, transform=None):
 """
 set the bbox that the child will be anchored.
@@ -892,12 +894,9 @@
 *bbox* can be a Bbox instance, a list of [left, bottom, width,
 height], or a list of [left, bottom] where the width and
 height will be assumed to be zero. The bbox will be
- transformed to display coordinate by the given transform. If
- transform is None, axes.transAxes will be use.
+ transformed to display coordinate by the given transform. 
 """
- if bbox is None:
- self._bbox_to_anchor = None
- elif isinstance(bbox, BboxBase):
+ if bbox is None or isinstance(bbox, BboxBase):
 self._bbox_to_anchor = bbox
 else:
 try:
Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/anchored_artists.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/anchored_artists.py	2009年04月17日 20:40:58 UTC (rev 7051)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/anchored_artists.py	2009年04月18日 16:02:56 UTC (rev 7052)
@@ -78,45 +78,3 @@
 
 
 
-if __name__ == "__main__":
- import matplotlib.pyplot as plt
- from matplotlib.patches import Circle
-
- #import matplotlib.offsetbox
- #matplotlib.offsetbox.DEBUG=False
-
- #ax = plt.subplot(1,1,1)
- plt.clf()
- plt.cla()
- plt.draw()
- ax = plt.gca()
- ax.set_aspect(1.)
-
- at = AnchoredText("Figure 1a",
- loc=2, frameon=True)
- at.patch.set_boxstyle("round,pad=0.,rounding_size=0.2")
- ax.add_artist(at)
-
- ada = AnchoredDrawingArea(20, 20, 0, 0,
- loc=1, pad=0., frameon=False)
- p = Circle((10, 10), 10)
- ada.da.add_artist(p)
- ax.add_artist(ada)
-
-
- as = AnchoredSizeBar(ax, 0.1, r"1$^{\prime}$",
- loc=8,
- pad=0.1, borderpad=0.5, sep=5,
- frameon=False)
- ax.add_artist(as)
-
-
- ae = AnchoredEllipse(ax, width=0.1, height=0.15, angle=0.,
- loc=3, pad=0.5, borderpad=0.4, frameon=True)
-
- ax.add_artist(ae)
-
- plt.draw()
- plt.show()
-
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7051
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7051&view=rev
Author: jdh2358
Date: 2009年04月17日 20:40:58 +0000 (2009年4月17日)
Log Message:
-----------
use 0 for default in rec join outer join if no default given
Modified Paths:
--------------
 trunk/matplotlib/examples/misc/rec_join_demo.py
Modified: trunk/matplotlib/examples/misc/rec_join_demo.py
===================================================================
--- trunk/matplotlib/examples/misc/rec_join_demo.py	2009年04月17日 20:40:29 UTC (rev 7050)
+++ trunk/matplotlib/examples/misc/rec_join_demo.py	2009年04月17日 20:40:58 UTC (rev 7051)
@@ -19,7 +19,7 @@
 print "r2:"
 print mlab.rec2txt(r2)
 
-defaults = {'marker':-1, '_close':np.NaN, 'low':-4444.}
+defaults = {'marker':-1, 'close':np.NaN, 'low':-4444.}
 
 for s in ('inner', 'outer', 'leftouter'):
 rec = mlab.rec_join(['date', 'high'], r1, r2,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

Showing results of 56

1 2 3 > >> (Page 1 of 3)
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /