Advertisement
molendzik

Numpy - zadanie 3

Apr 29th, 2020
811
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. import numpy
  2. import matplotlib.pyplot as plt
  3. from pylab import *
  4. plt.style.use("classic")
  5.  
  6. x = numpy.arange(-0.5, 0.5, 0.05)
  7. y1 = x
  8. y2 = []
  9. y3 = []
  10.  
  11. for i in x:
  12.     y2.append(numpy.sin(i))
  13.  
  14. for i in x:
  15.     y3.append(numpy.tan(i))
  16.  
  17. fig, ax = plt.subplots()
  18.  
  19. ax.plot(x,y1, "-b", label="y=x")
  20. ax.plot(x,y2, "-g", label="y=sin(x)")
  21. ax.plot(x,y3, "-r", label="y=tan(x)")
  22. ax.axis("equal")
  23. leg = ax.legend()
  24. plt.show()
  25. plt.savefig("wykres.pdf")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement