Skip to content

Instantly share code, notes, and snippets.

@tkf
Created October 3, 2009 16:35
Show Gist options
  • Save tkf/200738 to your computer and use it in GitHub Desktop.
Save tkf/200738 to your computer and use it in GitHub Desktop.
list_func = [ lambda x: numpy.sin(x),
lambda x: numpy.sin(0.1*x),
lambda x: numpy.sin(x)*numpy.sin(0.1*x) ]
list_tmax = [30,50,70,100,200]
dt = 1
nrows_ncols = (len(list_func), len(list_tmax))
num_steps = sum(list_tmax) * dt
num_rows = len(list_func)
figsizex_per_steps = 0.04
figsizey_per_rows = 2
figsize = ( figsizex_per_steps * num_steps ,
figsizey_per_rows * num_rows )
F = plt.figure(1, figsize=figsize)
F.clf()
grid = AxesGrid(F, 111, # similar to subplot(111)
nrows_ncols = nrows_ncols,
axes_pad = 0.0,
add_all=True,
aspect=False,
)
for ax in grid:
ax.cla()
grid.set_label_mode('L')
i = 0
for f in list_func:
for tmax in list_tmax:
t = numpy.arange(0,tmax,dt)
grid[i].plot(t, f(t), 'o-')
i += 1
plt.draw()
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment