[SciPy-user] Alternative to NumTut's view() function?

Yann Le Du scipy-user@scipy.net
Fri, 14 Feb 2003 14:06:57 +0100 (CET)


On Thu, 13 Feb 2003, Fernando Perez wrote:

> In the past I've used the view() function from NumTut (Numeric's tutorial 
> package) to view 2-d arrays.  But now something isn't working too well (and 
> I've seen reports from others on the web about this).  Basically, there seems 
> to be a threading problem, and the simple act of importing view.py kicks cpu 
> usage to 100% and makes any interactive work in the python interpreter 
> impossible.  I tested it both with ipython and a regular python shell.

Yes, I can't use it either.


> At any rate, I wonder if as part of scipy there is anything with similar 
> functionality.  view() allows one to view 2-d arrays as images, in either 
> grayscale or color.  Since I don't have high hopes for anyone fixing view(), 
> and I'm switching to scipy for all my work, I'd be happy to go with a 
> scipy-based alternative if one exists.

Having discovered that view() didn't work, I looked at scipy's website, in 
the plotting tutorial, and found a solution using plt :

plt.image(name_of_array)

and

plt.imagesc(name_of_array)

For more details have a look at :

http://www.scipy.org/site_content/tutorials/plot_tutorial

and more particularly where they display an image of "Lena".

I use these plt functions inside ipython (launched with "-p scipy"), and 
it works great.

I hope this helps !

Yann