2 Commits

Author SHA1 Message Date
Marcin-Ramotowski
c409dfb7d1 Made more spaces about bars to place numbers 2025-08-06 23:35:04 +02:00
Marcin-Ramotowski
46079135b7 Added more colors; added values above the bars 2025-08-06 23:30:24 +02:00

View File

@@ -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,14 +40,27 @@ 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)
# Oblicz maksymalną wartość, by zwiększyć wysokość osi Y
max_val = max(group_means)
plt.ylim(0, max_val * 1.15) # dodaj 15% zapasu na tekst
plt.ylabel("Średni czas wdrożenia (sek)")
plt.title(f"Porównanie średnich czasów wdrożenia")
plt.xticks(rotation=45)
# Dodanie wartości nad słupkami
for bar in bars:
yval = bar.get_height()
plt.text(bar.get_x() + bar.get_width()/2.0, yval + max_val * 0.02, f'{yval:.1f}',
ha='center', va='bottom', fontsize=9)
plt.tight_layout()
plt.savefig(f"{output_folder}/mean_times_{i}.png")
plt.close()
print("Wykresy zapisane!")
print("Wszystkie wykresy wygenerowane z dodatkowymi marginesami!")