代码
import matplotlib.pyplot as plt
import numpy as np
categories = ['denoise', 'double-digit', '100% 5R']
existence = [0.9778, 0.9768, 0.9767]
non_existence = [0.9772, 0.9767, 0.9778]
bar_width = 0.25
x = np.arange(len(categories))
plt.rcParams['font.size'] = 18
plt.bar(x, existence, width=bar_width, label='Apply')
plt.bar(x + bar_width, non_existence, width=bar_width, label="Not apply")
plt.title('Transformer')
plt.xticks(x + bar_width / 2, categories)
plt.yticks([0.976, 0.977, 0.978], ["97.6%", "97.7%", "97.8%"])
plt.legend()
plt.ylim(0.974, 0.98)
plt.tight_layout()
plt.grid()
plt.show()
结果