Don't show exercises with few elements in graphs
This commit is contained in:
parent
4bc6b618f9
commit
325bb0cb72
1 changed files with 10 additions and 3 deletions
13
gpx_stats.py
13
gpx_stats.py
|
|
@ -219,19 +219,25 @@ def _linedata(mode, start, end):
|
||||||
else:
|
else:
|
||||||
value = dist
|
value = dist
|
||||||
data[exer_type(dist, time, speed, date)].append([number, value])
|
data[exer_type(dist, time, speed, date)].append([number, value])
|
||||||
|
data = {
|
||||||
|
key: value
|
||||||
|
for key, value in data.items()
|
||||||
|
if len(value) > 2
|
||||||
|
}
|
||||||
return data, lastday
|
return data, lastday
|
||||||
|
|
||||||
|
|
||||||
def lines(mode='distance', duration='thismonth'):
|
def lines(mode='distance', duration='thismonth'):
|
||||||
plt.style.use('dark_background')
|
plt.style.use('dark_background')
|
||||||
fig = plt.figure(figsize=(12,6))
|
fig = plt.figure(figsize=(18, 10))
|
||||||
ax = fig.subplots()
|
ax = fig.subplots()
|
||||||
data, lastday = _linedata(mode,
|
data, lastday = _linedata(mode,
|
||||||
datetime.date.today().replace(day=1).replace(month=1),
|
datetime.date.today().replace(day=1).replace(month=1),
|
||||||
datetime.date.today() + datetime.timedelta(days=1),
|
datetime.date.today() + datetime.timedelta(days=1),
|
||||||
)
|
)
|
||||||
for exer in TRACKED:
|
for exer in TRACKED:
|
||||||
plt_line(data[exer['describe']], ax, exer['describe'], nbins=lastday)
|
if exer['describe'] in data:
|
||||||
|
plt_line(data[exer['describe']], ax, exer['describe'], nbins=lastday)
|
||||||
data, lastday = _linedata(mode,
|
data, lastday = _linedata(mode,
|
||||||
(datetime.date.today().replace(day=1).replace(month=1)
|
(datetime.date.today().replace(day=1).replace(month=1)
|
||||||
- datetime.timedelta(days=1)).replace(day=1).replace(month=1),
|
- datetime.timedelta(days=1)).replace(day=1).replace(month=1),
|
||||||
|
|
@ -239,7 +245,8 @@ def lines(mode='distance', duration='thismonth'):
|
||||||
- datetime.timedelta(days=1),
|
- datetime.timedelta(days=1),
|
||||||
)
|
)
|
||||||
for exer in TRACKED:
|
for exer in TRACKED:
|
||||||
plt_line(data[exer['describe']], ax, exer['describe'] + " (prev. year)", nbins=lastday)
|
if exer['describe'] in data:
|
||||||
|
plt_line(data[exer['describe']], ax, exer['describe'] + " (prev. year)", nbins=lastday)
|
||||||
ax.legend(loc='upper left')
|
ax.legend(loc='upper left')
|
||||||
|
|
||||||
ax2 = ax.twiny()
|
ax2 = ax.twiny()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue