-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestplot.py
More file actions
94 lines (74 loc) · 2.17 KB
/
testplot.py
File metadata and controls
94 lines (74 loc) · 2.17 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import matplotlib.pyplot as plt
import numpy as np
# Generate random points
np.random.seed(0)
random_points = np.random.rand(50, 2) * 100
# Generate the extra central point
central_point = np.array([[10, 90]])
# Create scatter plot
plt.scatter(random_points[:, 0], random_points[:, 1], color='blue', label='Replay Buffer states')
plt.scatter(central_point[:, 0], central_point[:, 1], color='red', label='Central Point')
# Set plot properties
plt.xlim(0, 100)
plt.ylim(0, 100)
plt.xlabel('X')
plt.ylabel('Y')
plt.title('Replay Buffer')
plt.legend()
# Display the plot
plt.show()
# Generate grid
x_grid = np.arange(0, 101, 33.3)
y_grid = np.arange(0, 101, 33.3)
# Create scatter plot with grid lines
# plt.scatter(random_points[:, 0], random_points[:, 1], color='blue', label='Replay Buffer states')
# plt.scatter(central_point[:, 0], central_point[:, 1], color='red', label='Central Point')
# Plot vertical grid lines
for x in x_grid:
plt.axvline(x, color='grey', linestyle='--')
# Plot horizontal grid lines
for y in y_grid:
plt.axhline(y, color='grey', linestyle='--')
dims = [(0,0),(0,1),(0,2),(1,0),(1,1),(1,2),(2,0),(2,1),(2,2)]
i = 0
for x in x_grid[:-1]:
for y in y_grid[:-1]:
plt.text(x=-5+x+(33.3)/2, y=y+(33.3)/2, s=dims[i])
i += 1
# Set plot properties
plt.xlim(0, 100)
plt.ylim(0, 100)
plt.xlabel('X')
plt.ylabel('Y')
plt.title('')
plt.legend()
# Display the plot
plt.grid(False)
plt.show()
x_grid = np.arange(0, 101, 11.1)
y_grid = np.arange(0, 101, 33.3)
# Create scatter plot with grid lines
# plt.scatter(random_points[:, 0], random_points[:, 1], color='blue', label='Replay Buffer states')
# plt.scatter(central_point[:, 0], central_point[:, 1], color='red', label='Central Point')
# Plot vertical grid lines
for x in x_grid:
plt.axvline(x, color='grey', linestyle='--')
# Plot horizontal grid lines
# for y in y_grid:
# plt.axhline(y, color='grey', linestyle='--')
dims = np.arange(10)
i = 0
for x in x_grid[:]:
plt.text(x=-5+x+(11.1)/2, y=10, s=dims[i])
i += 1
# Set plot properties
plt.xlim(0, 100)
plt.ylim(0, 20)
plt.xlabel('X')
plt.ylabel('Y')
plt.title('')
plt.legend()
plt.axis('off')
# Display the plot
plt.grid(False)
plt.show()