|
From: John H. <jdh...@ac...> - 2006-04-17 14:27:53
|
You seem to be mixing idioms, between pylab which manages current
figure and current axes, and explicitly managing the Figure and Axes
instances yourself. Eg
fig = figure()
hold(False) #<-- manipulates current axes
for counter in counter_list:
y = intensities_calc[counter]
plotnr = plotnr+1
ax = subplot(rownrs, colnrs, plotnr) #<-- uses current fig
fig.add_subplot(ax)
plot(x,y) #<-- uses current axes
if ax.is_last_row():
ax.set_xlabel('time')
If you want to manage the figure and axes attributes yourself, which
is good practice, I suggest imposing some discipline on yourself and
only importing 4 things from pylab (this is what I usually do)
from pylab import figure, show, nx, close
Your code would then look something like:
fig = figure()
for counter in counter_list:
y = intensities_calc[counter]
plotnr = plotnr+1
ax = fig.add_subplot(rownrs, colnrs, plotnr)
ax.hold(False)
ax.plot(x,y)
if ax.is_last_row():
ax.set_xlabel('time')
That should work, as long as plotnr is incrementing like you expect it
to.
JDH
|