-
Notifications
You must be signed in to change notification settings - Fork 11
/
PlotFunction.py
41 lines (32 loc) · 1009 Bytes
/
PlotFunction.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import numpy as np
import matplotlib.pyplot as mpy
def plot_square_map(width, height, _is_show=False):
figure = mpy.plot()
for i in range(0, height):
pos0 = [i, i]
pos1 = [0, width - 1]
figure = mpy.plot(pos0, pos1, 'black')
for j in range(0, width):
pos0 = [0, height - 1]
pos1 = [j, j]
mpy.plot(pos0, pos1, 'black')
if _is_show:
mpy.show()
return figure
def list_color():
color_list = ('c0', 'c1', 'c2', 'c3', 'c4', 'c5', 'c6', 'c7', 'c8', 'c9')
return color_list
def list_marker():
marker_list = ('o', 's', 'p', '*', 'h', 'x', 'D')
return marker_list
def plot_spotty(spotty, _is_show=False):
try:
nation = spotty.nation
except KeyError:
nation = 0
color = list_color()[nation]
marker = list_marker()[spotty.tribe - 1]
figure = mpy.plot(spotty.position, color, marker)
if _is_show:
mpy.show(figure)
return figure