Re: [Matplotlib-users] Artist tutorial different response

2010-03-03 Thread Matthias Michler
On Saturday 27 February 2010 07:39:59 David Arnold wrote:
 All,

 On: http://matplotlib.sourceforge.net/users/artists.html

 In the Axes Container section, you can see in what follows that I got some
 very different responses than what is shown on the page:

 In [1]: fig=figure()

 In [3]: ax=fig.add_subplot(111)

 In [4]: rect=matplotlib.patches.Rectangle((1,1),width=5,height=12)

 In [5]: print rect.get_axes()
 -- print(rect.get_axes())
 None

 In [6]: print rect.get_transform()
 -- print(rect.get_transform())
 BboxTransformTo(Bbox(array([[  1.,   1.],
[  6.,  13.]])))

 In [7]: ax.add_patch(rect)
 Out[7]: matplotlib.patches.Rectangle object at 0x2144db0

 In [8]: print rect.get_axes()
 -- print(rect.get_axes())
 Axes(0.125,0.1;0.775x0.8)

 In [9]: print rect.get_transform()
 -- print(rect.get_transform())
 CompositeGenericTransform(BboxTransformTo(Bbox(array([[  1.,   1.],
[  6.,  13.]]))),
 CompositeGenericTransform(TransformWrapper(BlendedAffine2D(IdentityTransfor
m(),IdentityTransform())),
 CompositeAffine2D(BboxTransformFrom(TransformedBbox(Bbox(array([[ 0.,  0.],
 [ 1.,  1.]])),
 TransformWrapper(BlendedAffine2D(IdentityTransform(),IdentityTransform(
), BboxTransformTo(TransformedBbox(Bbox(array([[ 0.125,  0.1  ], [ 0.9  , 
 0.9  ]])), BboxTransformTo(TransformedBbox(Bbox(array([[ 0.,  0.], [ 8., 
 6.]])), Affine2D(array([[ 80.,   0.,   0.],
[  0.,  80.,   0.],
[  0.,   0.,   1.]])

 In [10]: print ax.transData
 --- print(ax.transData)
 CompositeGenericTransform(TransformWrapper(BlendedAffine2D(IdentityTransfor
m(),IdentityTransform())),
 CompositeAffine2D(BboxTransformFrom(TransformedBbox(Bbox(array([[ 0.,  0.],
 [ 1.,  1.]])),
 TransformWrapper(BlendedAffine2D(IdentityTransform(),IdentityTransform(
), BboxTransformTo(TransformedBbox(Bbox(array([[ 0.125,  0.1  ], [ 0.9  , 
 0.9  ]])), BboxTransformTo(TransformedBbox(Bbox(array([[ 0.,  0.], [ 8., 
 6.]])), Affine2D(array([[ 80.,   0.,   0.],
[  0.,  80.,   0.],
[  0.,   0.,   1.]]

 In [11]: print ax.get_xlim()
 --- print(ax.get_xlim())
 (0.0, 1.0)

 In [12]: print ax.dataLim.get_bounds()
 --- print(ax.dataLim.get_bounds())
 ---
 AttributeErrorTraceback (most recent call last)

 /Library/Frameworks/Python.framework/Versions/6.0.0/Examples/matplotlib-0.9
9.1.1/event_handling/ipython console in module()

 AttributeError: 'Bbox' object has no attribute 'get_bounds'

 In [13]: ax.autoscale_view()

 In [14]: print ax.get_xlim()
 --- print(ax.get_xlim())
 (1.0, 6.0)

 In [15]: ax.figure.canvas.draw()

 David.

Hi David,

The biggest difference occurs for 
  print ax.dataLim.get_bounds()
because this method has been replaced by the property 
  print ax.dataLim.bounds
as is mentioned in the API-changes, but didn't find his way into this 
documentation.

I attached a patch with modified documentation and further replacements 
of 'get_bounds' in current svn. Could any of the developers have a look at it 
and commit these changes or should a post the patch at the patch-tracker?

Kind regards,
Matthias
Index: doc/users/artists.rst
===
--- doc/users/artists.rst	(revision 8171)
+++ doc/users/artists.rst	(working copy)
@@ -419,7 +419,7 @@
 # and notice that the ax.add_patch method has set the axes
 # instance
 In [267]: print rect.get_axes()
-Subplot(49,81.25)
+Axes(0.125,0.1;0.775x0.8)
 
 # and the transformation has been set too
 In [268]: print rect.get_transform()
@@ -434,7 +434,7 @@
 (0.0, 1.0)
 
 # but the data limits have been updated to encompass the rectangle
-In [271]: print ax.dataLim.get_bounds()
+In [271]: print ax.dataLim.bounds
 (1.0, 1.0, 5.0, 12.0)
 
 # we can manually invoke the auto-scaling machinery
Index: lib/matplotlib/finance.py
===
--- lib/matplotlib/finance.py	(revision 8171)
+++ lib/matplotlib/finance.py	(working copy)
@@ -597,8 +597,8 @@
 maxy = max([volume for d, open, close, high, low, volume in quotes])
 corners = (minpy, miny), (maxx, maxy)
 ax.update_datalim(corners)
-#print 'datalim', ax.dataLim.get_bounds()
-#print 'viewlim', ax.viewLim.get_bounds()
+#print 'datalim', ax.dataLim.bounds
+#print 'viewlim', ax.viewLim.bounds
 
 ax.add_collection(barCollection)
 ax.autoscale_view()
Index: lib/matplotlib/patches.py
===
--- lib/matplotlib/patches.py	(revision 8171)
+++ lib/matplotlib/patches.py	(working copy)
@@ -1414,12 +1414,12 @@
 pad = props.pop('pad', 4)
 pad = renderer.points_to_pixels(pad)
 bbox = artist.get_window_extent(renderer)
-l,b,w,h = bbox.bounds
-l-=pad/2.
-b-=pad/2.
-w+=pad
-h+=pad
-r = Rectangle(xy=(l,b),
+ 

Re: [Matplotlib-users] Artist tutorial different response

2010-03-03 Thread John Hunter
On Wed, Mar 3, 2010 at 9:56 AM, Matthias Michler
matthiasmich...@gmx.net wrote:

 I attached a patch with modified documentation and further replacements
 of 'get_bounds' in current svn. Could any of the developers have a look at it
 and commit these changes or should a post the patch at the patch-tracker?

The patch looks good -- could I trouble you to make a patch against
the maintenance branch, which I can then merge into the trunk

http://matplotlib.sourceforge.net/devel/coding_guide.html#svn-checkouts

Thanks!
JDH

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Artist tutorial different response

2010-03-03 Thread Matthias Michler
On Wednesday 03 March 2010 17:02:58 John Hunter wrote:
 On Wed, Mar 3, 2010 at 9:56 AM, Matthias Michler

 matthiasmich...@gmx.net wrote:
  I attached a patch with modified documentation and further replacements
  of 'get_bounds' in current svn. Could any of the developers have a look
  at it and commit these changes or should a post the patch at the
  patch-tracker?

 The patch looks good -- could I trouble you to make a patch against
 the maintenance branch, which I can then merge into the trunk

 http://matplotlib.sourceforge.net/devel/coding_guide.html#svn-checkouts

 Thanks!
 JDH

Hi John,

I'm sorry. I didn't do this before and propably I won't manage it today.

Which of the maintance branches do you mean? 
v0_91_maint/
v0_98_5_maint/
v0_99_maint/
or something completely different?

By the way I think the link on devel/coding_guide.html to get svnmerge.py 
seems to be broken:
http://svn.collab.net/repos/svn/trunk/contrib/client-side/svnmerge/svnmerge.py
and in the attached patch doc_devel_coding_guide.patch I replaced it by:
http://svn.apache.org/repos/asf/subversion/trunk/contrib/client-side/svnmerge/svnmerge.py

Kind regards,
Matthias
Index: doc/devel/coding_guide.rst
===
--- doc/devel/coding_guide.rst	(revision 8171)
+++ doc/devel/coding_guide.rst	(working copy)
@@ -82,8 +82,8 @@
 
 * install ``svnmerge.py`` in your PATH::
 
- wget http://svn.collab.net/repos/svn/trunk/contrib/client-side/\
-  svnmerge/svnmerge.py
+ wget http://svn.apache.org/repos/asf/subversion/trunk/contrib/\
+  client-side/svnmerge/svnmerge.py
 
 * get a svn checkout of the branch you'll be making bugfixes to and
   the trunk (see above)
--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Artist tutorial different response

2010-03-03 Thread John Hunter
On Wed, Mar 3, 2010 at 10:25 AM, Matthias Michler
matthiasmich...@gmx.net wrote:
 On Wednesday 03 March 2010 17:02:58 John Hunter wrote:
 On Wed, Mar 3, 2010 at 9:56 AM, Matthias Michler

 matthiasmich...@gmx.net wrote:
  I attached a patch with modified documentation and further replacements
  of 'get_bounds' in current svn. Could any of the developers have a look
  at it and commit these changes or should a post the patch at the
  patch-tracker?

 The patch looks good -- could I trouble you to make a patch against
 the maintenance branch, which I can then merge into the trunk

 http://matplotlib.sourceforge.net/devel/coding_guide.html#svn-checkouts

 Thanks!
 JDH

 Hi John,

 I'm sorry. I didn't do this before and propably I won't manage it today.

No need to apologize -- I appreciate you taking the time to make the
patch.  Since this bug affects the branch and the trunk, I'd like to
see if fixed in both places since we plan to do a release of the
maintenance branch first and then the trunk.  The easiest way to do
this in our workflow is to fix the branch and merge to the trunk.

 Which of the maintance branches do you mean?
 v0_91_maint/
 v0_98_5_maint/
 v0_99_maint/
 or something completely different?

v0_99_maint is the current maintenance branch/


 By the way I think the link on devel/coding_guide.html to get svnmerge.py
 seems to be broken:
 http://svn.collab.net/repos/svn/trunk/contrib/client-side/svnmerge/svnmerge.py
 and in the attached patch doc_devel_coding_guide.patch I replaced it by:
 http://svn.apache.org/repos/asf/subversion/trunk/contrib/client-side/svnmerge/svnmerge.py


OK, thanks, I'll try and apply this.

JDH

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Artist tutorial different response

2010-03-03 Thread Matthias Michler
On Wednesday 03 March 2010 17:30:52 John Hunter wrote:
 On Wed, Mar 3, 2010 at 10:25 AM, Matthias Michler

 matthiasmich...@gmx.net wrote:
  On Wednesday 03 March 2010 17:02:58 John Hunter wrote:
  On Wed, Mar 3, 2010 at 9:56 AM, Matthias Michler
 
  matthiasmich...@gmx.net wrote:
   I attached a patch with modified documentation and further
   replacements of 'get_bounds' in current svn. Could any of the
   developers have a look at it and commit these changes or should a post
   the patch at the patch-tracker?
 
  The patch looks good -- could I trouble you to make a patch against
  the maintenance branch, which I can then merge into the trunk
 
  http://matplotlib.sourceforge.net/devel/coding_guide.html#svn-checkouts
 
  Thanks!
  JDH
 
  Hi John,
 
  I'm sorry. I didn't do this before and propably I won't manage it today.

 No need to apologize -- I appreciate you taking the time to make the
 patch.  Since this bug affects the branch and the trunk, I'd like to
 see if fixed in both places since we plan to do a release of the
 maintenance branch first and then the trunk.  The easiest way to do
 this in our workflow is to fix the branch and merge to the trunk.

Hi John,

no problem ...

  Which of the maintance branches do you mean?
  v0_91_maint/
  v0_98_5_maint/
  v0_99_maint/
  or something completely different?

 v0_99_maint is the current maintenance branch/

I checked out 
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_99_maint/
and included my changes of trunk as you can see in the attached patch.  

Furthermore I replaced a (minor) typo in 
lib/matplotlib/patches.py:
-  self.legnthA*scaleA)
+  self.lengthA*scaleA)

Does this patch fulfill your needs?

Kind regards, 
Matthias
Index: doc/users/artists.rst
===
--- doc/users/artists.rst	(revision 8171)
+++ doc/users/artists.rst	(working copy)
@@ -419,7 +419,7 @@
 # and notice that the ax.add_patch method has set the axes
 # instance
 In [267]: print rect.get_axes()
-Subplot(49,81.25)
+Axes(0.125,0.1;0.775x0.8)
 
 # and the transformation has been set too
 In [268]: print rect.get_transform()
@@ -434,7 +434,7 @@
 (0.0, 1.0)
 
 # but the data limits have been updated to encompass the rectangle
-In [271]: print ax.dataLim.get_bounds()
+In [271]: print ax.dataLim.bounds
 (1.0, 1.0, 5.0, 12.0)
 
 # we can manually invoke the auto-scaling machinery
Index: lib/matplotlib/finance.py
===
--- lib/matplotlib/finance.py	(revision 8171)
+++ lib/matplotlib/finance.py	(working copy)
@@ -597,8 +597,8 @@
 maxy = max([volume for d, open, close, high, low, volume in quotes])
 corners = (minpy, miny), (maxx, maxy)
 ax.update_datalim(corners)
-#print 'datalim', ax.dataLim.get_bounds()
-#print 'viewlim', ax.viewLim.get_bounds()
+#print 'datalim', ax.dataLim.bounds
+#print 'viewlim', ax.viewLim.bounds
 
 ax.add_collection(barCollection)
 ax.autoscale_view()
Index: lib/matplotlib/patches.py
===
--- lib/matplotlib/patches.py	(revision 8171)
+++ lib/matplotlib/patches.py	(working copy)
@@ -1383,12 +1383,12 @@
 pad = props.pop('pad', 4)
 pad = renderer.points_to_pixels(pad)
 bbox = artist.get_window_extent(renderer)
-l,b,w,h = bbox.bounds
-l-=pad/2.
-b-=pad/2.
-w+=pad
-h+=pad
-r = Rectangle(xy=(l,b),
+l, b, w, h = bbox.bounds
+l -= pad/2.
+b -= pad/2.
+w += pad
+h += pad
+r = Rectangle(xy=(l, b),
   width=w,
   height=h,
   fill=fill,
@@ -1407,8 +1407,8 @@
 to test whether the artist is returning the correct bbox.
 
 
-l,b,w,h = bbox.get_bounds()
-r = Rectangle(xy=(l,b),
+l, b, w, h = bbox.bounds
+r = Rectangle(xy=(l, b),
   width=w,
   height=h,
   edgecolor=color,
@@ -3174,7 +3174,7 @@
 cos_t, sin_t = get_cos_sin(x1, y1, x0, y0)
 verticesA, codesA = self._get_bracket(x0, y0, cos_t, sin_t,
   self.widthA*scaleA,
-  self.legnthA*scaleA)
+  self.lengthA*scaleA)
 vertices_list.append(verticesA)
 codes_list.append(codesA)
 
Index: lib/matplotlib/backends/backend_wxagg.py
===
--- lib/matplotlib/backends/backend_wxagg.py	(revision 8171)
+++ lib/matplotlib/backends/backend_wxagg.py	(working copy)
@@ -171,7 +171,7 @@
 
 Convert the region of a wx.Image bounded by bbox to a wx.Bitmap.
 
-l, b, width, height = 

[Matplotlib-users] Artist tutorial different response

2010-02-26 Thread David Arnold
All,

On: http://matplotlib.sourceforge.net/users/artists.html

In the Axes Container section, you can see in what follows that I got some very 
different responses than what is shown on the page:

In [1]: fig=figure()

In [3]: ax=fig.add_subplot(111)

In [4]: rect=matplotlib.patches.Rectangle((1,1),width=5,height=12)

In [5]: print rect.get_axes()
-- print(rect.get_axes())
None

In [6]: print rect.get_transform()
-- print(rect.get_transform())
BboxTransformTo(Bbox(array([[  1.,   1.],
   [  6.,  13.]])))

In [7]: ax.add_patch(rect)
Out[7]: matplotlib.patches.Rectangle object at 0x2144db0

In [8]: print rect.get_axes()
-- print(rect.get_axes())
Axes(0.125,0.1;0.775x0.8)

In [9]: print rect.get_transform()
-- print(rect.get_transform())
CompositeGenericTransform(BboxTransformTo(Bbox(array([[  1.,   1.],
   [  6.,  13.]]))), 
CompositeGenericTransform(TransformWrapper(BlendedAffine2D(IdentityTransform(),IdentityTransform())),
 CompositeAffine2D(BboxTransformFrom(TransformedBbox(Bbox(array([[ 0.,  0.],
   [ 1.,  1.]])), 
TransformWrapper(BlendedAffine2D(IdentityTransform(),IdentityTransform(), 
BboxTransformTo(TransformedBbox(Bbox(array([[ 0.125,  0.1  ],
   [ 0.9  ,  0.9  ]])), BboxTransformTo(TransformedBbox(Bbox(array([[ 0.,  
0.],
   [ 8.,  6.]])), Affine2D(array([[ 80.,   0.,   0.],
   [  0.,  80.,   0.],
   [  0.,   0.,   1.]])

In [10]: print ax.transData
--- print(ax.transData)
CompositeGenericTransform(TransformWrapper(BlendedAffine2D(IdentityTransform(),IdentityTransform())),
 CompositeAffine2D(BboxTransformFrom(TransformedBbox(Bbox(array([[ 0.,  0.],
   [ 1.,  1.]])), 
TransformWrapper(BlendedAffine2D(IdentityTransform(),IdentityTransform(), 
BboxTransformTo(TransformedBbox(Bbox(array([[ 0.125,  0.1  ],
   [ 0.9  ,  0.9  ]])), BboxTransformTo(TransformedBbox(Bbox(array([[ 0.,  
0.],
   [ 8.,  6.]])), Affine2D(array([[ 80.,   0.,   0.],
   [  0.,  80.,   0.],
   [  0.,   0.,   1.]]

In [11]: print ax.get_xlim()
--- print(ax.get_xlim())
(0.0, 1.0)

In [12]: print ax.dataLim.get_bounds()
--- print(ax.dataLim.get_bounds())
---
AttributeErrorTraceback (most recent call last)

/Library/Frameworks/Python.framework/Versions/6.0.0/Examples/matplotlib-0.99.1.1/event_handling/ipython
 console in module()

AttributeError: 'Bbox' object has no attribute 'get_bounds'

In [13]: ax.autoscale_view()

In [14]: print ax.get_xlim()
--- print(ax.get_xlim())
(1.0, 6.0)

In [15]: ax.figure.canvas.draw()

David.
--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users