import matplotlib.pyplot as plt import numpy as np # creates horizontal bar plots based on the classification results def horizontal_bar_plot(index, label): plt.rcParams["font.family"] = "Arial" fig, ax = plt.subplots() fig.set_size_inches(8, 0.9) ax.barh([0], [1], color='lightgray', edgecolor='black', linewidth=3) if index == 0: i = 0.1 color = 'green' elif index == 1: i = 0.5 color = 'yellow' else: i = 0.9 color = 'red' plt.title(label, fontsize=16, fontweight='light', color='black', loc='center') ax.scatter([i], [0], color=color, marker="s", s=2000, edgecolors='black', linewidth=2) ax.set_xlim(-0.2, 1.2) # Adjust x-limits ax.set_ylim(-0.5, 0.5) ax.set_xticks([]) ax.set_yticks([]) ax.spines['top'].set_visible(False) ax.spines['right'].set_visible(False) ax.spines['bottom'].set_visible(False) ax.spines['left'].set_visible(False) return fig def check_classification(array): feed = array[0] depth = array[1] wear = array[2] fig_feed = horizontal_bar_plot(feed, "Vorschub") fig_depth = horizontal_bar_plot(depth, "Schnitttiefe") fig_wear = horizontal_bar_plot(wear, "Werkzeugzustand") return fig_feed, fig_depth, fig_wear