matplotlib draw line x1, y1 1

matplotlib draw line x1, y1

import matplotlib.pyplot as plt
x1, y1 = [-1, 12], [1, 10]
x2, y2 = [-1, 10], [3, -1]
plt.xlim(0, 8), plt.ylim(-2, 8)
plt.plot(x1, y1, x2, y2, marker = 'o')
plt.show()

Here is what the above code is Doing:
1. We’re setting the x and y limits of the plot to be (0, 8) and (-2, 8) respectively.
2. We’re plotting the lines x1, y1 and x2, y2.
3. We’re setting the marker to be ‘o’ which means that the plot points will be circular in shape.

Similar Posts