-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot.py
More file actions
66 lines (51 loc) · 1.84 KB
/
plot.py
File metadata and controls
66 lines (51 loc) · 1.84 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
import matplotlib.pyplot as plt
def read_data(file_path):
with open(file_path, 'r') as file:
lines = file.readlines()
data = []
for line in lines:
line = line.strip()
if ' ' in line:
x, y = line.split(' ')
data.append((float(x), float(y)))
else:
data.append(float(line))
return data
def plot_graphs(*data_sets):
plt.figure()
markers = ['o', 'o', '<', '<']
colors = ['green', 'blue', 'green', 'blue']
for i, data in enumerate(data_sets):
x = []
y = []
for j, item in enumerate(data):
if isinstance(item, tuple):
# if j % 2 != 0: # Skip every second data point
# continue
x.append(item[0])
y.append(item[1])
else:
# if j % 2 != 0: # Skip every second data point
# continue
y.append(item)
if len(x) == 0:
x = range(1, len(y) + 1)
plt.scatter(x, y, marker=markers[i % len(markers)], facecolors='none', edgecolors=colors[i % len(colors)])
#plt.xscale('log')
plt.yscale('log')
plt.xlabel('Depth', fontsize=17)
plt.ylabel('Time (ms)', fontsize=17)
plt.xticks(fontsize=17)
plt.yticks(fontsize=17)
#plt.title('titlos')
legends = ['nq=50, This work', 'nq=250, This work', 'nq=50, QuSAT', 'nq=250, QuSAT']
plt.legend(legends, fontsize=12)
plt.savefig('/Users/thanosd/Downloads/data/d.pdf',dpi=300,format='pdf',bbox_inches='tight')
# plt.ylim(1, 10000000000)
plt.show()
# Example usage:
data1 = read_data('stim_times_50.txt')
data2 = read_data('stim_times_250.txt')
data3 = read_data('qusat_times_50.txt')
data4 = read_data('qusat_times_250.txt')
plot_graphs(data1, data2, data3, data4)