File size: 495 Bytes
79cf5f5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import matplotlib.pyplot as plt
def draw_distribution(title, x_label, y_label, items: list, values: list, zoom=0.8):
plt.figure(figsize=(int(len(items) * zoom), 10))
plt.bar(x=items, height=values)
plt.tick_params(labelsize=15)
plt.xlim(-1, len(items))
for a, b in zip(items, values):
plt.text(a, b, b, ha='center', va='bottom', fontsize=15)
plt.grid()
plt.title(title, fontsize=30)
plt.xlabel(x_label, fontsize=20)
plt.ylabel(y_label, fontsize=20)
|