import matplotlib
import matplotlib.pyplot as plt
import numpy as np


STATS = (
    ("idlelib", 116),
    ("asyncio", 60),
    ("tkinter", 60),
    ("distutils", 58),
    ("unittest", 56),
    ("importlib", 45),
    ("typing.py", 39),
    ("ast.py", 28),
    ("multiprocessing", 24),
    ("ctypes", 20),
    ("enum.py", 20),

)

plt.rcdefaults()
fig, ax = plt.subplots()
fig.subplots_adjust(left=0.2)

labels = [label for label, _ in STATS]
y_pos = np.arange(len(STATS))
quantites = [qte for _, qte in STATS]

ax.barh(y_pos, quantites, align='center')
ax.set_yticks(y_pos)
ax.set_yticklabels(labels)
ax.invert_yaxis()  # labels read top-to-bottom
ax.set_xlabel('Les 11 premiers modifications et ajouts de fichier')
ax.set_title('Activités dans Lib/ en 2020')

#plt.show()
plt.savefig("commits-lib-2020-cpython.png")

