############################### def plot(f, delay=1): # Plot it # # from Gnuplot import Gnuplot, GridData g = Gnuplot() g('set grid') if len(f.shape) > 2: # Plot a 2D slice from last two dimensions # N = len(f.shape) zeros = '0,'*(N-2) s = 'GridData(f[' + zeros + ':,:],with="lines")' data = eval(s) g.splot(data) else: data = GridData(f,with="lines") g.splot(data) import types if delay: if type(delay) in [types.IntType, types.FloatType, types.LongType]: import time time.sleep(delay) else: raise "Unknown type for delay", delay else: raw_input('Press any key to stop')