import numpy as np import matplotlib.pyplot as plt from matplotlib.pyplot import figure import time from time import strftime, gmtime def get_name() -> str: curr = time.time() s = strftime("%d_%b_%Y_%H%M%S", gmtime(curr)) return s width = 0.4 kernels = ["Gmail", "WhatsApp", "Youtube", "Twitter", "Facebook"] x = np.arange(5) values = (8.13, 4.15, 10.06, 16.75, 18.84) print(values) # Standard deviations (error values) # errors = [np.std(poly), np.std(rbf), np.std(sigmoid)] # errors2 = [np.std(baseline_poly), np.std(baseline_rbf), np.std(baseline_sigmoid)] # print(errors) # print(errors2) # Create bar chart with error bars fig, ax = plt.subplots() # plt.bar(x-0.22, values, width, yerr=errors, capsize=8, color='moccasin', edgecolor='black', label='Sunfish') # plt.bar(x+0.22,values2, width, yerr=errors2, capsize=8, color='slategrey', edgecolor='black', label='OpenDC') plt.bar( x, values, width, capsize=8, color="thistle", edgecolor="black", label="Red + Yellow Alarms / Total Failures", ) # Add labels and title plt.xlabel("Mean Failure Intensity (Trace)", fontweight="bold", size=10) plt.ylabel("Failures Detection Rate", fontweight="bold", size=10) loc = range(len(kernels)) labels = kernels plt.xticks(loc, kernels, size=10) plt.grid(True, color="lightgray", linewidth=1, linestyle="-.") plt.legend(fontsize=10, loc="upper left") plt.yticks(size=10) # ax.set_yscale("log") # Show plot location: str = "figures/%s.pdf" % get_name() plt.savefig(location, dpi=300, bbox_inches="tight")