Skip to content

Commit b3eb71c

Browse files
committed
Replace hardcoded EOLs
1 parent c47ae7b commit b3eb71c

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

history_plot.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,7 @@
2121
from termcolor import colored # pip install termcolor
2222

2323
from history_get import load_jsonlines
24-
25-
EOL = {
26-
"2.7": "2020-01-01",
27-
"3.4": "2019-03-18",
28-
"3.5": "2020-09-30",
29-
"3.6": "2021-12-23",
30-
"3.7": "2023-06-27",
31-
}
24+
from template import get_eols
3225

3326

3427
def dopplr(name):
@@ -56,13 +49,14 @@ def make_chart(dates, totals):
5649
fig, ax = plt.subplots()
5750

5851
print("Plot...")
52+
eol = get_eols()
5953
for version, v in totals.items():
6054
print(version)
6155

62-
if version in EOL and EOL[version] in dates:
56+
if version in eol and eol[version] in dates:
6357
# Add a vertical line to zero at EOL
64-
eol_pos = dates.index(EOL[version])
65-
# dates.insert(eol_pos, EOL[version])
58+
eol_pos = dates.index(eol[version])
59+
# dates.insert(eol_pos, eol[version])
6660
totals[version][eol_pos] = 0
6761
# breakpoint()
6862

@@ -77,7 +71,7 @@ def make_chart(dates, totals):
7771

7872
# Shrink current axis by 20% so legend is outside chart
7973
box = ax.get_position()
80-
ax.set_position([box.x0, box.y0, box.width * 0.9, box.height])
74+
ax.set_position((box.x0, box.y0, box.width * 0.9, box.height))
8175

8276
# Put a legend to the right of the current axis
8377
ax.legend(

0 commit comments

Comments
 (0)