版權聲明:本文為博主原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接和本聲明。
本文鏈接:https://blog.csdn.net/u011489887/article/details/78832566
1.單個條形圖並顯示數字
import matplotlib.pyplot as plt name_list = ['lambda=0', 'lambda=0.05', 'lambda=0.1', 'lambda=0.5'] num_list = [52.4, 57.8, 59.1, 54.6] rects=plt.bar(range(len(num_list)), num_list, color='rgby') # X軸標題 index=[0,1,2,3] index=[float(c)+0.4 for c in index] plt.ylim(ymax=80, ymin=0) plt.xticks(index, name_list) plt.ylabel("arrucay(%)") #X軸標簽 for rect in rects: height = rect.get_height() plt.text(rect.get_x() + rect.get_width() / 2, height, str(height)+'%', ha='center', va='bottom') plt.show()
2.畫對比條形圖中文顯示標注並保存為圖片
————————————————
版權聲明:本文為CSDN博主「好運吉祥」的原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/u011489887/article/details/78832566