-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_plt_1pyCHARTs.py
64 lines (51 loc) · 1.22 KB
/
main_plt_1pyCHARTs.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
57
58
59
60
61
62
63
64
import matplotlib.pyplot as plt
import mplcursors
import csv
# Create axis arrays
x0 = []
y1 = []
y2 = []
y3 = []
# Open csv file and choose the delimiter.
with open('testDATA/dataframe.pycharts', 'r') as data_csv:
plots = csv.reader(data_csv, delimiter=',') # <TAB>: delimiter='\t'
# Skip first line -> no errors if are string header placed
next(plots)
# Read data x / y
for row in plots:
# Convert x_time to float
x0.append(float(row[1]))
# Convert y_xxx to float
y1.append(float(row[2]))
y2.append(float(row[3]))
y3.append(float(row[4]))
# Plot 01
plt.plot(
x0, y1,
color="g",
label='y1_rpm'
)
# Plot 02
plt.plot(
x0, y2,
color="b",
label="y2_power [kW]"
)
# Plot 03
plt.plot(
x0, y3,
color="#ff0000",
label="y3_current [A]"
)
# Site properties
fig = plt.gcf()
fig.canvas.manager.set_window_title('ECU Current Measurement - pyCHARTs')
plt.xlabel('x_Time')
plt.ylabel('y_axis')
# Set background
ax = plt.gca()
ax.set_facecolor('#E3EBFF')
ax.grid(color='silver')
# Implement cursor value
mplcursors.cursor(hover=False) # mplcursors.cursor(hover=True)
plt.show()