Revision: 5886
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5886&view=rev
Author: pkienzle
Date: 2008-07-26 18:33:15 +0000 (Sat, 26 Jul 2008)
Log Message:
-----------
to_numeric requires PIL
Modified Paths:
--------------
trunk/matplotlib/examples/pylab_examples/to_numeric.py
Modified: trunk/matplotlib/examples/pylab_examples/to_numeric.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/to_numeric.py 2008-07-26
04:50:56 UTC (rev 5885)
+++ trunk/matplotlib/examples/pylab_examples/to_numeric.py 2008-07-26
18:33:15 UTC (rev 5886)
@@ -1,12 +1,16 @@
#!/usr/bin/env python
"""
Use backend agg to access the figure canvas as an RGB string and then
-convert it to a Numeric array and pass the string it to PIL for
+convert it to an array and pass the string it to PIL for
rendering
"""
from pylab import *
from matplotlib.backends.backend_agg import FigureCanvasAgg
+try:
+ import Image
+except ImportError, exc:
+ raise SystemExit("PIL must be installed to run this example")
plot([1,2,3])
@@ -21,10 +25,9 @@
w, h = int(w), int(h)
-X = fromstring(s, UInt8)
+X = fromstring(s, uint8)
X.shape = h, w, 3
-import Image
im = Image.fromstring( "RGB", (w,h), s)
im.show()
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins