import numpy as np
import matplotlib.pyplot as plt
img=np.ones((600,600,3))
def DrawLine(x1,y1,x2,y2):
dx = abs(x2-x1)
dy = abs(y2-y1)
if x1<x2:
xs=1
else:
xs=-1
if y1<y2:
ys=1
else:
ys=-1
x=x1
y=y1
p=2*dy-dx
if dx>dy:
while x<x2:
x=x+xs
if p > 0:
y=y+ys
p=p+2*dy-2*dx
else:
p=p+2*dy
img[y,x]= 0
DrawLine(100,500,500,500)
plt.imshow(img)
plt.show()