numpy - Python - axes and plt.figure() -
could @ code. must 3 sample of sinus axes.
import matplotlib.pyplot plt import numpy np t = np.arange(0.0, 2.0, 0.01) fig = plt.figure() ax1 = fig.add_subplot(311) y1 = np.sin(2*np.pi*t) ax1.plot(t, y1); ax1.grid(true) ax1.set_ylabel('1 hz'); ax2 = fig.add_subplot(312) y2 = np.sin(4*np.pi*t) ax2.plot(t, y2); ax2.grid(true) ax2.set_ylabel('4 hz'); ax3 = fig.add_subplot(313) y3 = np.sin(6*np.pi*t) ax3.plot(t, y3); ax3.grid(true) ax3.set_ylabel('6 hz'); plt.show()
could me why code nothing ? see "figure 1" , that's all.
sory english :d
try adding fig.canvas.draw()
before plt.show()
.
traditionally fig.canvas.draw()
actual drawing , plt.show()
enters interactive event loop. when using ipython or interactive interpreter,ion()
, ioff()
toggle updating after each command.
interstingly code should on computer (debian unstable) - behavior changed newer matplotlib-versions.
Comments
Post a Comment