Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib.pyplot as plt
- import numpy as np
- ### Zadanie 1
- x = np.arange(0, 30, 1)
- y = x ** 2 + x
- ### Zadanie 2
- plt.scatter(x, y)
- plt.show()
- ### Zadanie 3
- plt.suptitle('Wykresy')
- plt.subplot(2, 1, 1)
- plt.plot(x, y, marker='o', linestyle='-')
- plt.title('Wykres funkcji x^2 + x')
- y = x ** 3 + x
- plt.subplot(2, 1, 2)
- plt.plot(x, y, 's--', color='red')
- plt.title('Wykres funkcji x^3 + x')
- plt.show()
- ### Zadanie 4 + Zadanie 5
- plt.style.use('seaborn')
- plt.suptitle('Wykresy')
- plt.legend(loc='best')
- plt.subplot(2, 1, 1)
- plt.plot(x, y, marker='o', linestyle='-')
- plt.title('Wykres funkcji x^2 + x')
- y = x ** 3 + x
- plt.subplot(2, 1, 2)
- plt.plot(x, y, 's--', color='red')
- plt.legend(loc='best')
- plt.title('Wykres funkcji x^3 + x')
- plt.show()
- ## Zadanie 6
- def circle_points(r, n):
- circles = []
- for r, n in zip(r, n):
- t = np.linspace(0, 2*np.pi, n, endpoint=False)
- x = r * np.cos(t)
- y = r * np.sin(t)
- circles.append(np.c_[x, y])
- return circles
- r = [0.6]
- n = [36]
- circles = circle_points(r, n)
- fig, ax = plt.subplots()
- for circle in circles:
- ax.scatter(circle[:, 0], circle[:, 1])
- ax.set_aspect('equal')
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement