-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPythonOutput.py
More file actions
56 lines (40 loc) · 1.09 KB
/
Copy pathPythonOutput.py
File metadata and controls
56 lines (40 loc) · 1.09 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
import matplotlib.pyplot as plt
import numpy as np
import subprocess
from subprocess import Popen, PIPE, check_output
import sys
import csv
# Compile the C++ program
subprocess.check_output(
"g++ -std=c++17 main.cpp Trainer.cpp Pokemon.cpp -o outputProgram.exe",
stderr=subprocess.STDOUT,
shell=True
)
# Execute the compiled program
subprocess.run("./outputProgram.exe", shell=True, check=True)
# read data into files
with open('project4_outfile.csv', mode='r', encoding='utf-8') as file:
reader = csv.reader(file)
selectionOne = []
selectionTwo = []
names = []
xName = ""
yName = ""
count = 0
for row in reader:
selectionOne.append(int(row[0]))
selectionTwo.append(int(row[1]))
names.append((row[2]))
if count < 1:
xName = row[3]
yName = row[4]
count += 1
x = np.array(selectionOne)
y = np.array(selectionTwo)
plt.scatter(x, y)
for i, txt in enumerate(names):
plt.annotate(txt, (x[i], y[i]))
plt.xlabel(xName)
plt.ylabel(yName)
#plt.savefig('images/selectionOne.png')
plt.show()