Greetings,
    I just installed Python 2.6 (python.org), Numpy 1.4.1, and Matplotlib
0.99.1.2 all on Mac OS X 10.6 in an attempt to learn about scientific
programming in python.  Go easy on me since I am a begginer.  The Python and
Numpy seem to be working correctly.  I can get matplotlib to make plots but
I can't get it to show images.  I tried the stinkbug example in
the Matplotlib users guide documentation with no success.  Errors are _NOT_
generated but neither are any results on the screen.  The imread command
produces a float32 matrix that contains all 1. values so I tried creating my
own uint8 matrix with a diagnoal line.  My code is below.  Thanks for any
help you can provide.



# -*- coding: utf-8 -*-
from numpy import *
import matplotlib.pyplot as plt
import matplotlib.image as mpimg

print "Numpy version: " + __version__
a = array([10,20,30,40])
print "result of a"
print a

b = arange(4)
print "result of b"
print b

c = linspace(-pi, pi, 30)
print "result of c"
print c

# this plot code works
print "plot c"
plt.plot(c)
plt.ylabel("-pi to + pi")
plt.xlabel("value of c")
plt.show()

# this image processing code does not work
print "doing image processing stuff"
# img=mpimg.imread("/Users/rovitotv/Desktop/stinkbug.png") # this does not
work
img = zeros((10, 10), dtype=uint8)
for i in range(10):
    img[i,i] = 255;

plt.imshow(img)
print "data type of img:"
print img.dtype
print "size of img:" + str(img.size)
print img
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to