Hi all,
today at work we ran into some odd behavior, all of which seems to be
triggered by calling hold(). I'm using a fresh SVN build from this
afternoon.
Here's the first example demonstrating the problem, it's best to run
this in a fresh pylab shell or from the command line, since I suspect
internal state matters (when it shouldn't):
import pylab as P
x = P.arange(10)
y = x+1
P.figure()
P.plot(x,label='one')
P.plot(y,label='two')
P.legend()
P.title('Two plots ok')
P.figure()
P.hold(True)
P.plot(x,label='one')
P.plot(y,label='two')
P.legend()
P.title('Two plots ok - HOLD called')
P.hold(False)
P.figure()
P.plot(x,label='one')
P.plot(y,label='two')
P.legend()
P.title('One plot MISSING!')
P.show()
#### EOF
And here's the second manifestation of the problem, where the colorbar
gets all messed up:
import numpy as N
import pylab as P
a = N.random.rand(64,64)
P.figure()
P.imshow(a)
P.colorbar()
P.title('Colorbar OK')
# If the hold() calls are commented out, the problem disappears
P.figure()
P.hold(True)
P.plot(range(10))
P.hold(False)
P.figure()
P.imshow(a)
P.colorbar()
P.title('Colorbar BROKEN!')
P.show()
#### EOF
It looks like making calls to hold() messes up internal state in pylab
somehow. I've never used hold() myself before, but my officemate did,
coming from matlab, and started seeing bizarre behavior. These are
little self-contained examples showing the problem.
Cheers,
f