-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot.py
57 lines (42 loc) · 1015 Bytes
/
plot.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
import csv
import matplotlib.pyplot as plt
import sys
# Path to the CSV file
csv_file = sys.argv[1]
# Lists to store the x and y coordinates
x_values = []
y_values = []
xv2 = []
yv2 = []
idx = 0
# Read data from the CSV file
with open(csv_file, "r") as file:
reader = csv.reader(file)
for row in reader:
idx += 1
x_values.append(float(row[0]))
y_values.append(float(row[1]))
plt.plot(x_values, y_values, marker='.')
plt.plot(xv2, yv2, marker='.')
csv_file = "middle.csv"
# Lists to store the x and y coordinates
x_values = []
y_values = []
xv2 = []
yv2 = []
idx = 0
# Read data from the CSV file
with open(csv_file, "r") as file:
reader = csv.reader(file)
for row in reader:
idx += 1
x_values.append(float(row[0]))
y_values.append(float(row[1]))
# Plot the graph
plt.plot(x_values, y_values, marker='.')
plt.plot(xv2, yv2, marker='.')
plt.xlabel('X-axis')
plt.ylabel('Y-axis')
plt.title('Graph from CSV Data')
plt.grid(True)
plt.show()