boson
boson

Reputation: 894

Can't get 3 plots to overlay in pylab

I'm trying to get 3 plots to be on the same canvas but only one is displaying. Is this the right syntax?

fig = pylab.figure()
ax = fig.add_subplot(111)
ax.plot(freqs,modfreqp,color='black')
pylab.plot(freqs,modfreqp,color='black')
pylab.hold(True)

ax1 = fig.add_subplot(111)
ax1.plot(freqs1,modfreqp1,color='blue')
pylab.plot(freqs1,modfreqp1,color='blue')
pylab.hold(True)

ax2 = fig.add_subplot(111)
ax2.plot(freqs2,modfreqp2,color='red')
pylab.plot(freqs2,modfreqp2,color='red')
show()

Upvotes: 0

Views: 1815

Answers (1)

tacaswell
tacaswell

Reputation: 87376

fig = pylab.figure()
ax = fig.add_subplot(111)
ax.plot(freqs,modfreqp,color='black')
ax.plot(freqs1,modfreqp1,color='blue')
ax.plot(freqs2,modfreqp2,color='red')
show()

should do what you want.

Upvotes: 4

Related Questions