-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakeGraph.py
More file actions
45 lines (42 loc) · 1.15 KB
/
makeGraph.py
File metadata and controls
45 lines (42 loc) · 1.15 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
from mpl_toolkits import mplot3d
import numpy as np
import matplotlib.pyplot as plt
import ioUtils
from handleColor import colorDecompact
def makeGraph():
learned = ioUtils.getLearned()
# Creating figure
fig = plt.figure(figsize=(10, 10))
ax = plt.axes(projection="3d")
colorToMLib = {
"RED":"red",
"ORANGE":"darkorange",
"YELLOW":"yellow",
"GREEN":"green",
"BLUE":"blue",
"PURPLE":"purple",
"PINK":"hotpink",
"BROWN":"brown",
"WHITE":"white",
"LIGHT GRAY":"lightgray",
"DARK GRAY":"darkgray",
"BLACK":"black"
}
# Creating plot
for l in learned:
x = []
y = []
z = []
for c in learned[l]:
colorRgb = colorDecompact(c[0])
x.append(colorRgb[0])
y.append(colorRgb[1])
z.append(colorRgb[2])
color = "blue"
if l in colorToMLib:
color = colorToMLib[l]
ax.scatter3D(x, y, z, color=color, alpha=1)
ax.set_xlabel('Red')
ax.set_ylabel('Green')
ax.set_zlabel('Blue')
plt.savefig('graph.png', transparent=True)