1import numpy as np
2from matplotlib import pyplot as plt
3
4def main():
5 plt.axis([-50,50,0,10000])
6 plt.ion()
7 plt.show()
8
9 x = np.arange(-50, 51)
10 for pow in range(1,5): # plot x^1, x^2, ..., x^4
11 y = [Xi**pow for Xi in x]
12 plt.plot(x, y)
13 plt.draw()
14 plt.pause(0.001)
15 input("Press [enter] to continue.")
16
17if __name__ == '__main__':
18 main()