Thinking of repainting the kitchen
... One day.
But I don't want to lose this important historical information - my offspring's height vs time!
So I've converted it into a nice graph
Using some code
#!/usr/bin/env python3 from datetime import datetime from matplotlib import pyplot as plt table = [ (132.4,'10/7/11'), (134.8,'14/9/11'), (136.9,'2/3/12'), (138.4,'7/9/12'), (141.5,'25/5/13'), (142.6,'23/6/13'), (145.8,'15/3/14'), (148.7,'15/11/14'), (150.0,'20/1/15'), (153.1,'8/6/15'), (157.7,'12/11/15'), (159.0,'21/12/15'), (160.1,'7/2/16'), (164.1,'12/6/16'), (167.6,'27/12/16'), (169.9,'4/3/17'), (171.7,'14/11/17'), (172.1,'6/6/18'), (172.9,'24/8/19'), (173.6,'2/4/20'), ] def labelToX(label: str): d,m,y = label.split('/') return datetime(int(y)+2000,int(m),int(d),12,0,0).timestamp() def main(): cm,l = zip(*table) x = tuple(map(labelToX,l)) y = tuple(map(lambda h:h/100, cm)) plt.xkcd() plt.scatter(x,y,marker='x') plt.plot(x, y, zorder=-1) # Hide the right and top spines plt.gca().spines['right'].set_visible(False) plt.gca().spines['top'].set_visible(False) plt.xlabel('date') plt.ylabel('height (m)') plt.xticks(x,l, rotation=80, fontsize=7) plt.gcf().subplots_adjust(bottom=0.2) plt.show() if __name__ == '__main__': main()
Comments
Post a Comment