Created
June 28, 2022 13:32
-
-
Save erdnaxeli/cbf8353af4d31b99ea4b54002f7552b3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import numpy as np | |
def plot(points, label): | |
dates = [p[0] for p in points] | |
y = 100 | |
values = [] | |
for _, augment in points: | |
y *= 1 + augment / 100 | |
values.append(y) | |
plt.plot(dates, values, label=label) | |
# https://twitter.com/StanGuerini/status/1541695171158593536 | |
points = [ | |
(1990, 2.5), | |
(1991, 1.9), | |
(1992, 2.6), | |
(1993, 2.7), | |
(1994, 1.4), | |
(1995, 2.3), | |
(1996, 0), | |
(1997, 0.5), | |
(1998, 1.1), | |
(1999, 1), | |
(2000, 0.9), | |
(2001, 0.9), | |
(2002, 1.3), | |
(2003, 0.6), | |
(2004, 0.5), | |
(2006, 1.2), | |
(2007, 1), | |
(2008, 0.5), | |
(2009, 0), | |
(2010, 0.7), | |
(2011, 0.3), | |
(2012, 0), | |
(2013, 0), | |
(2014, 0), | |
(2015, 0), | |
(2016, 0.3), | |
(2017, 0.9), | |
(2018, 0), | |
(2019, 0), | |
(2020, 0), | |
(2021, 3.5), | |
] | |
# https://www.insee.fr/fr/statistiques/2854085 | |
inflation = [ | |
(1990, 3.4), | |
(1991, 3.9), | |
(1992, 3.5), | |
(1993, 2.4), | |
(1994, 1.4), | |
(1995, 1.1), | |
(1996, 0.9), | |
(1997, 0.7), | |
(1998, 0.7), | |
(1999, 0.7), | |
(2000, 1.1), | |
(2001, 1.6), | |
(2002, 2.1), | |
(2003, 1.7), | |
(2004, 1.6), | |
(2005, 1), | |
(2006, 1.1), | |
(2007, 1.5), | |
(2008, 2), | |
(2009, 1.8), | |
(2010, 1.1), | |
(2011, 1.1), | |
(2012, 1.3), | |
(2013, 0.6), | |
(2014, 0.2), | |
(2015, 0.5), | |
(2016, 0.6), | |
] | |
plot(points, "point d'indice") | |
plot(inflation, "inflation") | |
plt.legend(loc="upper left") | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment