-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.py
27 lines (18 loc) · 785 Bytes
/
utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import matplotlib.pyplot as plt
from matplotlib import cm
colormap = cm.get_cmap('viridis', 2015)
fig, move = plt.subplots()
fig.suptitle('The Trapped Knight')
def draw_start(spot, step_no):
return move.scatter(spot[0], spot[1], linewidth=0.6, edgecolor='r',
facecolors='none', zorder=3,
label='move={}'.format(step_no))
def draw_line(spotA, spotB, step_no):
return move.plot([spotA[0], spotB[0]], [spotA[1], spotB[1]],
c=colormap(step_no), linewidth=0.6)
def draw_end(spot, step_no):
return move.scatter(spot[0], spot[1], c='r', marker='x', linewidth=0.6,
label='move={}'.format(step_no))
def show_fig():
move.legend(loc='lower right', frameon=False)
plt.show()