Initialer Commit
This commit is contained in:
commit
24e7e1cfb4
76
plot.py
Normal file
76
plot.py
Normal file
@ -0,0 +1,76 @@
|
||||
from datetime import datetime as dt
|
||||
|
||||
from matplotlib import pyplot as plt
|
||||
|
||||
# einträge ohne kommentar sind von archive.org
|
||||
raw_data = [
|
||||
#("", , , ),
|
||||
("2012-01", 73, 0, 0), # ck ss12
|
||||
("2013-01", 42, 31, 450),
|
||||
("2013-02", 42, 31, 450), #ck ss13
|
||||
("2013-07", 42, 31, 0),
|
||||
("2013-07", 42, 31, 0), #ck ws1314
|
||||
("2013-11", 42, 33.2, 0),
|
||||
("2014-01", 42, 33.2, 0),
|
||||
("2014-01", 42, 33.2, 0), #ck ss14
|
||||
("2014-04", 42, 33.2, 0),
|
||||
("2014-06", 42, 33.2, 0),
|
||||
("2014-11", 42, 33.2, 0),
|
||||
("2015-01", 42, 33.2, 0),
|
||||
("2015-01", 42, 33.2, 0), #ck ss15
|
||||
("2015-07", 42, 33.2, 0), #ck ws1516 (@2016-09)
|
||||
("2015-08", 42, 33.2, 0),
|
||||
("2015-09", 42, 33.2, 0),
|
||||
("2016-05", 42, 38, 0), #ck ss16 (@2016-09)
|
||||
("2016-07", 42, 38, 0), #ck ws 1617 (@2016-09)
|
||||
("2016-12", 50, 38, 0),
|
||||
("2017-03", 50, 38, 0), #ck ss17
|
||||
("2017-07", 50, 38, 0),
|
||||
("2019-05", 60, 40.4, 0),
|
||||
]
|
||||
|
||||
data = []
|
||||
|
||||
base_date = dt(year=1,month=1,day=1)
|
||||
|
||||
for raw_dt, studw, ticket, sem in raw_data:
|
||||
date = dt.strptime(raw_dt, "%Y-%m")
|
||||
data.append((date, studw, ticket, sem, (date-base_date).days))
|
||||
# plt.plot_date(date, (studw+ticket), xdate=True)
|
||||
|
||||
dates, studw, tickets, sem, day_diff = zip(*data)
|
||||
#plt.plot_date(day_diff, studw, xdate=True, linestyle="solid",label="studentenwerksbeitrag")
|
||||
#plt.plot_date(day_diff, tickets, xdate=True, linestyle="solid", label="semesterticket", bottom=studw)
|
||||
#plt.plot_date(day_diff, sem, xdate=True)
|
||||
#plt.show()
|
||||
|
||||
|
||||
plt.stackplot(dates, (tickets, studw), labels=("semesterticket","studentenwerksbeitrag"))
|
||||
|
||||
plt.legend(loc="upper left")
|
||||
plt.savefig("semesterbeiträge.png")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user