import matplotlib.pyplot as plt
def line1(x):return x - 2
def line2(x):return 2 * x + 2
points = {'a': (-2, 3), 'b': (4, -3), 'c': (0, -5), 'd': (0, 0), 'e': (-5, 1), 'f': (-3, 0)}
x = range(-10, 10)y1 = [line1(i) for i in x]y2 = [line2(i) for i in x]
plt.plot(x, y1, label='y=x-2')plt.plot(x, y2, label='y=2x+2')
for point, coord in points.items():plt.scatter(coord[0], coord[1], label= f'{point} {coord}')
plt.legend()plt.show()
import matplotlib.pyplot as plt
Уравнение прямыхdef line1(x):
return x - 2
def line2(x):
Точкиreturn 2 * x + 2
points = {'a': (-2, 3), 'b': (4, -3), 'c': (0, -5), 'd': (0, 0), 'e': (-5, 1), 'f': (-3, 0)}
Графикx = range(-10, 10)
y1 = [line1(i) for i in x]
y2 = [line2(i) for i in x]
plt.plot(x, y1, label='y=x-2')
plt.plot(x, y2, label='y=2x+2')
for point, coord in points.items():
plt.scatter(coord[0], coord[1], label= f'{point} {coord}')
plt.legend()
plt.show()