This gist has python functions that help Matplotlib draw lines connecting points, and to draw boxes.
def drawBox(xlim, ylim):pts = [[xlim[0], ylim[0]], [xlim[1], ylim[0]],
           [xlim[1], ylim[1]], [xlim[0], ylim[1]], 
           [xlim[0], ylim[0]]]
x, y = zip(*pts)
return x, y
 
def connectPoints(pts):
x, y = zip(*pts)
return x, y
x, y = zip(*pts)
return x, y
def connectPoints(pts):
x, y = zip(*pts)
return x, y
 
