-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot.py
51 lines (40 loc) · 1.07 KB
/
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
import argparse
import matplotlib.pyplot as plt
import pandas as pd
import pendulum
def do_plot(df):
df["timestamp"] = df["timestamp"].map(lambda t: pendulum.parse(t))
fig, ax_temp = plt.subplots()
ax_temp.plot(
df["timestamp"],
df["temperature"],
"-",
marker="o",
color="red",
label="temperature",
)
ax_vib = ax_temp.twinx()
ax_vib.plot(
df["timestamp"],
df["vibration"],
"--",
marker="x",
color="blue",
label="vibration",
)
ax_temp.set_xlabel("Time")
ax_temp.set_ylabel("Temperature [deg C]")
ax_vib.set_ylabel("Vibration [G]")
for label in ax_temp.get_xticklabels():
label.set_rotation(30)
fig.legend()
tsl = df["timestamp"].to_list()
plt.title(f"{tsl[0]} - {tsl[-1]}")
plt.show()
if __name__ == "__main__":
p = argparse.ArgumentParser()
p.add_argument(
"--input-csv", type=str, required=True, help="Wanderer CSV file to plot"
)
args = p.parse_args()
do_plot(pd.read_csv(args.input_csv))