Added more colors; added values above the bars
This commit is contained in:
@ -29,7 +29,10 @@ groupings = [
|
||||
[2, 5, 8]
|
||||
]
|
||||
|
||||
# Folder wyjściowy (opcjonalnie)
|
||||
# Kolory z palety 'tab10'
|
||||
color_palette = plt.get_cmap('tab10')
|
||||
|
||||
# Folder wyjściowy
|
||||
output_folder = "plots"
|
||||
os.makedirs(output_folder, exist_ok=True)
|
||||
|
||||
@ -37,12 +40,19 @@ os.makedirs(output_folder, exist_ok=True)
|
||||
for i, group in enumerate(groupings):
|
||||
group_labels = [labels[j] for j in group]
|
||||
group_means = [means[j] for j in group]
|
||||
|
||||
colors = [color_palette(j % 10) for j in group] # różne kolory
|
||||
|
||||
plt.figure()
|
||||
plt.bar(group_labels, group_means)
|
||||
bars = plt.bar(group_labels, group_means, color=colors)
|
||||
plt.ylabel("Średni czas wdrożenia (sek)")
|
||||
plt.title(f"Porównanie średnich czasów wdrożenia")
|
||||
plt.xticks(rotation=45)
|
||||
|
||||
# Dodanie wartości na słupkach
|
||||
for bar in bars:
|
||||
yval = bar.get_height()
|
||||
plt.text(bar.get_x() + bar.get_width()/2.0, yval + 2, f'{yval:.1f}', ha='center', va='bottom', fontsize=9)
|
||||
|
||||
plt.tight_layout()
|
||||
plt.savefig(f"{output_folder}/mean_times_{i}.png")
|
||||
plt.close()
|
||||
|
Reference in New Issue
Block a user