Revision: 7870
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7870&view=rev
Author:   astraw
Date:     2009-10-11 19:09:30 +0000 (Sun, 11 Oct 2009)

Log Message:
-----------
testing: add test_imshow_clip() based on report by Gellule Xg 
<[email protected]>

Modified Paths:
--------------
    trunk/matplotlib/lib/matplotlib/tests/test_axes.py

Modified: trunk/matplotlib/lib/matplotlib/tests/test_axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/tests/test_axes.py  2009-10-11 19:08:32 UTC 
(rev 7869)
+++ trunk/matplotlib/lib/matplotlib/tests/test_axes.py  2009-10-11 19:09:30 UTC 
(rev 7870)
@@ -380,6 +380,34 @@
     ax.imshow(r)
     fig.savefig('imshow')
 
+...@image_comparison(baseline_images=['imshow_clip'])
+def test_imshow_clip():
+    # As originally reported by Gellule Xg <[email protected]>
+
+    #Create a NxN image
+    N=100
+    (x,y) = np.indices((N,N))
+    x -= N/2
+    y -= N/2
+    r = np.sqrt(x**2+y**2-x*y)
+
+    #Create a contour plot at N/4 and extract both the clip path and transform
+    fig = plt.figure()
+    ax = fig.add_subplot(111)
+
+    c = ax.contour(r,[N/4])
+    x = c.collections[0]
+    clipPath = x.get_paths()[0]
+    clipTransform = x.get_transform()
+
+    from matplotlib.transforms import TransformedPath
+    clip_path = TransformedPath(clipPath, clipTransform)
+
+    #Plot the image clipped by the contour
+    ax.imshow(r, clip_path=clip_path)
+    fig.savefig('imshow_clip')
+
+
 if __name__=='__main__':
     import nose
     nose.runmodule(argv=['-s','--with-doctest'], exit=False)


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to