views:

147

answers:

2

I'm trying to create an image using matplotlib.pyplot.imshow(). However, when I run the program from my console, it doesn't display anything?

This is the code:

import matplotlib.pyplot

myimage = gen_image()

matplotlib.pyplot.gray()
matplotlib.pyplot.imshow(results)

But this shows nothing.

+1  A: 

You have to call the show function to actually display anything, like

matplotlib.pyplot.show()

Unfortunately the matplotlib documentation seems to be currently broken, so I can't provide a link.

Note that for interactive plotting one typically uses IPython, which has special support for matplotlib.

By the way, you can do

import matplotlib.pyplot as plt

to make the typing less tedious (this is pretty much the official standard way).

nikow
A: 

You could try http://fishsoup.net/software/reinteract/

Nick
Looks similar to SAGE (http://www.sagemath.org/), which is probably more widespread.
nikow