-
Notifications
You must be signed in to change notification settings - Fork 0
/
marker_style_test.py
63 lines (48 loc) · 1.51 KB
/
marker_style_test.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
def test_marker(n, x_cords, y_cords, mk):
fig = plt.figure()
# set_xscale only supported in add_subplot
ax = fig.add_subplot(111)
rows = len(x_cords)
for i in range(rows):
ax.scatter(
x_cords[i],
y_cords[i],
marker=mk,
s=100,
# color="#007dff",
color='none',
# color='b',
edgecolors='black')
ax.axvline(x=eps_swp[i], c='grey', ls=':', lw=1)
ax.set_xscale('log')
ax.set_yscale('log')
ax.set_xlim([10**-2 - 10**-3, 10**2 + 10])
ax.set_ylim([10**-4, 10**2])
ax.yaxis.grid(ls=':')
ax.set_aspect(1.0 / ax.get_data_ratio() * 0.3)
plt.savefig("../tmp/" + str(ord(mk)) + '.pdf',
bbox_inches="tight",
pad_inches=0.1)
# plt.show()
plt.close()
mks = ['o', 'v', '^', '<', '>', '1', '2', '3', '4', '8', 's', 'p', 'P', '*', 'h', 'H', '+', 'x', 'X', 'd', 'D']
for mk in mks:
n = 50
state = random_initialize(n, 50, 100)
x_cords = []
y_cords = []
var_cords = []
for eps in eps_swp:
# x_cord is filed with the same eps
x_cord = []
y_cord = []
# optimal setting
c_ = set_c(eps, q_, s_)
# run 20 times for each eps
for _ in range(20):
x_cord.append(eps)
y_cord.append(direct_cal_diff(n, s_, c_))
x_cords.append(x_cord)
y_cords.append(y_cord)
var_cords.append(np.var(y_cord, ddof=1))
test_marker(n, x_cords, y_cords, mk)