-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdraw.py
More file actions
24 lines (20 loc) · 713 Bytes
/
draw.py
File metadata and controls
24 lines (20 loc) · 713 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from matplotlib import pyplot as plt
import matplotlib
from direction import Direction
def draw_configuration(pts, target):
"""
Draw a configuration--a set of points, as well as a background rectangle
for the target shape. Will draw the target rectangle offset by 0.5 to make
things look right.
Arguments:
pts: set of (x,y) tuples
target: Shape object
"""
xs, ys = zip(*list(pts))
fig = plt.figure()
ax = fig.add_subplot(111)
rect1 = matplotlib.patches.Rectangle((-0.5,-0.5), target.length, target.width,
color='#DDDDFF', alpha=0.5)
ax.add_patch(rect1)
ax.scatter(xs, ys, color='#0000FF')
plt.show()