I'm writing a python function to draw a simple rectangle, the vertex points are parameters. Well, this does not work correctly and I can't seem to find out why its plotting all over the place. EDIT: as for my imports. So sp is sympy. As for the expected result to draw a rectangle of course.
%matplotlib inline
import sympy as sp
import numpy as np
import matplotlib.pyplot as plt
import math
def draw_rectangle(P1,P2,P3,P4):
p1, p2, p3, p4 = sp.Point(P1[0], P1[1]), sp.Point(P2[0], P2[1]), sp.Point(P3[0], P3[1]),
sp.Point(P4[0], P4[1])
plt.plot(p1,p2)
plt.plot(p2,p3)
plt.plot(p3,p4)
plt.plot(p4,p1)
P1=[20,30]
P2=[40,30]
P3=[40,60]
P4=[20,60]
draw_rectangle(P1,P2,P3,P4)