I've done this on my system at home, but it doesn't seem to be working at
work.

I generate a series of imshow() plots, each followed by a show() command.
When I run the script, it should pause after each show() until I exit the
plot, and then display the next plot. But now it isn't working. The first
plot gets displayed and pauses, and then it falls through to the end.

numpy 1.0.3.1, matplotlib 0.90.1

------------------------------
from numpy import arange, array, mgrid, cos, random
import scipy.stats as stats
import scipy.signal as signal

#-------------------------------
#   2D filters
#-------------------------------

#   from Scipy cookbook
def gauss_kern(size, sizey=None):
    """ Returns a normalized 2D gauss kernel array for convolutions """
    size = int(size)
    if not sizey:
        sizey = size
    else:
        sizey = int(sizey)
    x, y = mgrid[-size:size+1, -sizey:sizey+1]
    g = exp(-(x**2/float(size)+y**2/float(sizey)))
    return g / g.sum()

#   from Scipy cookbook
def blur_image(im, n, ny=None) :
    """ blurs the image by convolving with a gaussian kernel of typical
        size n. The optional keyword argument ny allows for a different
        size in the y direction.
    """
    g = gauss_kern(n, sizey=ny)
    improc = signal.convolve(im,g, mode='valid')
    return(improc)


################################################################################
#               test section
################################################################################

if __name__ == '__main__' :

    X,Y = mgrid[-70:70,-70:70]
    Z = cos((X**2+Y**2)/200.) + random.normal(size=X.shape)

    from matplotlib.pylab import *

    imshow(Z, hold=True)
    show()

    #   gaussian blur, 5x5

    NewZ = blur_image(Z,15)
    imshow(NewZ, hold=True)
    show()
---------------------------------
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to