import matplotlib.pyplot as plt
methods = ["A", "B", "C", "D", "E", "F"]
iou = [1, 2, 3, 4, 5, 6]
recall = [1, 2, 3, 4, 5, 6]
precision = [1, 2, 3, 4, 5, 6]
plt.style.use('seaborn')
fig, axs = plt.subplots(1, 3, figsize=(15, 5))
'''
'H' - 六边形;'P' - 五边形;'X' - X 形状;'s' - 正方形;
'D' - 菱形;'^' - 上三角形;'v' - 下三角形;'<' - 左三角形;'>' - 右三角形''
'''
marker_shapes = ['o', 's', 'D', '^', 'v', '<']
axs[0].scatter(methods, iou, label="IoU", marker='H', color='#1f77b4', s=150, edgecolors='k', linewidth=2)
axs[0].set_title("IoU Comparison")
axs[0].set_ylabel('IoU (%)')
axs[0].set_ylim(0, 100)
for i, txt in enumerate(iou):
axs[0].annotate(f'{txt:.2f}', (methods[i], iou[i]), textcoords="offset points", xytext=(0, 10), ha='center')
axs[1].scatter(methods, recall, label="Recall", marker='P', color='#ff7f0e', s=150, edgecolors='k', linewidth=2)
axs[1].set_title("Recall Comparison")
axs[1].set_ylabel('Recall (%)')
axs[1].set_ylim(0, 100)
for i, txt in enumerate(recall):
axs[1].annotate(f'{txt:.2f}', (methods[i], recall[i]), textcoords="offset points", xytext=(0, 10), ha='center')
axs[2].scatter(methods, precision, label="Precision", marker='D', color='#2ca02c', s=150, edgecolors='k', linewidth=2)
axs[2].set_title("Precision Comparison")
axs[2].set_ylabel('Precision (%)')
axs[2].set_ylim(0, 100)
for i, txt in enumerate(precision):
axs[2].annotate(f'{txt:.2f}', (methods[i], precision[i]), textcoords="offset points", xytext=(0, 10), ha='center')
plt.tight_layout()
fig.patch.set_facecolor('#f2f2f2')
for ax in axs:
ax.grid(axis='y', linestyle='--', alpha=0.7)
ax.grid(visible=True, which='major', linestyle='-')
ax.grid(visible=True, which='minor', linestyle='--', alpha=0.5)
ax.legend()
axs[0].legend()
plt.tight_layout()
plt.savefig('A.png', dpi=600, bbox_inches='tight')
plt.show()