代码
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()
结果
代码
import matplotlib.pyplot as plt
categories = ['linear', 'conv1d+linear', 'reshape+linear']
plt.bar(categories[0], 0.9778, label='1 channel', color = "blue", width=0.3)
plt.bar(categories[1], 0.9922, label='4 channel', color = "green", width=0.3)
plt.bar(categories[2], 0.9925, color = "green", width=0.3)
plt.yticks([0.9778, 0.9925], ["97.78%", "99.25%"])
plt.legend(['1 channel', '4 channel'])
plt.ylim(0.95, 0.9950)
plt.tight_layout()
plt.grid(axis='y')
plt.show()
结果