HSWO_BSC_BACHELORS_THESIS/images/make-qrlib-compare-barchart.py

38 lines
1.1 KiB
Python
Executable File

#!python
import matplotlib.pyplot as plt
# Create data for the chart
objects = {
"(js) kjua": [8, 2, 0],
"(js) soldair/node-qrcode": [8, 3, 4],
"(php) chillerlan/php-qrcode": [10, 10, 10],
"(php) kreativekorp/barcode": [0, 3, 4],
"(php) bacon/baconqrcode": [5, 8, 4],
}
# Transpose the data
objects_data = list(zip(*[value for key, value in objects.items()]))
# Create the x-axis of the chart
x = list(objects.keys())
# Property names
property_names = ["Funktionalität", "Gepflegtheit", "Workflow-Eignung"]
# Create the chart
for i, object_data in enumerate(objects_data):
plt.bar(x, object_data, bottom=[sum(objects_data[j][k] for j in range(i)) for k in range(len(x))], width=0.5, label=property_names[i])
# Add title and legend to the chart
plt.title('Vergleich von QR-Code Bibliotheken im Kontext:\nWeinland-Mosel Einlieferungswerkzeug')
plt.legend()
plt.ylabel("Gesamteignung")
# Rotate the x-axis labels to avoid overlapping
plt.xticks(rotation=45)
# Increase the bottom margin to avoid x-axis labels getting cut off
plt.subplots_adjust(bottom=0.35)
#save the figure
plt.savefig("images/qrlib-compare-barchart.png")