-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgraph.py
43 lines (33 loc) · 1017 Bytes
/
graph.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
import datetime
import matplotlib.pyplot as plt
import pprint
import sys
from gain import load_exercise_data
# https://www.quora.com/In-bodybuilding-fitness-what-s-the-difference-between-volume-and-intensity-when-it-comes-to-training
def main(argv):
if len(argv) != 2:
print("gain EXERCISE")
return -1
exercise = argv[1]
workouts = load_exercise_data(exercise)
index = []
values = []
for _, date, data in workouts:
day, month, year = date
date = datetime.date(year, month, day)
index.append(date)
#volume = 0
#for set in data["workout"]:
# reps = set["reps"]
# weight = set["weight"]
# volume += reps * weight
#values.append(volume)
weights = [item["weight"] for item in data["workout"]]
values.append(max(weights))
fig, ax = plt.subplots()
ax.plot(index, values)
ax.grid()
plt.show()
return 0
if __name__ == "__main__":
sys.exit(main(sys.argv))