I know there is another very similar question, but I could not extract the information I need from it.
plotting lines in pairs
I have 4 points in the (x,y)
plane: x=[x1,x2,x3,x4]
and y=[y1,y2,y3,y4]
x=[-1 ,0.5 ,1,-0.5]
y=[ 0.5, 1, -0.5, -1]
Now, I can plot the four points by doing:
import matplotlib.pyplot as plt
plt.plot(x,y, 'ro')
plt.axis('equal')
plt.show()
But, apart from the four points, I would like to have 2 lines:
1) one connecting (x1,y1)
with (x2,y2)
and
2) the second one connecting (x3,y3)
with (x4,y4)
.
This is a simple toy example. In the real case I have 2N points in the plane.
How can I get the desired output: for points with two connecting lines ?
Thank you.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…