Revision: 7027
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7027&view=rev
Author:   astraw
Date:     2009-04-05 22:06:05 +0000 (Sun, 05 Apr 2009)

Log Message:
-----------
pngsuite test: plot images in grayscale if the input array is 2 dimensional

Modified Paths:
--------------
    branches/v0_98_5_maint/examples/tests/pngsuite/pngsuite.py

Modified: branches/v0_98_5_maint/examples/tests/pngsuite/pngsuite.py
===================================================================
--- branches/v0_98_5_maint/examples/tests/pngsuite/pngsuite.py  2009-04-05 
02:23:03 UTC (rev 7026)
+++ branches/v0_98_5_maint/examples/tests/pngsuite/pngsuite.py  2009-04-05 
22:06:05 UTC (rev 7027)
@@ -8,6 +8,7 @@
 """
 
 from matplotlib import pyplot as plt
+import matplotlib.cm as cm
 import glob
 
 files = glob.glob("basn*.png")
@@ -17,7 +18,11 @@
 
 for i, fname in enumerate(files):
     data = plt.imread(fname)
-    plt.imshow(data, extent=[i,i+1,0,1])
+    cmap = None # use default colormap
+    if data.ndim==2:
+        # keep grayscale images gray
+        cmap = cm.gray
+    plt.imshow(data, extent=[i,i+1,0,1], cmap=cmap)
 
 plt.gca().get_frame().set_facecolor("#ddffff")
 plt.gca().set_xlim(0, len(files))


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

------------------------------------------------------------------------------
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to