Matplotlib Draw A Line Between Two Points

[Solved] Matplotlib Draw A Line Between Two Points | Basic - Code Explorer | yomemimo.com
Question : matplotlib draw a line between two points

Answered by : carlos-santos-pinto

import matplotlib.pyplot as plt
# Just plot a normal line plot consisting of the two desired points
p1 = [0,3]
p2 = [1,-2]
x, y = [p1[0], p2[0]], [p1[1], p2[1]]
plt.plot(x,y)
plt.show()

Source : | Last Update : Mon, 13 Sep 21

Answers related to matplotlib draw a line between two points

Code Explorer Popular Question For Basic